create a parametric curves offset from python API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there, first time poster here.
Is it possible to create parametric sketch curve offsets (e.g., dimensioned via a UserParameter) via the API?
I went through the UI and created a quick (closed) sketch: 3 lines and an arc. Then I made a parametric offset from this shape, with the dimension "foo". Changing the user parameter worked as it should. I removed any auto-generated constraints (Horiz, Vert, Perpendicular) and then poked around with the sketch in a debugger session:
-> root
<adsk.fusion.Component; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::Component > *' at 0x7fa8a02f7a80> >
<adsk.fusion.Component; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::Component > *' at 0x7fa8a02f7a80> >
-> sketch = root.sketches.item(0)
-> sketch
<adsk.fusion.Sketch; proxy of <Swig Object of type 'std::vector< adsk::core::Ptr< adsk::fusion::Sketch > >::value_type *' at 0x7fa8a02eb1b0> >
-> sketch
<adsk.fusion.Sketch; proxy of <Swig Object of type 'std::vector< adsk::core::Ptr< adsk::fusion::Sketch > >::value_type *' at 0x7fa8a02eb1b0> >
-> sketch.geometricConstraints.count
1
1
-> sketch.geometricConstraints.item(0)
<adsk.fusion.OffsetConstraint; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::OffsetConstraint > *' at 0x7fa880bc7d20> >
<adsk.fusion.OffsetConstraint; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::OffsetConstraint > *' at 0x7fa880bc7d20> >
-> offset_c = sketch.geometricConstraints.item(0)
-> offset_c.dimension
<adsk.fusion.SketchOffsetCurvesDimension; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::SketchOffsetCurvesDimension > *' at 0x7fa8a02c08d0> >
-> offset_c.dimension
<adsk.fusion.SketchOffsetCurvesDimension; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::SketchOffsetCurvesDimension > *' at 0x7fa8a02c08d0> >
-> offset_dim = offset_c.dimension
-> offset_dim.parameter
<adsk.fusion.ModelParameter; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::ModelParameter > *' at 0x7fa8a02c0990> >
-> offset_dim.parameter
<adsk.fusion.ModelParameter; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::ModelParameter > *' at 0x7fa8a02c0990> >
-> offset_dim.parameter.expression
'foo'
'foo'
So, my question is: how do I programmatically get a SketchOffsetCurvesDimension? The only APIs that I see take a float (Sketch.offset), or don't work on arcs/don't have the same behavior (SketchDimensions.addOffsetDimension). Is it possible to set this up?
Thanks much!
-tim