Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TemporaryBRepManager.createSilhouetteCurves doesn't work for planar faces?

1 REPLY 1
Reply
Message 1 of 2
JesusFreke
210 Views, 1 Reply

TemporaryBRepManager.createSilhouetteCurves doesn't work for planar faces?

I can't get createSilhouetteCurves to return anything other than an empty body for planar faces. The other types of surface geometry I've tried seem to work, except for planar faces. It also doesn't work if I convert the planar surface to a nurbs surface with BRepBody.convert. Although other converted surface geometries do seem to work.

 

e.g.

 

from adsk.core import OrientedBoundingBox3D, Point3D, Vector3D
import adsk.core
import adsk.fusion

def run(context):
    brep = adsk.fusion.TemporaryBRepManager.get()
    box = brep.createBox(OrientedBoundingBox3D.create(
        Point3D.create(1, 1, 1),
        Vector3D.create(1, 0, 0),
        Vector3D.create(0, 1, 0), 1, 1, 1))

    silhouette = brep.createSilhouetteCurves(box.faces[0], box.faces[0].geometry.normal, True)
    print("box face: %d" % silhouette.wires.count)

    wire_body, _ = brep.createWireFromCurves((
        adsk.core.Line3D.create(
            adsk.core.Point3D.create(0, 0, 0),
            adsk.core.Point3D.create(1, 0, 0)
        ),
        adsk.core.Line3D.create(
            adsk.core.Point3D.create(1, 0, 0),
            adsk.core.Point3D.create(1, 1, 0)
        ),
        adsk.core.Line3D.create(
            adsk.core.Point3D.create(1, 1, 0),
            adsk.core.Point3D.create(0, 1, 0)
        ),
        adsk.core.Line3D.create(
            adsk.core.Point3D.create(0, 1, 0),
            adsk.core.Point3D.create(0, 0, 0)
        )), False)
    face_body = brep.createFaceFromPlanarWires([wire_body])

    silhouette = brep.createSilhouetteCurves(face_body.faces[0], Vector3D.create(0, 0, 1), True)
    print("plain planar face: %d" % silhouette.wires.count)

    nurbs_face_body = face_body.convert(adsk.fusion.BRepConvertOptions.ProceduralToNURBSConversion)
    silhouette = brep.createSilhouetteCurves(nurbs_face_body.faces[0], Vector3D.create(0, 0, 1), True)
    print("converted plain planar face: %d" % silhouette.wires.count)

    sphere = brep.createSphere(Point3D.create(0, 0, 0), 2)
    silhouette = brep.createSilhouetteCurves(sphere.faces[0], Vector3D.create(1, 0, 0), False)
    print("sphere face: %d" % silhouette.wires.count)

    nurbs_sphere = sphere.convert(adsk.fusion.BRepConvertOptions.AnalyticsToNURBSConversion)
    silhouette = brep.createSilhouetteCurves(nurbs_sphere.faces[0], Vector3D.create(1, 0, 0), False)
    print("converted sphere face: %d" % silhouette.wires.count)

    cylinder = brep.createCylinderOrCone(Point3D.create(0, 0, 0), 1, Point3D.create(0, 0, 1), 1)
    silhouette = brep.createSilhouetteCurves(cylinder.faces[0], Vector3D.create(1, 1, 1), False)
    print("cylinder face (%s): %d" % (cylinder.faces[0].geometry.__class__.__name__, silhouette.wires.count))

    silhouette = brep.createSilhouetteCurves(cylinder.faces[1], Vector3D.create(1, 1, 1), False)
    print("cylinder face (%s): %d" % (cylinder.faces[1].geometry.__class__.__name__, silhouette.wires.count))

    silhouette = brep.createSilhouetteCurves(cylinder.faces[2], Vector3D.create(1, 1, 1), False)
    print("cylinder face (%s): %d" % (cylinder.faces[2].geometry.__class__.__name__, silhouette.wires.count))

And the output is:

box face: 0
plain planar face: 0
converted plain planar face: 0
sphere face: 1
converted sphere face: 1
cylinder face (Cylinder): 2
cylinder face (Plane): 0
cylinder face (Plane): 0

 

1 REPLY 1
Message 2 of 2
JesusFreke
in reply to: JesusFreke

After playing with this a bit more, I think the problem is that it doesn't create a silhouette of the edges of the face, even if you specify returnCoincidentSilhouettes=True. For example, if you create a silhouette of a vertical cylinder from the side, you only get 2 vertical lines from the side of the cylinder, but not the 2 horizontal lines from the top/bottom edges.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report