Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Crash extruding to Construction Plane

chris.monachanZWSCF
Enthusiast

Crash extruding to Construction Plane

chris.monachanZWSCF
Enthusiast
Enthusiast

I have a consistent crash when trying to extrude a profile to a construction plane where the construction plane is given as a ToEntityExtentDefinition in setOneSideExtent in the ExtrudeFeatureInput. 

 

I don't have code to hand but if people can't reproduce I can put some together. Basically I've tried everyway and it always crashes. In the UI this operation works fine, but not through the API. 

 

As a work-a-round I now create a temp body, extrude to that face and then get rid of the body. This seems like an easy fix to me as it's a crash and should be fairly simple to see what's going on if you have the Fusion source in-front of you when it crashes.

BTW in my case, this is in parametric design mode and the target plane and the source sketch profile are at angles.

0 Likes
Reply
Accepted solutions (1)
471 Views
3 Replies
Replies (3)

kandennti
Mentor
Mentor

Hi @chris.monachanZWSCF .

 

I made a sample that looks like this.
It did indeed crash. (Fusion360 ver2.0.10564)

# Fusion360API Python script
import adsk.core, adsk.fusion, traceback

def run(context):
    ui = adsk.core.UserInterface.cast(None)
    try:
        app: adsk.fusion.Application = adsk.core.Application.get()
        app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)

        ui = app.userInterface
        des: adsk.fusion.Design = app.activeProduct
        root: adsk.fusion.Component = des.rootComponent

        # create Plane
        sktPlane: adsk.fusion.ConstructionPlane = initPlane(
            root,
            [1,2,3],
            [3,2,1],
            [2,3,1],
        )

        # create Plane
        targetPlane: adsk.fusion.ConstructionPlane = initPlane(
            root,
            [5,6,4],
            [7,6,5],
            [4,5,7],
        )

        # create Sketch
        skt: adsk.fusion.Sketch = initSketchCircle(sktPlane, [1,2,0], 1)

        # create ExtrudeFeature
        exts: adsk.fusion.ExtrudeFeatures = root.features.extrudeFeatures
        extIpt: adsk.fusion.ExtrudeFeatureInput = exts.createInput(
            skt.profiles[0],
            adsk.fusion.FeatureOperations.NewBodyFeatureOperation
        )

        TOENTITY = adsk.fusion.ToEntityExtentDefinition
        ent: adsk.fusion.ToEntityExtentDefinition = TOENTITY.create(targetPlane, True)
        extIpt.setOneSideExtent(ent, adsk.fusion.ExtentDirections.PositiveExtentDirection)

        exts.add(extIpt) # <- Crash

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


def initSketchCircle(
    plane: adsk.fusion.ConstructionPlane,
    center: list,
    radius: float) -> adsk.fusion.Sketch:

    comp: adsk.fusion.Component = plane.parent
    skt: adsk.fusion.Sketch = comp.sketches.add(plane)

    circles: adsk.fusion.SketchCircles = skt.sketchCurves.sketchCircles
    circles.addByCenterRadius(
        adsk.core.Point3D.create(center[0],center[1],center[2]),
        radius)
    
    return skt

def initPlane(
    comp: adsk.fusion.Component,
    ary1: list,
    ary2: list,
    ary3: list,
    ) -> adsk.fusion.ConstructionPlane:

    skt: adsk.fusion.Sketch = comp.sketches.add(comp.xYConstructionPlane)
    skt.isLightBulbOn = False

    pnts: adsk.fusion.SketchPoints = skt.sketchPoints
    PNT3D = adsk.core.Point3D
    [pnts.add(PNT3D.create(v[0],v[1],v[2])) for v in [ary1,ary2,ary3]]

    planes: adsk.fusion.ConstructionPlanes = comp.constructionPlanes
    planeIpt: adsk.fusion.ConstructionPlaneInput = planes.createInput()
    planeIpt.setByThreePoints(
        skt.sketchPoints[1],
        skt.sketchPoints[2],
        skt.sketchPoints[3]
    )

    return planes.add(planeIpt)
0 Likes

BrianEkins
Mentor
Mentor
Accepted solution

I can also reproduce the problem and a bug has been logged.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
1 Like

chris.monachanZWSCF
Enthusiast
Enthusiast
Hey, thanks for putting the time in to construct a repro. I work in C++ and on a complex Fusion Add-In project so it's often difficult for me to pull out individual bits of code.
1 Like