<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>kevindragonduong's Activities</title><link>https://communities.bentley.com/members/272a483f_2d00_389a_2d00_415f_2d00_a2cb_2d00_a128d988c907</link><description>kevindragonduong's recent activity</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Microstation VBA Batch Cell Replacement</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/103086/microstation-vba-batch-cell-replacement</link><pubDate>Mon, 08 Dec 2014 14:55:15 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:741b07e9-ae89-4049-9dbf-0889734adc94</guid><dc:creator>kevindragonduong</dc:creator><description>&lt;p&gt;I have created a program which will go through all my DGN drawings that are in many sub folders in a Master Folder. ( Example: &amp;nbsp; C:/MasterFolder/Subfolder/1234.DGN)&lt;/p&gt;
&lt;p&gt;My program goes through each element looking for specific cell name and when it does find it, it will retrieve the origin X &amp;amp; Y points. Using the Record macro and changing a bit of the code, it will replace the cell with the new cell at the same location retrieved earlier.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now i am updating about 12,000+ DGN files, and for every file, every cell it finds, it opens up the cell library window so it can do a &amp;quot;placement&amp;quot;. I can only get to about 36 jobs before either the macro or microstation enters the &amp;quot;Not Responding&amp;quot; phase, and gets stuck in that phase and does not continue on until i force quit the program. I suspect the cell library window being opened too frequent and too fast so microstation can not keep up and freezes/crashes. Is there a way i can do this same technique/method without it freezing? could i use something called keyins? &lt;strong&gt;&lt;em&gt;The best would be if someone knows another way of doing a &amp;quot;Placement&amp;quot; on a cell without opening the cell library window, that might fix the problem.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;i have a form with a button and two labels, i click the button, a window pops up asking me to select the &amp;quot;Master Folder&amp;quot;, click ok. then the program starts running. there are 10 cells i wanna replace, for each cell it will go through all DGN files in the sub folders. so let&amp;#39;s say 10 cells X 12,000 &amp;nbsp;.... so 120,000 files. This is how my program works.&lt;/p&gt;
&lt;p&gt;i have a userform1 (excel), and a class module Macro1ModalHandler.&lt;/p&gt;
&lt;p&gt;I have posted my code below:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Userform1:&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre class="brush: applescript; fontsize: 100; first-line: 1; "&gt;Option Explicit

Dim counter As Integer
Dim xcoord, ycoord As Integer
Dim CellName As Variant
Dim i As Double

Private Sub CommandButton1_Click()
On Error Resume Next:
     &amp;#39;this chunk of code opens up a new window for users to select the folder which the files are in
    Dim myFSO As New Scripting.FileSystemObject
    Dim myFolder As Scripting.Folder
    Dim myFile As Scripting.File
    Dim myFoldering As Scripting.Folder
    
    Dim myShell As New Shell32.Shell
    Dim myRootFolder As Shell32.Folder3
    Set myRootFolder = myShell.BrowseForFolder(0, &amp;quot;Pick&amp;quot;, 0)
    If myRootFolder Is Nothing Then Exit Sub
    
    Set myFolder = myFSO.GetFolder(myRootFolder.Self.Path)
    

    Dim FSOS As New FileSystemObject
    Dim myFolderS As Folder
    Dim mySubFolderS As Folder

    Set myFolderS = myFSO.GetFolder(myRootFolder.Self.Path)
    For Each mySubFolderS In myFolderS.SubFolders
        For Each myFile In mySubFolderS.Files
            Select Case UCase(Right(myFile.Name, 3))
                Case &amp;quot;DGN&amp;quot;
                    OpenDesignFile myFile.Path, False, msdV7ActionWorkmode
                    Label1.Caption = myFile.Path
                    
                    For i = 1 To 10 Step 1
                        If i = 1 Then CellName = &amp;quot;16041&amp;quot;
                        If i = 2 Then CellName = &amp;quot;1604&amp;quot;
                        If i = 3 Then CellName = &amp;quot;16042&amp;quot;
                        If i = 4 Then CellName = &amp;quot;160422&amp;quot;
                        If i = 5 Then CellName = &amp;quot;160423&amp;quot;
                        If i = 6 Then CellName = &amp;quot;B50031&amp;quot;
                        If i = 7 Then CellName = &amp;quot;B50032&amp;quot;
                        If i = 8 Then CellName = &amp;quot;B50033&amp;quot;
                        If i = 9 Then CellName = &amp;quot;B4003C&amp;quot;
                        If i = 10 Then CellName = &amp;quot;B4003O&amp;quot;
                        Call getting
                    Next i
                    
                    CadInputQueue.SendCommand &amp;quot;FILEDESIGN&amp;quot;
            End Select
        Next
        
    Next
     
    MsgBox &amp;quot;finished&amp;quot;

End Sub

