How do I set the Sheet Metal Rules Thickness to a UserParameter Variable.

How do I set the Sheet Metal Rules Thickness to a UserParameter Variable.

Anonymous
Not applicable
1,616 Views
3 Replies
Message 1 of 4

How do I set the Sheet Metal Rules Thickness to a UserParameter Variable.

Anonymous
Not applicable

We are using 2011.

 

I created a VBA tool that populates the FX Userparameters with a Thickness Variable

 

How do I set the Sheet Metal Rules Thickness to the new new FX UserParameter Thickness Variable?

 

for example:

The Userparamter variable name is "cab_thk"

 

Under Sheet Metal Defaults | Sheet Metal Rules | Sheet (Tab)

The Thickness entry should read "cab_thk"

 

Thanks,

0 Likes
1,617 Views
3 Replies
Replies (3)
Message 2 of 4

skyngu
Collaborator
Collaborator

not sure if this is what you want

 

sName = oDoc.ComponentDefinition.ActiveSheetMetalStyle.name

Autodesk Inventor Professional 2019
0 Likes
Message 3 of 4

xiaoyan.qi
Alumni
Alumni

i recommend you use iLogic, create a new rule and add the code as below

=============================

   Dim oPartDoc As PartDocument

   ' you need add Set before the next line in VBA
    oPartDoc = ThisApplication.ActiveDocument

   ' you need add Set before the next line in VBA

    Dim oSheetMetalCompDef As SheetMetalComponentDefinition
    oSheetMetalCompDef = oPartDoc.ComponentDefinition
   

' "oThick" is the user parameter name in user parameters 
    oSheetMetalCompDef.SheetMetalStyles.Item("Default").Thickness = oThick

=============================

iLogic can be change the value automatically when you parameter change,  and VBA need to run after you change value.

 

of course, you can convert the code above to VBA code easily, just change the oThick to the user parameter statement and make some adjustment.

 

Let me know if it works

 

Thanks

Mick

0 Likes
Message 4 of 4

Anonymous
Not applicable

Well it worked.

 

The API documentation was a little unclear on this topic.  There are too many objects with a Thickness property.

Some I guess are read only.  In my mind those should have been named GetThickness.

 

Thank you for the support.

 

 

0 Likes