AnsweredAssumed Answered

get the face on a plane

Question asked by Kennedy Kirkhope on Nov 19, 2019
Latest reply on Nov 20, 2019 by Kennedy Kirkhope

I have a body in Solidworks and have a plane defined where I cut the body at the plane. This leaves an exposed face. There are several things I want to do with this face such as compute the section properties and write the results to a text file, I also want to save the face as a step file.


In order to achieve this, I started by recording a macro of me performing the functions manually. However, some of the functions the macro recorded won't work consistently.


I was looking through the API object model and cannot find a method for programmatically selecting the face on the currently selected plane.



Define a plane at a distance of x.not (named CutPlane)

Define a sketch 

Draw a rectangle larger than the part

extrude the reactangle leaving only a partial body


Then, for example, my VBA code does the following:

   calculate a starting x position of the plane

   select CutPlane

   change position of CutPlane

   Update model


   'Here is the problem

   select face on selected plane "CutPlane"

   calculate section properties from face

   write to text file

   save face as step file


   update x position

   update step file name



As I understand, there are numerous ways I could have gotten the section face but I needed the cutplane for other reasons and thought I would make use of it for this macro as well.


Is there a simple way to select the CutPlane by name and get the face on that plane?