Material in Sheet Metal Rule

Material in Sheet Metal Rule

w.pepping
Advocate Advocate
468 Views
1 Reply
Message 1 of 2

Material in Sheet Metal Rule

w.pepping
Advocate
Advocate

In a sheet metal part I read the material by this code: 

oSheetMetalCompDef = CType(oDoc, Inventor.PartDocument).ComponentDefinition
Dim strMaterial as String = oSheetMetalCompDef.Material.Name

In this part i get 'Generic', but in the iProperties it is 'S335J2G3'. See the attached image. How can I read this material and wich material (Generic or S225J2G3) is used for this part by Inventor?

 

Material.jpg

Get control of your sheet metal files.
Download the app from matprop.com
0 Likes
Accepted solutions (1)
469 Views
1 Reply
Reply (1)
Message 2 of 2

adam.nagy
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

As I was playing around with it when I changed the material in the rule then it did not get propagated to the Ribbon straight away.

Once I opened the Materials dialog it showed the correct value - so I'm quite sure that these values should be the same everywhere.

 

Also PartComponentDefinition.Material is now hidden so could use Document.ActiveMaterial instead:

Sub ShowMaterialName()
  Dim d As PartDocument
  Set d = ThisApplication.ActiveDocument
    
  Dim cd As SheetMetalComponentDefinition
  Set cd = d.ComponentDefinition
  ' Material is now a hidden property
  ' Could use Document.ActiveMaterial instead
  ' see below
  MsgBox cd.Material.Name
  
  MsgBox d.ActiveMaterial.DisplayName
End Sub

So I think the discrepancy is only with the Ribbon UI, but I assume the iProperties would also show the correct value - e.g. inside the iProperties dialog. At least it seeemd to be that way on my side.

 

Cheers,

 

 



Adam Nagy
Autodesk Platform Services
0 Likes