Suppressing sub-assembly welds from top-assembly ilogic

Suppressing sub-assembly welds from top-assembly ilogic

Anonymous
Not applicable
406 Views
0 Replies
Message 1 of 1

Suppressing sub-assembly welds from top-assembly ilogic

Anonymous
Not applicable

It is possible to suppress the welds in a sub assembly? Because i run severals configuration in the top level assembly.

My configuration tool need to suppress or unsuppress following welds in the sub-assembly. 

 

Following code i found already.

 

Sub Main
If Drum_Tube_Divided= True Then
Component.Visible("Drum tube") = False
Component.Visible("Drum tube L1") = True
Component.Visible("Drum tube L2") = True

iLogicVb.RunRule("Update_BOM")

SuppressWeldBeads( _
  New List(Of String)(New String(){"Groove Weld undivided", "Fillet Weld undivided"}), _
  New List(Of String)(New String(){"Groove Weld divided L1", "Groove Weld divided L2", "Fillet Weld divided"}))

Else If Drum_Tube_Divided= False Then
Component.Visible("Drum tube") = True
Component.Visible("Drum tube L1") = False
Component.Visible("Drum tube L2") = False

iLogicVb.RunRule("Update_BOM")

SuppressWeldBeads( _
  New List(Of String)(New String(){"Groove Weld divided L1", "Groove Weld divided L2", "Fillet Weld divided"}), _
  New List(Of String)(New String(){"Groove Weld undivided", "Fillet Weld undivided"}))
End If
End Sub

Sub SuppressBead( _
  wcd As WeldmentComponentDefinition, _
  wbn As BrowserNode, _
  unsuppress As Boolean)
  Dim name As String
  name = wbn.BrowserNodeDefinition.Label

  ' If the bead is already suppressed then its BeadFaces will be 0
  If (wcd.Welds.WeldBeads(name).BeadFaces.count = 0) <> unsuppress Then Exit Sub
  
  ' Get the CommandManager object
  Dim cm As CommandManager
  cm = ThisApplication.CommandManager
'  
  ' Get the collection of control definitions
  Dim cds As ControlDefinitions
  cds = cm.ControlDefinitions
      
  ' Run the "Suppress" command
  ThisApplication.SilentOperation = True
  Call wbn.DoSelect
  'MsgBox(name)
  Call cds("AssemblySuppressFeatureCtxCmd").Execute2(True)
  ThisApplication.SilentOperation = False
End Sub

' weldNamesS - to suppress
' weldNamesU - to unsuppress
Sub SuppressWeldBeads(weldNamesS As List(Of String), weldNamesU As List(Of String))
  ' Get document
  Dim doc As AssemblyDocument
   doc = ThisApplication.ActiveDocument
'  doc = ThisApplication.ActiveDocument
  
  Dim wcd As WeldmentComponentDefinition
  wcd = doc.ComponentDefinition
  
  ' Get "Model" browser
  Dim bp As BrowserPane
  bp = doc.BrowserPanes("AmBrowserArrangement")
  
  ' Get "Welds" node
  Dim wbn As BrowserNode
  For Each wbn In bp.TopNode.BrowserNodes
    If wbn.BrowserNodeDefinition.Label = "Welds" Then
      Exit For
    End If
  Next
  
  ' Get "Beads" node
  Dim bbn As BrowserNode
  For Each bbn In wbn.BrowserNodes
    If bbn.BrowserNodeDefinition.Label = "Beads" Then
      Exit For
    End If
  Next
  
  ' Get the Beads we want to suppress/unsuppress
  For Each wbn In bbn.BrowserNodes
    If weldNamesS.Contains(wbn.BrowserNodeDefinition.Label) Then
      Call SuppressBead(wcd, wbn, False)
	ElseIf weldNamesU.Contains(wbn.BrowserNodeDefinition.Label) Then
      Call SuppressBead(wcd, wbn, True)
    End If
  Next
End Sub
0 Likes
407 Views
0 Replies
Replies (0)