Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm working on a CustomFeature add-in. I prototyped it with UI-level construction tools (sketches, sweeps, etc.), but now I'm trying to push the actual geometry creation down to the TemporaryBRepManager level. The CustomFeature parts are actually working great - it's the TBRM that's confusing me.
If I understand correctly, B-rep wires are essentially edges that are not bound to faces and have no face-level geometry. They should render normally in the UI, much like sketch geometry, should they not?
Here's a test script that gives problems for me:
import adsk.core as core
import adsk.fusion as fusion
import traceback
def run(context):
try:
app = core.Application.get()
ui = app.userInterface
tbm = fusion.TemporaryBRepManager.get()
pt1 = core.Point3D.create(0, 1, 0)
pt2 = core.Point3D.create(0, 0, 0)
pt3 = core.Point3D.create(1, 0, 0)
nurb = core.NurbsCurve3D.createNonRational([pt1, pt2, pt3], 2, [0, 0, 0, 1, 1, 1], False)
wireBody, _ = tbm.createWireFromCurves([nurb])
comp = app.activeProduct.activeComponent
base = comp.features.baseFeatures.add()
base.startEdit()
comp.bRepBodies.add(wireBody, base)
base.finishEdit()
except Exception as e:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
It creates a very simple NurbsCurve3D, converts it to a wire body, and inserts the body into a BaseFeature.
It runs fine, but the curve seen in the UI is a straight line from all angles, no curvature at all. I can understand that there might be a mismatch between the TBRM coordinate system and the coordinate system of a specific component, but there's no perspective from which the wire looks like a curve.
The curve is a new-to-the-UI degree two NURBS, but in the actual plugin the degrees are 3 and 5 and show the same effect. Also, they worked fine when placed into a Sketch rather than a wire body.
Attached is an .f3d file that shows a blank document after running this script. I added a sketch on the XY plane and projected in the wire (which is also on the XY plane). Surprisingly, the wire projects correctly, showing the expected curvature:
I usually try to keep questions specific, but I think my query in this case is "Whaaa?"
Solved! Go to Solution.