i do not know how to get projected area of a part when we choose a plane of projection?please help me,thank you!
I would love to help but I do not understand your question.
Video Tutorials for the SolidWorks API
The question is interesting. Consider a solid body and a plane. Can you get the outline of the solid body as projected to the plane?
Or even better, you have a solid body, a direction and a surface of any type. Get the outline of the solid body on that surface based on the given direction.
Imagine directing parallel rays from above the solid body to the plane. Get the shadow outline.
That makes a lot of sense. Next I would need to know what he wants for the outline. A split line? A sketch? If a split line and you don't mind an approximation then you can get the bounding box of the body, extract the appropriate coordinates, and use that with IFeatureManager::InsertSplitLineIntersect. That method returns a feature. You could use IFeature::GetFaces to get the face created by that feature, then use IFace2::GetArea to get the area.
If the bounding box coordinates aren't acceptable, it is still possible. If the extreme points of the bodies are vertices then he'd need only traverse the vertices (IBody2::GetVertices) and get the most extreme coordinates using IVertex::GetPoint. If the extreme points aren't vertices then he'd have to find the most extreme tessellation pts using ITessellation::GetVertexPoint.
i draw a pic to describe my question, if you have any question, please tell me.
If you measure the face of the part at the widest partion it will tell you the area.
Or you can also creat a planner surface form the insert or part them measure the area.
If the shapes are that simple then it looks like the upper most planar surface could simply be measured to give you the correct answer as well. But for more complex shapes, use the bounding box method I described.
I will revive this old thread because I face the same issue;
@Kevin Drew: there is NO face, it is the projection of a complex assembly, like a telecom tower with attached antennas
@Keith Rice: I don't quite undersand your method...
Any ideas? It is, in simple terms, the area of an orthogonal projection.
I would suggest the Modeler::GetBodyOutline2 method which gets the outline curves of the body in a given direction. Than it is required to create a temporary sheet body, trim it with these curves (Surface::CreateTrimmedSheet4.) and get the area of its single face (Face2::GetArea). This is quite a bit of advanced SolidWorks programming but this is IMHO the only correct way to do this.
Another option may be to create a drawing view from this body in a given direction and convert all outline entities and calculate the area using the measure tool - but this is more manual process.
Application Engineer at Intercad
Tel: +61 2 9454 4444
However, I know nothing about SW programming so this method won't work for me, I'm just an average user.
If I have this macro I would share this with you but I do not have one. You may request this custom programming. There is number of companies including my company which provide this service and may do this.
The projected area of a part can be found (estimated) by using the following method :
1. Rotate or align with the plane in the orientation you want to calc the area.
2. Use "Save as DXF" with "annotation views" & current...
3. Open DXF as new part, extrude part based on the DXF outline.
4. Use standard measure tool to find the area, perimeter etc...
Frode, great workaround. I wrote a macro using this approach that you can download on my web site. See "Get sketched outline / projected sketch of part" in our Macro LIbrary.
The disadvantage of this method is that it leaves a lot of extraneous sketch entities that the user still needs to delete manually.
As for Artem's method, there is an example in the API Help that will approximate the outline of a part using IModeler::GetBodyOutline2. See the API Help page for IModeler::GetBodyOutline2. I'm sure it could be modified to give an exact outline, though perhaps not easily.
SolidWorks API Tutorials
Wen, I recently started writing the macro for finding outlines (Re: Silhouette of a solid body projected on a face) and I added to it to compute the area of the face generated from that code. I attached what I believe can solve your original issue.
EDIT: The attached method only works for straight line parts without cavities.
Happy New Year,
Hi dear Keith
I tried to use from your tutorials from:Video Tutorials for the SolidWorks API
but i couldn't see any thing
are all tutorials omitted from there?
I wonder if u contribute me to download any of tutorials as i'm not a native English and it takes me long time to understand them
You need to create a user login on that site. Only then you will be able to access some of the free videos as a basic user. If you're looking to upgrade to power user, I can highly recommend that.
I have been created a free user on that site
but unfortunatly yet i was not be able to watch any thing
is there any way to download a tutorial clip from a site like this, as i'm not a native English speaker it take long time to understand it.
therefor i need to wach it many times
do you know any way to download them?
I don't think you can download them
thanks dear Deepak
In my experience, all the "IModeler::GetBodyOutline2" help examples only work for straight line parts. The one shown is a curved feature. Is there a way to convert the curve into a sketch or an edge ("swSketchMgr::SketchUseEdge" only works with edges)?
As I had recently the same question, I found an easier way to do it with convert entities:
1) Create a plane where the area will be projected
2) On the Plane create Sketch
3) Then click Convert Entities
4) Select the surfaces (curved or not,, fully or partly visible) that you need to use for the projected area
5) Click ok
6) The area is now projected on the plane as a sketch
7) Create an extrude of the sketch contours that you need and measure the area.
Polytimi Sofotasiou wrote: As I had recently the same question, I found an easier way to do it with convert entities: 1) Create a plane where the area will be projected2) On the Plane create Sketch3) Then click Convert Entities4) Select the surfaces (curved or not,, fully or partly visible) that you need to use for the projected area5) Click ok6) The area is now projected on the plane as a sketch7) Create an extrude of the sketch contours that you need and measure the area.
Polytimi Sofotasiou wrote:
What version of SOLIDWORKS are you using? What you described sounds like a nice enhancement, but does not work in the current version of SOLIDWORKS. You cannot project a body using the Convert Entities tool.
You can use the section view tool to create a temporary slice through the part then select the surface and the the mass properties tool.
I remember that I wrote a macro to do this.
I think I based it on someone else's work but I can't remember who - apologies to them.
I use the 2015 version. These were the exact steps that i followed and the results are depicted in the attached image. The only thing that I had to do more is to connect the open edges to enable the extrude command!
Polytimi Sofotasiou wrote: I use the 2015 version. These were the exact steps that i followed and the results are depicted in the attached image. The only thing that I had to do more is to connect the open edges to enable the extrude command!
Aha. Now I understand. By surfaces you mean faces. I thought you found a way to project a full body.
Your workflow would work on a very limited number of situations.
At at this time, the only reliable way I know to work is using the Parting Line technique. Watch this video:
SOLIDWORKS Tutorial - Projecting the outline of a solid body on a face or plane - YouTube
Retrieving data ...