Calculation of Face Area
Moderators: remi77, jacs, Daniel
-
- Private First Class
- Posts: 18
- Joined: Tue Sep 08, 2015 11:04 am
- TopSolid Module: TopSolid'Design
- TopSolid Version: 6.25
Calculation of Face Area
Hi Team,
I have a shape that has 6 faces.
I want to find the ElementId of the face with maximum area.
For this purpose, I need to be able to calculate area of each face.
I searched the API help but, couldn't find anything.
Does anybody know anything about it?
Regards,
Nikhil
I have a shape that has 6 faces.
I want to find the ElementId of the face with maximum area.
For this purpose, I need to be able to calculate area of each face.
I searched the API help but, couldn't find anything.
Does anybody know anything about it?
Regards,
Nikhil
-
- Master Corporal
- Posts: 49
- Joined: Tue Sep 29, 2015 2:48 pm
- TopSolid Module: TopSolid'Cam
- TopSolid Version: 6.26
Re: Calculation of Face Area
There is two kinds of Elements
the ElementId (where is stored the value of the shape)
and the ElementItemId (where is stored Items from ElementId, like faces)
You want to get the maximum area of just one ElementId or get the maximum area of each shapes?
the ElementId (where is stored the value of the shape)
and the ElementItemId (where is stored Items from ElementId, like faces)
You want to get the maximum area of just one ElementId or get the maximum area of each shapes?
-
- Private First Class
- Posts: 18
- Joined: Tue Sep 08, 2015 11:04 am
- TopSolid Module: TopSolid'Design
- TopSolid Version: 6.25
Re: Calculation of Face Area
ElementItemId
I want to find the ElementItemId of the face that has max area.
I want to find the ElementItemId of the face that has max area.
-
- Master Corporal
- Posts: 49
- Joined: Tue Sep 29, 2015 2:48 pm
- TopSolid Module: TopSolid'Cam
- TopSolid Version: 6.26
Re: Calculation of Face Area
ok, but will look into all shapes or in only one selected shape?
-
- Private First Class
- Posts: 18
- Joined: Tue Sep 08, 2015 11:04 am
- TopSolid Module: TopSolid'Design
- TopSolid Version: 6.25
Re: Calculation of Face Area
Just one shape.
GetallFaces of that shape.
Find area of each face.
GetallFaces of that shape.
Find area of each face.
-
- Master Corporal
- Posts: 49
- Joined: Tue Sep 29, 2015 2:48 pm
- TopSolid Module: TopSolid'Cam
- TopSolid Version: 6.26
Re: Calculation of Face Area
i'm not finding an way to get the areas ):
i got the faces, edges, etc. but not the areas ):
i got the faces, edges, etc. but not the areas ):
-
- Private First Class
- Posts: 18
- Joined: Tue Sep 08, 2015 11:04 am
- TopSolid Module: TopSolid'Design
- TopSolid Version: 6.25
Re: Calculation of Face Area
Same here.
My aim is to determine the face(Only ElementItemId) that has max area. It's okay if I am unable to calculate the exact area value.
I can think of another way of doing this,
I will process only Planar faces.
I can get a planar face & its edges.
Then I can get length of each edge. I will add the edge lengths for a face & get a number.
Then repeat the same for all faces.
This should look like,
Face1: Sum of Edge Lengths = 100
Face2: Sum of Edge Lengths = 150
Face3: Sum of Edge Lengths = 200
I think that the face with max sum of edge lengths must be the face with max area.
This way I can determine the ElementItemId of the face.
Can anyone confirm that this will give the same result?
I am not quite sure.
My aim is to determine the face(Only ElementItemId) that has max area. It's okay if I am unable to calculate the exact area value.
I can think of another way of doing this,
I will process only Planar faces.
I can get a planar face & its edges.
Then I can get length of each edge. I will add the edge lengths for a face & get a number.
Then repeat the same for all faces.
This should look like,
Face1: Sum of Edge Lengths = 100
Face2: Sum of Edge Lengths = 150
Face3: Sum of Edge Lengths = 200
I think that the face with max sum of edge lengths must be the face with max area.
This way I can determine the ElementItemId of the face.
Can anyone confirm that this will give the same result?
I am not quite sure.
-
- Master Corporal
- Posts: 49
- Joined: Tue Sep 29, 2015 2:48 pm
- TopSolid Module: TopSolid'Cam
- TopSolid Version: 6.26
Re: Calculation of Face Area
I guess if you have an rectangular shape, with small thickness you'll have a small area but an big perimeter...
-
- Private First Class
- Posts: 18
- Joined: Tue Sep 08, 2015 11:04 am
- TopSolid Module: TopSolid'Design
- TopSolid Version: 6.25
Re: Calculation of Face Area
Right.
I think this should work for me.
I think this should work for me.
-
- Private First Class
- Posts: 18
- Joined: Tue Sep 08, 2015 11:04 am
- TopSolid Module: TopSolid'Design
- TopSolid Version: 6.25
Re: Calculation of Face Area
But, It would be best if I can actually get the face area from an API.
-
- Master Corporal
- Posts: 49
- Joined: Tue Sep 29, 2015 2:48 pm
- TopSolid Module: TopSolid'Cam
- TopSolid Version: 6.26
Re: Calculation of Face Area
of course!
i'm thinking about it, and i don't know how to proceed with an face that have an boss (will add edges, and then will raise our "perimeter")
i'm thinking about it, and i don't know how to proceed with an face that have an boss (will add edges, and then will raise our "perimeter")
-
- Private First Class
- Posts: 18
- Joined: Tue Sep 08, 2015 11:04 am
- TopSolid Module: TopSolid'Design
- TopSolid Version: 6.25
Re: Calculation of Face Area
Right.
I thought of it....I tried to get only the outer loop on the face.
But for some reason, the IShapes.GetLoopType() & IShapes.GetLoopEdges() APIs are throwing exception even if IShapes.GetFaceLoops() gives me 2 loops.
I think I am missing something while using these APIs as they are crashing with the exception 'Invalid loop identifier'.
I also tried using the IShapes.GetBoundaryEdges() API but, it is returning count 0.
I thought of it....I tried to get only the outer loop on the face.
But for some reason, the IShapes.GetLoopType() & IShapes.GetLoopEdges() APIs are throwing exception even if IShapes.GetFaceLoops() gives me 2 loops.
I think I am missing something while using these APIs as they are crashing with the exception 'Invalid loop identifier'.
I also tried using the IShapes.GetBoundaryEdges() API but, it is returning count 0.
-
- Chief
- Posts: 107
- Joined: Mon Mar 26, 2007 9:40 am
- TopSolid Module: TopSolid'Cam
- TopSolid Version: 6.26
- Location: The netherlands
- Contact:
Re: Calculation of Face Area
Of course if you shape is a solid there are no boundaries. It is closed [emoji2]
Getfaceloop with the faceId seems to me the most logic way.
Can I see a picture of the shape and it's face to analyse?
Getfaceloop with the faceId seems to me the most logic way.
Can I see a picture of the shape and it's face to analyse?
-
- Private First Class
- Posts: 18
- Joined: Tue Sep 08, 2015 11:04 am
- TopSolid Module: TopSolid'Design
- TopSolid Version: 6.25
Re: Calculation of Face Area
PFA the shape & selected face image.
It's a solid.
IShapes.GetFaceLoops() gives me 2 loop IDs.
But, IShapes.GetLoopEdges() API crashes. Also, I can't understand why this API requires shape ElementId as parameter instead of face elementItemId ?
How can I get the face loop edges?
It's a solid.
IShapes.GetFaceLoops() gives me 2 loop IDs.
But, IShapes.GetLoopEdges() API crashes. Also, I can't understand why this API requires shape ElementId as parameter instead of face elementItemId ?
How can I get the face loop edges?
-
- Chief
- Posts: 107
- Joined: Mon Mar 26, 2007 9:40 am
- TopSolid Module: TopSolid'Cam
- TopSolid Version: 6.26
- Location: The netherlands
- Contact:
Re: Calculation of Face Area
A face is a shape. A shape can be a Solid or a surface. And thus it can be a single face surface or a multi face surface. That's why you need to give a Shape I'd.
What is wrong than with the Ishape.GetFaceLoops ? You have your edges. Can you check the length to get the smallest of both, that's the one you want. Isn't it?
What is wrong than with the Ishape.GetFaceLoops ? You have your edges. Can you check the length to get the smallest of both, that's the one you want. Isn't it?