- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there.
I created a plane using the "ConstructionPlaneInput.setByDistanceOnPath" method and noticed that the planes created in parametric mode and direct mode are different.
I created a script like this to test it.
# Fusion360API Python script
import traceback
import adsk.fusion
import adsk.core
def run(context):
ui = adsk.core.UserInterface.cast(None)
try:
app: adsk.core.Application = adsk.core.Application.get()
ui = app.userInterface
msg: str = 'Select Edge'
selFilter: str = 'Edges'
sel: adsk.core.Selection = selectEnt(msg, selFilter)
if not sel:
return
edge: adsk.fusion.BRepEdge = sel.entity
comp: adsk.fusion.Component = edge.body.parentComponent
valueIpts = [
adsk.core.ValueInput.createByReal(0),
adsk.core.ValueInput.createByReal(0.5),
adsk.core.ValueInput.createByReal(1),
]
constPlanes: adsk.fusion.ConstructionPlanes = comp.constructionPlanes
for valueIpt in valueIpts:
planeIpt: adsk.fusion.ConstructionPlaneInput = constPlanes.createInput()
planeIpt.setByDistanceOnPath(edge, valueIpt)
constPlanes.add(planeIpt)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def selectEnt(
msg: str,
filterStr: str) -> adsk.core.Selection:
try:
app: adsk.core.Application = adsk.core.Application.get()
ui: adsk.core.UserInterface = app.userInterface
sel = ui.selectEntity(msg, filterStr)
return sel
except:
return None
Creates three planes with ratios of 0, 0.5, and 1 for the selected edge.
Prepare a body, which can be anything, run the script and select an edge.
If you select the red arrow in the left image, a plane is created in parametric mode, as shown in the middle image. This is the desired state, no problem.
In direct mode, however, the image on the right shows the situation.
The same is true for the parametric mode BaseFeature edit.
In direct mode, I think the "distance" argument is treated as a numerical value of a parameter on the curve.
However, when I try to set the value of a parameter to the "distance" argument, I sometimes get an error because of the limitation of 0 to 1.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-46dd5f0a-e384-4707-b431-37c0e596f328
In any case, there is no way to create the desired plane in direct mode.
Solved! Go to Solution.