Sub getting()
Dim oCriteria As New ElementScanCriteria
Dim oCriteriaText As New ElementScanCriteria
Dim ee As ElementEnumerator &amp;#39;ElementEnumerator is how it is able to search through the entire model for a specific element
Dim et As ElementEnumerator
Dim tc As CellElement
Dim myTextNode As TextNodeElement
Dim myTextNode1 As TextNodeElement
Dim myTextNode2 As TextNodeElement
Dim myTextNode3 As TextNodeElement
Dim tf As Element
Dim target As TextElement
Dim IDholder As DLong

    oCriteria.ExcludeAllTypes
    oCriteria.IncludeType msdElementTypeCellHeader
    oCriteria.IncludeType msdElementTypeSharedCell
    
    &amp;#39;searches for references that fits the criteria ( type header, and shared cell) and sets it as ee
    Set ee = ActiveModelReference.Scan(oCriteria)
    
    Do While ee.MoveNext
        If ee.Current.AsCellElement.Name = CStr(CellName) Then  &amp;#39;&amp;lt;------name this something different for different changes
            oCriteria.ExcludeAllTypes
            oCriteria.IncludeType msdElementTypeCellHeader
            oCriteria.IncludeType msdElementTypeSharedCell
            oCriteria.IncludeOnlyCell CStr(CellName) &amp;#39;&amp;lt;------name this something different for different changes
        End If
    Loop
    
   
    Set ee = ActiveModelReference.Scan(oCriteria)
&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;

&amp;#39;DO NOT CHANGE SCALING FACTORS/NUMBER UNLESS NECESSARY
    Do While ee.MoveNext
        Set tc = ee.Current
        tc.ResetElementEnumeration
        
        xcoord = tc.Origin.X
        ycoord = tc.Origin.Y
        
        Call stuff
    Loop
    
    
End Sub

Sub stuff()
    Dim startPoint As Point3d
    Dim point As Point3d, point2 As Point3d
    Dim lngTemp As Long

&amp;#39;   Start a command
    CadInputQueue.SendCommand &amp;quot;DIALOG CELLMAINTENANCE TOGGLE&amp;quot;

    Dim modalHandler As New Macro1ModalHandler
    AddModalDialogEventsHandler modalHandler

&amp;#39;   The following statement opens modal dialog &amp;quot;Attach Cell Library&amp;quot;

    CadInputQueue.SendCommand &amp;quot;ATTACH LIBRARY&amp;quot;

&amp;#39;   Set a variable associated with a dialog box
    SetCExpressionValue &amp;quot;tcb-&amp;gt;activeCell&amp;quot;, CStr(CellName), &amp;quot;&amp;quot;

    CadInputQueue.SendCommand &amp;quot;REPLACE CELLS EXTENDED&amp;quot;

&amp;#39;   Coordinates are in master units
    startPoint.X = xcoord
    startPoint.Y = ycoord
    startPoint.Z = 0#

&amp;#39;   Send a data point to the current command
    point.X = startPoint.X
    point.Y = startPoint.Y
    point.Z = startPoint.Z
    CadInputQueue.SendDataPoint point, 1

    point.X = startPoint.X
    point.Y = startPoint.Y
    point.Z = startPoint.Z
    CadInputQueue.SendDataPoint point, 1

    RemoveModalDialogEventsHandler modalHandler
    CommandState.StartDefaultCommand
End Sub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Class Module&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="brush: applescript; fontsize: 100; first-line: 1; "&gt;Implements IModalDialogEvents
Private Sub IModalDialogEvents_OnDialogClosed(ByVal DialogBoxName As String, ByVal DialogResult As MsdDialogBoxResult)

End Sub

Private Sub IModalDialogEvents_OnDialogOpened(ByVal DialogBoxName As String, DialogResult As MsdDialogBoxResult)

    If DialogBoxName = &amp;quot;Attach Cell Library&amp;quot; Then

        CadInputQueue.SendCommand &amp;quot;MDL COMMAND MGDSHOOK,fileList_setDirectoryCmd J:\Microstation\WSMOD\Medesign\V8_Cells\MECELIB\&amp;quot;

        CadInputQueue.SendCommand &amp;quot;MDL COMMAND MGDSHOOK,fileList_setFileNameCmd parts.cel&amp;quot;

    &amp;#39;   Remove the following line to let the user close the dialog box.
        DialogResult = msdDialogBoxResultOK

    End If  &amp;#39; Attach Cell Library

