Control Sheet Metal Styles from linked parameter

Control Sheet Metal Styles from linked parameter

Nigel.Sims
Advocate Advocate
254 Views
1 Reply
Message 1 of 2

Control Sheet Metal Styles from linked parameter

Nigel.Sims
Advocate
Advocate

Hello everyone, 

 

I am trying be efficient and make use of iLogic to control Sheet Metal Styles in the model for multiple parts. I have a skeleton file with multi value parameters inside. I want this to control the sheet metal style in multiple parts linked to this skeleton file.  I have this code so far but no joy when the skeleton file is modified. I have checked the naming of parameters and sheet metail styles and this is correct. At the moment there are approximately 20 unique parts that would be setup to be controlled in this fashion. My intension was to setup a form that can be controlled from the assembly to alter multiple parameters for the model. If there is a better wahy to achieve this I am open to suggestions.

 

If BottomThk = "6 mm" Then
SheetMetal.SetActiveStyle("MS S275_6")

ElseIf BottomThk = "8 mm" Then
SheetMetal.SetActiveStyle("MS S275_8")	

ElseIf BottomThk = "10 mm" Then
SheetMetal.SetActiveStyle("MS S275_10")

ElseIf BottomThk = "12 mm" Then
SheetMetal.SetActiveStyle("MS S275_12")

End If

iLogicVb.UpdateWhenDone = True

Thanks in advance, Nigel

0 Likes
255 Views
1 Reply
Reply (1)
Message 2 of 2

A.Acheson
Mentor
Mentor

So the ilogic snippet will only ever effect the file it is run in. If you need to effect files higher up you will need to find something that ties your driver to the driven. If its the case that the skelton is a reference file then that would be perfect. This is the harder piece and will need your response before posting a sample of that. 

The easier is to to use API methods to access the active sheet metal style. This is done from the component definition of the document. 

Syntax

SheetMetalComponentDefinition.ActiveSheetMetalStyle() As SheetMetalStyle

 

Reference article for accessing assembly components.

 

    ' Get the active assembly.
    Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
    ' Get all of the referenced documents.
    Dim oRefDocs As DocumentsEnumerator = oAsmDoc.AllReferencedDocuments

    ' Iterate through the list of documents.
    Dim oRefDoc As Document
    For Each oRefDoc In oRefDocs

      Logger.Info(oRefDoc.DisplayName)
      
      Dim oRefDef As ComponentDefinition = oRefDoc.ComponentDefinition
      
      If oRefDef.Type = ObjectTypeEnum.kSheetMetalComponentDefinitionObject Then
         oRefDef.ActiveSheetMetalStyle = "Enter Style Name Here"
       End If
    Next

 

 

 

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes