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

Sketch on a plane perpendicular to two co-planar faces (python)

3 REPLIES 3
Reply
Message 1 of 4
adonno
324 Views, 3 Replies

Sketch on a plane perpendicular to two co-planar faces (python)

I have two bodies that touch each other along a co-planar surface. Selecting 2 faces (one from each body) I need to

  1. Check that the faces have a common co-planar area that is a rectangle.
  2. Create a sketch that is perpendicular to the common co-planar area.

Said differently I need a python routine that will create a sketch in the blue area in the diagram after selecting the 2 faces that touch each other. I do not care about how tall the sketch is but it will ultimately extend through the second body.

Capture.JPG

 

I can select the two faces - called tongue and groove. I think what I need to do next is this to get a plane that is the intersection is the following ...

 

# Get construction planes
planes = _rootComp.constructionPlanes
# Create construction plane input
planeInput = planes.createInput()
planeInput.setByTwoPlanes(tongue, groove)
planes.add(planeInput)

 

However, I have faces not planes, and the code throws an exception because the arguments are wrong. I cannot find a way to convert from a face to a plane. Solving just that would get me further along.

 

Thanks

Tony

 

3 REPLIES 3
Message 2 of 4
BrianEkins
in reply to: adonno

The setByTwoPlanes method that you're using won't work in this case.  It's the same as the MidPlane command in Fusion 360,  If you try it in the UI, you'll see that it fails in this case with an error indicating that it doesn't work if the input planes are co-planar.  I'm not sure that Fusion 360 supports a construction plane creation method that will do what you want.  It's also not clear to me where the construction plane is to be created.  I see that it's is perpendicular to the selected faces, but I don't see where it's position is defined.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 4
adonno
in reply to: BrianEkins

I was worried that might be the case.

 

Ideally I would like to take the shared co-planar rectangle and simply create a sketch perpendicular to it through one of the long sides of the rectangle (plane at an angle would work I believe). Yes there is a opportunity for error (no co-planar surface on the selected faces, both sides of the shared plane at the same length) but there are things I can easily check for in code. It is creation of teh perpendicular plane or sketch that has me stuck

Message 4 of 4
BrianEkins
in reply to: adonno

If you don't care about the construction plane being parametric, I think it would be possible to calculate its position and create at the correct location using the API.  If the model changes the construction plane will stay in the same position in space because it won't be dependent on any geometry.

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

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