End Sub
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>VBA Microstation Folder Search</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/102844/vba-microstation-folder-search</link><pubDate>Fri, 28 Nov 2014 16:16:48 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:2ed49363-98cc-4f52-a1e4-ac4aeb0e5f67</guid><dc:creator>kevindragonduong</dc:creator><description>&lt;p&gt;i currently have this code in one of the macros for work. It is located under a button for browsing which folder to look into, and it will get the .DGNs and add them to a listbox.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t quite understand the code fully and was hoping someone can give me a quick run down. Also, the code only looks at the selected folder for .DGNs, i want it to look into sub folders as well, is that possible?&lt;/p&gt;
&lt;pre class="lang-vb prettyprint prettyprinted"&gt;&lt;code&gt;Dim myFSO As New Scripting.FileSystemObject
    Dim myFolder As Scripting.Folder
    Dim myFile As Scripting.File
    Dim myShell As New Shell32.Shell
    Dim myRootFolder As Shell32.Folder3
    Set myRootFolder = myShell.BrowseForFolder(0, &amp;quot;Pick&amp;quot;, 0)
    If myRootFolder Is Nothing Then Exit Sub

    Set myFolder = myFSO.GetFolder(myRootFolder.Self.path)
    txtCurrentFolder.Text = myRootFolder.Self.path
    lstFilesInFolder.Clear
    For Each myFile In myFolder.Files
        Select Case UCase(Right(myFile.Name, 3))
            Case &amp;quot;DGN&amp;quot;
                If IsFileIn(myFile.path, lstFilesToProcess) = False Then
                    lstFilesInFolder.AddItem myFile.path
                End If
        End Select
    Next&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Microstation Form Export</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/100756/microstation-form-export</link><pubDate>Mon, 08 Sep 2014 18:46:36 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:b0217628-09e3-494e-a4b5-65e63d548fd2</guid><dc:creator>kevindragonduong</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have created a microstation macro that can search for all &amp;quot;.DGN&amp;quot; files in a specific folder that the user chooses. below is the code i have written to do so:&lt;/p&gt;
&lt;p&gt;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;Private Sub btnBrowse_Click()&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Dim myFSO As New Scripting.FileSystemObject &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Dim myFolder As Scripting.Folder &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Dim myFile As Scripting.File &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Dim myShell As New Shell32.Shell &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Dim myRootFolder As Shell32.Folder3 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Set myRootFolder = myShell.BrowseForFolder(0, &amp;quot;Pick&amp;quot;, 0) &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; If myRootFolder Is Nothing Then Exit Sub &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Set myFolder = myFSO.GetFolder(myRootFolder.Self.Path) &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; txtCurrentFolder.Text = myRootFolder.Self.Path &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; lstFilesInFolder.Clear &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; For Each myFile In myFolder.Files &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Select Case UCase(Right(myFile.Name, 3)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Case &amp;quot;DGN&amp;quot; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; If IsFileIn(myFile.Path, lstFilesToProcess) = False Then &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;lstFilesInFolder.AddItem myFile.Path &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;End If &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;End Select &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Next End Sub&lt;/p&gt;
&lt;p&gt;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have exported&amp;nbsp;the form from this microstation macro and have imported it into an excel macro, right now i have the microstation form show when i click a button on the excel spreadsheet. When i click the browse button so i can choose the folder i want to look into (btnBrowse), i get an error message saying &lt;br /&gt;&lt;br /&gt;&amp;quot;Compile error: User-defined type not defined&amp;quot;&lt;/p&gt;
&lt;p&gt;and when i click ok, it shows me that the line &amp;quot;Dim myShell As New Shell32.Shell&amp;quot;&amp;nbsp;&amp;nbsp; is wrong or has an error (highlighted yellow). I do not know why it is giving me that error, need help on this please.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>ActiveModelReference.GetElementByID(DLongAdd(IDholder, DLongFromLong(1)))</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/94990/activemodelreference-getelementbyid-dlongadd-idholder-dlongfromlong-1</link><pubDate>Wed, 26 Feb 2014 15:14:55 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:38b2f6d2-ed53-498a-abf4-40cd6294e106</guid><dc:creator>kevindragonduong</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am new to VBA Microstation and i have tried researching what this means but i still don&amp;#39;t understand it fully, can someone please explain to a BEGINNER what this line means? i really need to understand this line of code to finish a macro for work.&lt;/p&gt;
&lt;p&gt;Set target = ActiveModelReference.GetElementByID(DLongAdd(IDholder, DLongFromLong(1)))&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank You&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>VBA MICROSTATION INSERT NEW LINE IN TEXT</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/94987/vba-microstation-insert-new-line-in-text</link><pubDate>Wed, 26 Feb 2014 12:56:50 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:ed94bb6a-f9b2-403a-b661-52bda6c969a3</guid><dc:creator>kevindragonduong</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am writing a macro for Microstation and i am trying to have multiple lines in a &amp;quot;textbox&amp;quot; or &amp;quot;text element&amp;quot;, i have tried researching on how to go about doing this but i have had no luck finding anything. I have tried &amp;quot;\010&amp;quot; and Chr(13) but neither of them worked. Can some one help me please&lt;/p&gt;
&lt;p&gt;Thank You&lt;/p&gt;
&lt;p&gt;Kevin D&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>MicroStation V8 Level Manager</title><link>https://communities.bentley.com/products/microstation/f/microstation-forum/94076/microstation-v8-level-manager</link><pubDate>Tue, 21 Jan 2014 19:13:42 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:80dfd1c0-0760-409c-9650-0d5d0588820a</guid><dc:creator>kevindragonduong</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am currently a student and am&amp;nbsp;new to MicroStation. I was just wondering about the &amp;quot;Logical&amp;quot; column under the Level Manager task/form, what is &amp;quot;Logical&amp;quot;? What is the difference between &amp;quot;MASTER&amp;quot; and nothing beside each level? is there a way i can change &amp;quot;MASTER&amp;quot; to nothing and vice versa?&lt;/p&gt;
&lt;p&gt;Thank You&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>