I am calculating the area of a grouped hole with the help of this command ComputeGroupedHoleArea (at the bottom of the page).
It works very well but now I came across an grouped hole with an element in it which has a very small area.
area = area - oEnumerator.Current.AsClosedElement.Area
does throw an error.
The .Area is where it goes wrong so the code is fine but the .Area itself is not.
After some investigation it turns out the area of the element was very small. The element was a triangle with the second point exactly between the other two.
When I used Microstation itself to calculate the area it said it could calculate it.
When I used Microstation to calculate the area of the Grouped Hole it worked fine.
A way to let Microstation calculate the area outside VBA and return the value would be a solution?
Now I would like it very much if it would just return 0.
Try and Catch looked promising but that does not exist (yet) in VBA.
I read something about using On Error but It is a little bit out of my league (yet).
Does anyone has a solution for catching such an error and replace it with another value (0)?
I recommend to move your post to MicroStation Programming forum, because this is general Developers and Programming forum, not focusing specifically MicroStation. To move existing post to another forum, use More > Move tool, available under your original post.
Also, to share DGN example with element id what element you want to measure would help, because otherwise we have to believe the problem is in the element itself ... which sounds weird to me, when MicroStation tells it's possible to calculate the area.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
I can't find the Microstation Programming forum via "More" under my original post. It seems I have no Access to them according to the menu.
I will repost and try to close this one.
I will upload a dgn with the element.
pieter Dorp said:I can't find the Microstation Programming
It happens sometimes. Try to type the name directly.
pieter Dorp said:I will repost and try to close this one.
I am not sure whether it's possible to delete (or close) own post, so to find how to move the post is recommended.
pieter Dorp said:I will upload a dgn with the element.
The post added again at:
Microstation Programming Forum