I have created a saddle which I control using excel for dimensions and several features that I control using a ilogic form. Depending on the load that saddle needs to support I need to adjust the number of ribs and their placement.
Where I run into problems is with welds. I have found no way to supress a weld along with a part and from what I've read this can not be done. So my question is, what is the best approach? I do not want to recreate or have to delete weld features every time I remove or add a rib.
The only thing I can think of is to create a new assembly for each configuration of the saddle but that seems a little counter productive.
Any suggestions would be welcome.
Solved! Go to Solution.
Solved by adam.nagy. Go to Solution.
HI,
Do you know how to achieve what you want through the UI?
If so, then could you list the steps you do in the UI and now you want to automate?
If you do not know how to do this in the UI, then it would be worth asking in the Product Forum as well.
Cheers,
Hi Adam
I can definetly do the work using the UI but the weld beads do not show up in the ilogic browser. If you look at the images below, I am trying to go from a single to a double rib configuration and I have that working easily with ilogic by supressing components but as I can not supress the welds using ilogic the weld bead will fail as soon as I change the configuration.
Thanks for the pictures, Arek.
It did not error out for me when I suppressed a part that had a welding - but still, I guess you would not want a welding hanging in the air.
This is the workaround I could come up with. I hope this helps.
http://adndevblog.typepad.com/manufacturing/2014/04/run-command-on-browser-item.html
Cheers,
Adam,
This looks exactly like the sort of automation I am looking for. Unfortunately the code is a little over my current skill set. Would you be able to look at the attached assembly and perhaps plug in one weld to suppress and un-suppress using your ilogic script? I am currently changing the number of rib using an ilogic form from 1 to 5 but if you were able to do a single one it would help me out immensely.
Hi Arek,
A few files are missing, which makes it more difficult to test things. Could you provide those?
00-SEED-000000.xlsx, 00-SEED-000057.ipt, 00-SEED-000058.ipt.
Also, you don't seem to have welding added for all the plates.
You could name the weld beads the same as the part they belong to, that should make the code a bit clearer.
Cheers,
My apologies I was trying to keep the file size down. I've added the welds for the single and double gusset configurations.
Hi Arek,
I've done it for Ribs 1 and 2 - you should be able to set it up for the rest:
Sub Main 'Select number of ribs If RIBS = "1" Then Component.IsActive("Gusset Plate 1") = True Component.IsActive("Gusset Plate 2") = False Component.IsActive("Gusset Plate 2 Mirror") = False Component.IsActive("Gusset Plate 3") = False Component.IsActive("Gusset Plate 3 Mirror") = False SuppressWeldBeads( _ New List(Of String)(New String(){"Gusset Plate 2-A", "Gusset Plate 2-B", "Gusset Plate 2-C"}), _ New List(Of String)(New String(){"Gusset Plate 1-A", "Gusset Plate 1-B", "Gusset Plate 1-C"})) RIBS_ADJUSTMENT = False Else If RIBS = "2" Then Component.IsActive("Gusset Plate 1") = False Component.IsActive("Gusset Plate 2") = True Component.IsActive("Gusset Plate 2 Mirror") = True Component.IsActive("Gusset Plate 3") = False Component.IsActive("Gusset Plate 3 Mirror") = False SuppressWeldBeads( _ New List(Of String)(New String(){"Gusset Plate 1-A", "Gusset Plate 1-B", "Gusset Plate 1-C"}), _ New List(Of String)(New String(){"Gusset Plate 2-A", "Gusset Plate 2-B", "Gusset Plate 2-C"})) RIBS_ADJUSTMENT = False Else If RIBS = "3" Then Component.IsActive("Gusset Plate 1") = True Component.IsActive("Gusset Plate 2") = True Component.IsActive("Gusset Plate 2 Mirror") = True Component.IsActive("Gusset Plate 3") = False Component.IsActive("Gusset Plate 3 Mirror") = False RIBS_ADJUSTMENT = False Else If RIBS = "4" Then Component.IsActive("Gusset Plate 1") = False Component.IsActive("Gusset Plate 2") = True Component.IsActive("Gusset Plate 2 Mirror") = True Component.IsActive("Gusset Plate 3") = True Component.IsActive("Gusset Plate 3 Mirror") = True RIBS_ADJUSTMENT = True Else If RIBS = "5" Then Component.IsActive("Gusset Plate 1") = True Component.IsActive("Gusset Plate 2") = True Component.IsActive("Gusset Plate 2 Mirror") = True Component.IsActive("Gusset Plate 3") = True Component.IsActive("Gusset Plate 3 Mirror") = True RIBS_ADJUSTMENT = True End If 'Sets rib thickness Parameter("Gusset Plate 1", "RIB_THK") = RIB_THK Parameter("Gusset Plate 2", "RIB_THK") = RIB_THK Parameter("Gusset Plate 3", "RIB_THK") = RIB_THK 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 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
Attached is the modified assembly.
Cheers,
Sorry for posting the same question once again. Since i did not received any reply on this question.
Iam posting the same question in this subject.
The following code works and suppress the weldbead when it is placed in module and run from module
BUT WHEN WE PLACE THE SAME CODE IN USERFORM AND RUN IT THE WELDBEAD GETS SELECTED BUT IT IS NOT GETTING SUPPRESSED I DON'T KNOW WHY
Please give some suggestion on this.
Enum SuppressOption
kSuppress
kUnsuppress
kToggle
End Enum
Private Sub SuppressWeldBeads_Click()
Call SuppressWeldBead("Fillet Weld 1")
End Sub
Sub SuppressBead(wcd As WeldmentComponentDefinition, wbn As BrowserNode, _
so As SuppressOption)
Dim name As String
name = wbn.BrowserNodeDefinition.Label
'We only need to check the current state of the bead if
'We are not just toggling its state but want a specific one
If so <> kToggle Then
'If the bead is already suppressed then its
'BeadFaces.Count will be 0
Dim bfs As Faces
Set bfs = wcd.Welds.WeldBeads(name).BeadFaces
If bfs.Count = 0 Xor so = kUnsuppress Then Exit Sub
End If
'Get the commandManager object
Dim cm As CommandManager
Set cm = ThisApplication.CommandManager
'Get the collection of control definitions
Dim cds As ControlDefinitions
Set cds = cm.ControlDefinitions
'Run the "Suppress" command
ThisApplication.SilentOperation = True
Call wbn.DoSelect
Dim oSuppControlDef As ControlDefinition
Set oSuppControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("AssemblySuppressFeatureCtxCmd")
oSuppControlDef.Execute2 (True)
'Call cds("AssemblySuppressFeatureCtxCmd").Execute
ThisApplication.SilentOperation = False
End Sub
Sub SuppressWeldBead(WeldName As String)
'MsgBox (WeldName)
'Dim WeldName As String
'WeldName = "Fillet Weld 1"
'Get Document
Dim doc As AssemblyDocument
Set doc = ThisApplication.ActiveDocument
Dim wcd As WeldmentComponentDefinition
Set wcd = doc.ComponentDefinition
'Get "Model" browser
Dim bp As BrowserPane
Set 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
For Each wbn In bbn.BrowserNodes
If wbn.BrowserNodeDefinition.Label = WeldName Then
Call SuppressBead(wcd, wbn, kSuppress)
End If
Next
End Sub
Thanks in Advance
M.L.Kuselan
I answered on the other thread:
First, many thanks for the code.
It is possible to suppress the welds in a sub assembly? Because i start severals configuration in the top level assembly.
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
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
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.ActiveEditDocument
' 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