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)