Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SheetMetal.SetActiveStyle in VBA - Not in iLogic

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
ladimirabdala
967 Views, 2 Replies

SheetMetal.SetActiveStyle in VBA - Not in iLogic

Hello,

 

I wanna make a code in VBA, Inventor 2011.

 

I'm tried set the Active Style in SheetMetal, but I received an error:

 

 

Private Sub CmdOk_Click()

    SheetMetal.SetActiveStyle ("X01.009.014")

End Sub

 

Compile error:

Variable not defined

 

Does anybody can help me?

Thanks in advance.

 

Ladimir Abdala

 

 

 

2 REPLIES 2
Message 2 of 3

Here is the answer:

 

    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.ActiveDocument

    Dim oSheetMetalCompDef As SheetMetalComponentDefinition
    Set oSheetMetalCompDef = oPartDoc.ComponentDefinition
   
    Dim oStyle As SheetMetalStyle

 

    'This is the main code line: 

    oSheetMetalCompDef.SheetMetalStyles.Item("Another_Sheet_Metal_Rule").Activate

 

NEXT STEP:

 

How change the Material Style in VBA????

 

Look at the box in the "Sheet Metal Defults" on the Sheet Metal Ribow.

 

 

 

Message 3 of 3

   Finally:

 

   Dim oMaterial As Material

 

    Set oMaterial = oPartDoc.Materials.Item("CFF ABNT 1008 - 1,50 mm")

    oPartDoc.ComponentDefinition.Material = oMaterial

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report