Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all 7260 articles
Browse latest View live

RE: [Connect C++] Setting Active Z for NamedView


RE: MDL did not get loaded with MicroStation Powerdraft version V8i

MDL did not get loaded with MicroStation Powerdraft version V8i

$
0
0

Hi,

My MDL can be loaded by Microstation V8i, XM, and all other Microstation versions. But it can not be loaded by Powerdraft  version.

It gives me an error message "XXXXDLL don't have verification procedure".

How can I fix this problem?

Best,



RE: [V8i VBA] Removing Sub-Element from Cell

$
0
0

Thanks for the suggestion, I'm sure I've seen it before but don't recall using it.

I've amended my procedure so that I should only be copying the elements I want to keep however after running the code, the elements remain unchanged.

Private Sub ProcessCell(eleCell As CellElement)

Dim oEE                                           As ElementEnumerator
Dim i                                             As Integer
Dim Black                                         As Long

Black = ActiveModelReference.InternalColorFromRGBColor(RGB(0, 0, 0))

eleCell.ResetElementEnumeration
Do While eleCell.MoveToNextElement(True)
    Dim eleTemp                                   As Element

    If Not eleCell.Type = msdElementTypeShape And Not eleCell.Color = Black Then
        Set eleTemp = eleCell.CopyCurrentElement
        eleCell.ReplaceCurrentElement eleTemp
        ShapeCount = ShapeCount + 1
    Else
    End If
Loop
    eleCell.Redraw
    eleCell.Rewrite
Debug.Print ShapeCount
End Sub

This is almost the same as the VBA example yet it doesn't mention GetSubElements or BuildArrayFromContents which I was almost certain I should be using.

RE: [V8i VBA] Removing Sub-Element from Cell

$
0
0

[quote user="Barry Lothian"]the elements remain unchanged

If Not eleCell.Type = msdElementTypeShape And Not eleCell.Color = Black Then
  Set eleTemp = eleCell.CopyCurrentElement
  eleCell.ReplaceCurrentElement eleTemp
Else

[/quote]

Because you're not changing anything.  All you're doing, if an element has certain symbology, is replacing it with itself.  Elements that don't match the symbology are left unchanged.

[quote user="Barry Lothian"]It doesn't mention GetSubElements or BuildArrayFromContents which I was almost certain I should be using[/quote]

You could use those... 

  1. Use GetSubElements on the existing cell
  2. Create an array of elements using BuildArrayFromContents
  3. Remove elements from the array
    1. Create a new elastic array
    2. Copy selected elements from the cell array to the elastic array, using ReDim
  4. Create a new cell from the filtered array
  5. Add the new cell
  6. Delete the old cell

RE: [V8i VBA] Removing Sub-Element from Cell

$
0
0

[quote user="Jon Summers"]

Because you're not changing anything.  All you're doing, if an element has certain symbology, is replacing it with itself.  Elements that don't match the symbology are left unchanged.

[/quote]

I was under the impression I was creating a temporary element, copying the elements without that symbology combination to that element and then replacing the original cell with the temp element.

I just noticed the deletecurrentelement method, would you advise using this to remove the shape element?.

RE: removing proxyelements from Microstation files

$
0
0

[quote user="Ido Cohen"]Can I make sure  the value of the parameter "MS_DWGSAVEAPPLICATIONDATA = 0 is kept for the user each time he enters MicroStation?[/quote]

MS_DWGSAVEAPPLICATIONDATA is a MicroStation configuration variable.  You specify configuration variables in one of MicroStation's configuration files.  Configuration files are plain text files.  Most have the extension .cfg.  Read about configuration in MicroStation help.

[quote user="Ido Cohen"]s there a way to control the parameter automatically[/quote]

You can query and set a configuration file using MicroStation development languages, including VBA.  ActiveWorkspace.AddConfigurationVariable and ActiveWorkspace.ConfigurationVariableValue do what you want.

RE: removing proxyelements from Microstation files


removing proxyelements from Microstation files

$
0
0

Can I make sure  the value of the parameter "MS_DWGSAVEAPPLICATIONDATA = 0 is kept for the user each time he enters Microstation. I wasn't able to achieve that.

Is there a way to control the parameter automatically, for example by running a recorded macro. I wasn't t able to record this type of  macro. Is there a way to do that using vba code?

RE: [CONNECT C++] Don't Understand Why a Support (non-app) .dll is being Loaded

$
0
0

For cdb.exe/windbg.exe as your debugger you can set a breakpoint on module loads (sxe ld) or unloads (sxe ud).
For Visual Studio as your debugger you can set a breakpoint on module loads: Ctrl+Alt+B, then Ctrl+B.  Enter the module and function name to break on.
     e.g. ‘{,,<YourModuleName>.dll}DllMain’

Once your break point is entered, view the call stack window.

If you do not own/have source code or if the request is made out-of-process, I also recommend using:

  • Dependency Walker(depends.exe).
    • Open a .exe or .dll (Ctrl+O)
    • Open Profile Settings (F7)
    • Check these options:
      • "Hook the process..."
      • "Log LoadLibrary function calls"
      • Click OK, then watch the Log window details.
  • Gflags.exe - Loader snaps

HTH,
Bob

RE: [CONNECT C++] Don't Understand Why a Support (non-app) .dll is being Loaded

$
0
0

OK - I wrote an EXTREMELY small test .dll, and only have it in my development mdlapps folder. When I open MicroStation , it "fires". I ran MicroStation in VS2013 (debug) and set a breakpoint at the class constructor. When the code stopped, I looked at the call stack (see below). Sorry, but I don't see anything except MicroStation calls.

 


 

and here is a clip from VS2013:


 

So, line 55 (dynamic initializer) is:

CdllOnlyTestApp theApp;

 

Is CONNECT automatically loading .dll's it finds in MS_LIBRARYPATH and/or MS_MDL? I don't see why it's getting loaded.

 

 

Bruce

RE: [CONNECT C++] Don't Understand Why a Support (non-app) .dll is being Loaded

$
0
0

I *think* I have found the culprit. I'm attempting to add an icon into a tool. In my VS project I created an icon resource so it was included in the app's .dll. When I ran the tool, I got no displayed icon, so I added the location of the .dll as an entry of MS_ICONLIBRARYLIST. It must be that MicroStation is loading the .dlls it finds in that path, looking for icon resources. Once I removed my folder from MS_ICONLIBRARYLIST, I no longer get the mysterious "loading" of my helper .dll.

 

Still haven't got the icon to show up in ToolSettings yet...

 

 

Bruce

[CONNECT C++] Don't Understand Why a Support (non-app) .dll is being Loaded

$
0
0

I've got an app (srs_dgnApp) that gets loaded as an MS_DGNAPPS entry. Loads fine, and does what it needs to do. I have next created a "helper" .dll file to handle some ElementTemplate operations. This "helper" is NOT called by "srs_dgnApp" (see the DEPENDS listing below). However, once that "helper" code is compiled and the .dll is placed in the same folder as "srs_dgnApp". I can see it is being loaded (I have a print statement that shows the class constructor fires). I don't understand why this is happening, and it also prevents me from loading/unloaded my second app that uses that helper (I cannot recompile the second app without fully exiting CONNECT).

srs_dgnApp has no connection to my helper (SRSTemplateUtils.dll).

and here is the "help" .dll in DEPENDS.

When both "srs_dgnApp" and "SRSTemplateUtils" are in the folder, when I start CONNECT, I get this Text Window:

The "Number of Rows" is the number of Element Templates I have in my .dgnlib. I have no idea why CSRSTemplateUtils is being created - it's not used in "srs_dgnApp". Any ideas on why that class is getting loaded ?

UPDATE: I have removed "srs_dgnApp" as an MS_DGNAPPS entry, so It's not called when I open a model. However, I still see my "helper" .dll class get created... So the issue seems to be with how the is coded, although I don't understand why it's not working as expected. What would cause MicroStation to try and load that .dll ?

Bruce

RE: [V8i VBA] Removing Sub-Element from Cell

$
0
0

