How to change sheet metal Rule for changing material.

How to change sheet metal Rule for changing material.

Anonymous
Not applicable
782 Views
1 Reply
Message 1 of 2

How to change sheet metal Rule for changing material.

Anonymous
Not applicable

Hi ...  I want to change the material of a sheet metal part using inventor api.I tried something like code

 

 Dim partDoc As PartDocument
            partDoc = inventorApp.Documents.Open(FilePath & filename, False)

            If partDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
                Dim smDef As SheetMetalComponentDefinition
                smDef = partDoc.ComponentDefinition

                Dim style As SheetMetalStyle

               
                style = smDef.SheetMetalStyles.Item("sheetMetalRule")

 But I can't get the code for material change.Please anyone help?

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

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

I believe you are stuck with Inventor 2014 because SheetMetalStyle.Material is a hidden property now. I think this is dure to the new material API introduced from 2014.  But I did not see a new way to change material. The hidden property can still work e.g.

 

Sub updateDoc()

  Dim partDoc As PartDocument
        Set partDoc = ThisApplication.ActiveDocument

            If partDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
                Dim smDef As SheetMetalComponentDefinition
                Set smDef = partDoc.ComponentDefinition

                Dim style As SheetMetalStyle
                Set style = smDef.SheetMetalStyles.Item("sheetMetalRule")
                 
                 style.Material = partDoc.Materials.Item(1)
            End If

    
End Sub

 

0 Likes