Python Script - Get Sheet Metal Thickness

Python Script - Get Sheet Metal Thickness

isocam
Collaborator Collaborator
420 Views
1 Reply
Message 1 of 2

Python Script - Get Sheet Metal Thickness

isocam
Collaborator
Collaborator

Can anybody help?

 

I have seen a lot of posts regarding the lack of support for sheet metal API.

 

Is it now supported?

 

I need to be able to get the sheet metal thickness, using a Python script and display the thickness, for testing purposes, in a messagebox.

 

Many thanks in advance!

 

Darren

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

john.kirchner
Autodesk
Autodesk

There are some basic Sheet Metal and Flat Pattern features now available through the API, added last year.

Thickness can be grabbed from the SheetMetalRule object. Thickness returns a SheetMetalRuleValue which you would use .expression or .value depending on what you want to display.

The quickest way to grab a SheetMetalRule is through Component.activeSheetMetalRule

So for an easy example of a file using sheet metal in the root component:

 

 

app = adsk.core.Application.get()
des = app.activeProduct
root = des.rootComponent
smr = root.activeSheetMetalRule
smr.thickness.expression # e.g. "2.50 mm"

 

 

 
And you can use that expression in a message box.