We have a macro function that we use as part of our automatic breakdown to extract all profile from a machine assembly and save them as DXF's so we can send it to the laser cutters.
The function is a slightly modified version of the advice Keith Rice gave me here https://forum.solidworks.com/message/364402#364402 to select the largest face on an extruded part therefore determining the surface we want for the profile DXF.
This system works really well but every so often we get caught out by a part that typically is a profile that has a machining process performed once laser cut. This means the "largest surface" doesn’t necessarily contain all the information needed to get in the raw pre-machined profile. An example image is attached of a laser cut sprocket where the teeth are cut off because they are chamfered which creates a break in the surface.
My ideal solution, which may not be possible, it to run a check on the selected largest face to make sure all touching faces are perpendicular itself. I can then raise an exception and get eh user to check the DXF is correct. Is this possible or is there another solution that would be better suited?
SolidworksApi macros
Well... For this particular one you could do an extrude cut to the mid plane and then get the largest face...
But yes, you should be able to check all adjacent faces. I believe first you would get the normal vector of the selected face. Then get the outer loop, then all edges of the loop, then the co-edge of each edge, then the face that the coedge belongs to. Check to make sure the face is planar or cylindrical (the two types of faces that could be 90° from the other face), get a normal vector, and dot it with the original vector you had. If the dot product is zero, the vectors are orthogonal.
Hi Josh
Yes for this one you are correct you can do a mid-plane cut but I cannot guarantee that will always work, i.e. tapered counterbores into will have a different thickness depending on where they are cut.
I am going to have to do some reading up on vectors as a refresher because I have not used them since leaving university. Thanks for the advice though.