hi, everyone
I want to create a plane by setByTangentAtPoint.
I can do it not in design history,
but it's wrong result in design history.
who know how can create tangentAtPoint plane in design history.
This is my code which to create tangentAtPoint plane at face's centor point.
Thank you very much for your help.
_app = adsk.core.Application.get()
_ui = _app.userInterface
product = _app.activeProduct
_design = adsk.fusion.Design.cast(product)
_rootComp = _design.rootComponent
# get target body
targetbody = _rootComp.bRepBodies.item(_rootComp.bRepBodies.count - 1)
# get the target face
targetface = targetbody.faces[0]
# create plane by setByTangentAtPoint at center of the target face
planes = _rootComp.constructionPlanes
planeInput = planes.createInput()
planeInput.setByTangentAtPoint(targetface, targetface.centroid)
tangentplane = planes.add(planeInput)
Solved! Go to Solution.
Solved by kandennti. Go to Solution.
Hi @ho-kou -San.
It can be reproduced. It must be a bug.
In the meantime, if you are in a hurry, this may help.
・・・
# create plane by setByTangentAtPoint at center of the target face
planes: adsk.fusion.ConstructionPlanes = _rootComp.constructionPlanes
planeInput = planes.createInput()
if _design.designType == adsk.fusion.DesignTypes.DirectDesignType:
planeInput.setByTangentAtPoint(targetface, targetface.centroid)
tangentplane = planes.add(planeInput)
else:
sels: adsk.core.Selections = _ui.activeSelections
sels.clear()
sels.add(targetface)
sels.add(
_rootComp.constructionPoints.itemByName("center point")
)
_app.executeTextCommand(
u"Commands.Start WorkPlaneFromPointAndFaceCommand"
)
_app.executeTextCommand(u"NuCommands.CommitCmd")
・・・
Tnank you very much for your help. I create the plane use this code.
_app = adsk.core.Application.get()
_ui = _app.userInterface
product = _app.activeProduct
_design = adsk.fusion.Design.cast(product)
_rootComp = _design.rootComponent
# get target body
targetbody = _rootComp.bRepBodies.item(_rootComp.bRepBodies.count - 1)
# get the target face
targetface = targetbody.faces[0]
# create plane by setByTangentAtPoint at center of the target face
planes = _rootComp.constructionPlanes
planeInput = planes.createInput()
returnValue, facenormal = targetface.evaluator.getNormalAtPoint(targetface.pointOnFace)
root = _design.rootComponent
if _design.designType == adsk.fusion.DesignTypes.DirectDesignType:
planeInput.setByTangentAtPoint(targetface, targetface.centroid)
tangentplane = planes.add(planeInput)
else:
baseFeature = root.features.baseFeatures.add()
baseFeature.startEdit()
planeInput.setByTangentAtPoint(targetface, targetface.centroid)
tangentplane = planes.add(planeInput)
baseFeature.finishEdit()
Can't find what you're looking for? Ask the community or share your knowledge.