ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
BMBrandon Massoni02/01/2015

How to select a body and have it's silhouette (outline) projected onto a face or plane as a sketch? This discussion was previously in a non-API forum, but I'd like to take a crack at the API code. Here is the original discussion <https://forum.solidworks.com/message/424740#424740>. The best idea the discussion had was to use parting surfaces, but you have to select all the parting line loops manually.

 

My idea is this:

1. Create sketch on plane

2. Select all edges

3. Use convert entities to convert all the edges to sketch lines

4. Extrude, selecting all the closed loops in the sketch

5. Create a second sketch on plane

6. Use convert entities to convert the largest face of the new extrusion to sketch lines -> This is the silhouette!

 

My first coding attempt is pretty broken (attached):

1. Not all the edges can be converted using "swSketchMgr.SketchUseEdge False", since some of the edges are normal to the plane

2. I tried to use "swSketch.GetSketchContours" to select all the contours in the sketch, but this does not work.

3. I tried to set the body from the extrusion (which was not merged)  "swBody = swFeat.GetBody", but this also does not work.

 

I will update as I progress, but in advance, thanks to those of you who help.

-Brandon

 

PS. if you'd like SolidWorks to do this in new versions, please vote on: SPR 627869: Ability to select a body and have it's shadow (silhouette) projected onto a face or plane (reference, outline, split line, new sketch)