ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
475867377
677 Views, 7 Replies

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

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

 

 

7 REPLIES 7
Message 2 of 8
tbrammer
in reply to: 475867377

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.

Message 3 of 8
475867377
in reply to: tbrammer

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

Message 4 of 8
tbrammer
in reply to: 475867377

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.

Message 5 of 8
475867377
in reply to: tbrammer

this is the dwg.

Message 6 of 8
tbrammer
in reply to: 475867377

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.

Message 7 of 8
475867377
in reply to: 475867377

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.

Message 8 of 8
475867377
in reply to: tbrammer

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report