Set Assembly Browser Nodes as "Default" before run rule

Set Assembly Browser Nodes as "Default" before run rule

CCarreiras
Mentor Mentor
544 Views
4 Replies
Message 1 of 5

Set Assembly Browser Nodes as "Default" before run rule

CCarreiras
Mentor
Mentor

Hi!

 

Im doing a rule to run in Assembly level, but before run the rule, i need to set the assembly browser nodes as  "Default"

To avoid doing it manually (and to avoid to forget to do it), id like to add this instruction to the rule to run before the "main" part of the rule.

Does Anyone know how to do it?

Thanks.

 

Basically, i want to set this definition (in the pic), before a start the main part of the rule.

 1.png

CCarreiras

EESignature

0 Likes
545 Views
4 Replies
Replies (4)
Message 2 of 5

clutsa
Collaborator
Collaborator

The commented out part will run that command but I don't know how to make it select default. The "For Each" should still do what you want.

'Dim Rename = ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyBonusTools_RenameBrowserNodesCmd")
'Rename.Execute

For Each occ In ThisApplication.ActiveDocument.ComponentDefinition.Occurrences
	occ.Name = ""
Next

 

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 3 of 5

CCarreiras
Mentor
Mentor

Hi!

 

Well, at the least the "forget" issue is solved 🙂

Thank you!

CCarreiras

EESignature

0 Likes
Message 4 of 5

clutsa
Collaborator
Collaborator

Did the "For Each" loop not work? Setting the name to blank should change it back to default (it does on my test anyway)

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 5 of 5

CCarreiras
Mentor
Mentor

Hi!

 

Yes, it works for the main assembly parts.

To work in the subassembly levels I used the code below and worked well:

SyntaxEditor Code Snippet

Sub Main()
    Dim oDoc As Document = ThisApplication.ActiveDocument
    oDoc.DisplayName = ""
    Dim oCD As ComponentDefinition = oDoc.ComponentDefinition
	NameReset(oCD.Occurrences)
End Sub

Sub NameReset(oOccs As ComponentOccurrences)
    For Each oOcc As ComponentOccurrence In oOccs
        Try
            oOcc.Name = ""
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Try
            NameReset(oOcc.SubOccurrences)
        Catch
        End Try
    Next
End Sub

 

 

CCarreiras

EESignature

0 Likes