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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create a sketch/plane trough a cylinder

Message 1 of 2
573 Views, 1 Reply

Create a sketch/plane trough a cylinder

I'm trying to create a plane trough a cylinder to crate a sketch on the plane.


My current method gets the cylinder axis and creates a plane at the axis using setByAngle.

But I have to set the planeEntity to be perpendicular to the axis. I fist used a the XY construction plane, but this doesn't work for every axis/cylinder orientation.


When using the UI and crating a plane at an Angle I don't have to set a plane where th angle is measured from.
Is there a way to get a valid planeEntity plane or any other method to create a plane through a cylinder?



       # Create cylinder axis
        axes = activeComp.constructionAxes
        axisInput = axes.createInput()
        axis = axes.add(axisInput)
        axis.isLightBulbOn = False

        # Create sketch plane at cylinder axis
        xyPlane = activeComp.xYConstructionPlane
        planes = activeComp.constructionPlanes
        planeInput = planes.createInput()
        angle = adsk.core.ValueInput.createByString('0 deg')
        planeInput.setByAngle(axis, angle, xyPlane)
        plane = planes.add(planeInput)
        plane.isLightBulbOn = False







Message 2 of 2
in reply to: jonasZUZ5J

May be you can use face of cylinder used to create axis and call geometry method,,  on it which will give you underlying plane and pass that as input to setByAngle method. 


faces = body.faces

face = faces[1]

plane  = face.geometry

Shyam Goyal
Sr. Software Dev. Manager

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