I never managed to get deletecurrentelement to work (as I had a deadline I didn't have the time to test where I was going wrong) so in the end I just changed the symbology of the offending shape to match that of the other shape in the cell as a quick fix but I do still wan't to learn how to remove the element. This is what I ended up with:

Private Sub ProcessCell(oCell As CellElement)

Dim oEE                                           As ElementEnumerator
Dim internalColor                                 As Long
Dim ArrElements()                                 As Element
Dim i                                             As Integer
Dim Black                                         As Long
Dim Red                                           As Long
Dim newcell                                       As Element

Black = ActiveModelReference.InternalColorFromRGBColor(RGB(0, 0, 0))
Red = ActiveModelReference.InternalColorFromRGBColor(RGB(255, 0, 0))

Set oEE = oCell.GetSubElements

ArrElements = oCell.GetSubElements.BuildArrayFromContents

For i = LBound(ArrElements) To UBound(ArrElements)
    If ArrElements(i).Type = msdElementTypeShape And ArrElements(i).Color = Black Then
        ArrElements(i).AsShapeElement.FillMode = 0
        ArrElements(i).AsShapeElement.Color = Red
        oCell.Rewrite
        oCell.Redraw
        ShapeCount = ShapeCount + 1
    End If
Next i
Set newcell = CreateCellElement1(oCell.Name, ArrElements, oCell.Origin, False)
ActiveModelReference.ReplaceElement oCell, newcell
Debug.Print ShapeCount
End Sub

[V8i VBA] Removing Sub-Element from Cell

$
0
0

I have a number of DWG files which have been converted to DGN. I noticed the annotation comprising of an arrow and text is a normal cell element however it all contains 2No. shapes 1 is a rectangular boundary the other appears to be used for a mask however it has the RGB value of 0,0,0 and prints black so I need to remove it from the cell.

I am attempting to:

  1. Scan the active model for cells
  2. Get the result of the scan (an element enumerator)
  3. Convert the element enumerator to an array
  4. Iterate the array, check if the sub-element is a shape and if its colour is RGB 0,0,0, delete the shape element and rewrite the cell element after reaching the end of loop.
Option Explicit
Option Base 0
Public ShapeCount As Long

Public Sub Main()

Dim oCell                                         As CellElement
Dim oDGN                                          As DesignFile
Dim oModel                                        As ModelReference
Dim oScanCriteria                                 As ElementScanCriteria
Dim oEE                                           As ElementEnumerator
Dim sModelName                                    As String

Set oScanCriteria = New ElementScanCriteria

oScanCriteria.ExcludeAllTypes
oScanCriteria.ExcludeAllClasses
oScanCriteria.IncludeClass msdElementClassPrimary
oScanCriteria.IncludeType msdElementTypeCellHeader

Set oDGN = ActiveDesignFile

For Each oModel In oDGN.Models
    Select Case oModel.Type
        Case msdModelTypeNormal
            sModelName = oModel.Name
            Debug.Print sModelName

            Set oEE = oDGN.Models(sModelName).Scan(oScanCriteria)

            ShapeCount = 0

            While oEE.MoveNext
                Set oCell = oEE.Current
                If oCell.IsCellElement And oCell.Name = "MULTILEADER" Then
                    Debug.Print "[Processing Complex Element]" & " ElID: " & DLongToString(oCell.ID) & ", ElType: " & oCell.Type & ", ModelRefP: " & oCell.ModelReference.MdlModelRefP
                    ProcessCell oCell
                End If
            Wend

    End Select
Next oModel
End Sub

Private Sub ProcessCell(oCell As CellElement)

Dim oEE                                           As ElementEnumerator
Dim internalColor                                 As Long
Dim ArrElements()                                 As Element
Dim i                                             As Integer
Dim Black                                         As Long

Black = ActiveModelReference.InternalColorFromRGBColor(RGB(0, 0, 0))

Set oEE = oCell.GetSubElements

    ArrElements = oEE.BuildArrayFromContents

    For i = LBound(ArrElements) To UBound(ArrElements)
        If ArrElements(i).Type = msdElementTypeShape And ArrElements(i).Color = Black Then
        ShapeCount = ShapeCount + 1
        End If
    Next
    Debug.Print ShapeCount
End Sub

When the offending shapes are found in the loop, how do you remove them from the cell before calling rewrite?


[CONNECT DItem_ToggleIconRsc] Appearance Issues

$
0
0

In CONNECT, the ToggleIconRsc doesn't look "as good" as when used in MicroStation V8i. In V8i, when the ToggleIcon was depressed, you saw a slight "depression" and shadow line around the icon:


yet in CONNECT, I see this (blueish mask over whole image):


Also, in V8i, when raised, you saw this, with a slight raised edge:


however in CONNECT we get:


with no visible edges.

 

Is there any way to get a better representation between a raised and depressed ToggleIcon? Also, is there a way to change the blueish background applied when the ToggleIcon is depressed? It make the graphics harder to see.

 

Thanks,

Bruce

RE: [CONNECT C++] Delete Item Type instance from Element

$
0
0
Jon,

You have two options:

1. DgnECInstance::Delete() - deletes the ECInstance immediately.
2. DgnECInstance::ScheduleDelete(EditElementHandleR eeh) - schedules deletion of the ECInstance

The former is useful when you're not making other modifications to the element.

In the latter case, the ECInstance will be deleted from the element when eeh.ReplaceInModel() is invoked.
There is never a reason to schedule deletion of ECInstances prior to deleting the element itself, as that implicitly deletes all XAttributes (including ECInstances) attached to the element.

Regards,
Paul

[CONNECT C++] Delete Item Type instance from Element

$
0
0

I want to remove a DgnECInstance of my Item Type from an element.  DgnECInstance.ScheduleDelete (EditElementHandleR) looks like it does what I want.

However, a comment in MicroStationAPI says: The instance is removed when the element is written. I don't want to delete the element itself: is it sufficient to rewrite the element after calling DgnECInstance.ScheduleDelete?

RE: [CONNECT DItem_ToggleIconRsc] Appearance Issues

$
0
0

A colleague of mine has pointed me to the answer. The issue is related to the use of "Borderless Icons", as set in the Preferences. Once "un-checked", things look MUCH better. It never occurred to me to check the setting in Preferences. Thanks Bill Brown.

 

Bruce

RE: removing proxyelements from Microstation files

$
0
0

Hi Ido,

I guess it was answered by Jon and Bob already, so just a small comment:

[quote user="Ido Cohen"]the value of the parameter "MS_DWGSAVEAPPLICATIONDATA = 0[/quote]

Accordingly to documentation the valiad values for this variable is ON and OFF, not 0. But I did not test it if 0 is processed as OFF regardless it's not described in documentation.

With regards,

  Jan

Viewing all 7260 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>