Sheet metal rules and features use the same Design and Component objects as sketches and solid features. You reach sheet metal features the same way you reach any other feature: through Component.features.
Each sheet metal feature type has its own collection on Component.features. The table lists the collections covered in this introduction and links to reference topics.
| Collection property | Feature types |
|---|---|
| flangeFeatures | Base, contour, and edge flanges |
| loftedFlangeFeatures | Lofted flanges |
| hemFeatures | Hems |
| ripFeatures | Rips |
| cornerClosureFeatures | Corner closures |
| joinByBendFeatures | Join by bend |
| unfoldFeatures | Unfold (temporary flat) |
| refoldFeatures | Refold |
| foldFeatures | Fold (explicit bend lines) |
| sheetMetalFilletFeatures | Sheet metal fillets |
| sheetMetalChamferFeatures | Sheet metal chamfers |
The following example gets collections from the root component:
import adsk.core, adsk.fusion app = adsk.core.Application.get() design = adsk.fusion.Design.cast(app.activeProduct) rootComp = design.rootComponent # Feature collections for sheet metal live on Component.features, alongside # extrudes, fillets, and every other feature type. hemFeatures = rootComp.features.hemFeatures ripFeatures = rootComp.features.ripFeatures # Same pattern for other collections, for example flanges: flangeFeatures = rootComp.features.flangeFeatures
A sheet metal body has a sheet metal rule applied. Use BRepBody.isSheetMetal to test a body.
Rules are SheetMetalRule objects in either:
design.designSheetMetalRules – rules stored in the document.
design.librarySheetMetalRules – rules from libraries.
Details are in Sheet Metal Rules and Conversion.
Each sheet metal component can have one flat pattern. Read it from Component.flatPattern, which returns None if the component does not have a flat pattern yet:
flatPattern = rootComp.flatPattern
if flatPattern is None:
# No flat pattern yet. See Flat Patterns for Component.createFlatPattern.
raise RuntimeError('No flat pattern in this component')
Each flat pattern also has its own FlatPatternProduct in the document. You only need it to sketch on the flat pattern.
Tip: Create the flat pattern with Component.createFlatPattern first, then read geometry from the FlatPattern and sketch on it through FlatPatternComponent. See Flat Patterns.
Sheet metal features follow the usual Fusion pattern:
Get the collection from Component.features.
Create an input object (createInput or a type-specific create…Input method).
Set properties on the input (the same options as in the command dialog).
Call add(input).
Edge, face, profile, sketch, and body variables in the examples (edge1, hemEdge, profile, sketch, body, and so on) are assumed to come from your own selection or query code, such as UserInterface.selectEntity or traversing a body's edges and faces. When an input accepts multiple edges or profiles, pass a plain Python list, not an ObjectCollection.