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

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

adonno
Enthusiast Enthusiast
735 Views
3 Replies
Message 1 of 4

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

adonno
Enthusiast
Enthusiast

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

 

0 Likes
736 Views
3 Replies
Replies (3)
Message 2 of 4

BrianEkins
Mentor
Mentor

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
0 Likes
Message 3 of 4

adonno
Enthusiast
Enthusiast

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

0 Likes
Message 4 of 4

BrianEkins
Mentor
Mentor

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
0 Likes