acdbregion getArea =0,but the area of region is not 0 in fact

acdbregion getArea =0,but the area of region is not 0 in fact

475867377
Advocate Advocate
1,431 Views
7 Replies
Message 1 of 8

acdbregion getArea =0,but the area of region is not 0 in fact

475867377
Advocate
Advocate

the region is unioned by two regions .but the area get by api getArea() is 0.in cad property window can not show area and perimeter. i use command "area" to caculate area but failed. is there anything wrong?

 

475867377_0-1721027479950.png

475867377_1-1721027744582.png

 

 

0 Likes
Accepted solutions (1)
1,432 Views
7 Replies
Replies (7)
Message 2 of 8

tbrammer
Advisor
Advisor

Can you please post the DWG with the region in question?

You wrote that the region is a union of two regions. Do both have a valid area? Can you post a DWG with those regions as well? 

Do you know how the regions were created?

Which AutoCAD version are you using?


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 3 of 8

475867377
Advocate
Advocate

the region is created by api booleanOper(AcDb::kBoolUnite).it have merged the other region.the version of CAD is 2018.

0 Likes
Message 4 of 8

tbrammer
Advisor
Advisor

Again: Can you please post the DWG with the region in question and if possible a DWG with the two regions that you merged? 

Have you tried to open the DWG with _RECOVER?

Can you check the DWG with a newer version of AutoCAD?

 


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 5 of 8

475867377
Advocate
Advocate

this is the dwg.

0 Likes
Message 6 of 8

tbrammer
Advisor
Advisor
Accepted solution

I can reproduce the behaviour with AutoCAD 2024. 

The two regions in the DWG are valid. But if I _UNITE them, the resulting region looks OK, but it doesn't show geometry properties like area and circumference.

If I use the command SNOOPENTS from ArxDbg.arx (<ARX>\samples\database\ARXDBG) I get the error messages

ERROR calling AcDbRegion::getAreaProp()
ARX ERROR: eInvalidInput

Also the AutoCAD command _AREA _OBJECT can't calculate the area.

The AutoCAD command _MASSPROP however displays values for area (Fläche) and circumference (Umfang):

tbrammer_2-1723017685029.png

 

The geometry of one region is very complex. It has a lot of "touching points" that makes it hard to decide whether there is one region with a hole or multiple separate regions. I suppose that this causes the problem.

tbrammer_3-1723018299693.png

 

Looks like a bug. So I think this is a case for the AutoCAD product support.

 

I managed to create a valid united region like this:

  1. _EXPLODE all regions to lines
  2. Create new regions with _REGION and select all lines. 
  3. Unite all new regions with _UNITE

See attached DWG. I think you can do the same programmatically with ObjectARX. This could be a workaround for you.

 


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 7 of 8

475867377
Advocate
Advocate

i have resolved the problem.the region is create  by the AcDb3dPolyline which vertexs ' z value is 0.i change to AcDbPolyline and setElevation(0),then the problem is resolved.thank you for your help.

0 Likes
Message 8 of 8

475867377
Advocate
Advocate

i have resolved the problem.the region is create  by the AcDb3dPolyline which vertexs ' z value is 0.i change to AcDbPolyline and setElevation(0),then the problem is resolved.thank you for your help.