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

pRegion->getAreaProp()

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
EMD1954
542 Views, 6 Replies

pRegion->getAreaProp()

I want to let the user draw a complicated, 2D polyline, select it, and have it convert to a region so I can use the mass properties for a handful of tasks.  I've gotten to the point (following the samples) where I am able to create the region using

 

es = AcDbRegion::createFromCurves(curveSegs, regions);

 

AcDbRegion *pRegion;

pRegion =static_cast<AcDbRegion*>(regions[0]);  // I only have one element to pick

 

pRegion->getPlane(plane);

plane.getCoordSystem(origin, xAxis, yAxis);

es = pRegion->getAreaProp(origin, xAxis, yAxis, perimeter, area, centroid, momInertia,

prodInertia, prinMoments, prinAxes, radiiGyration, extentsLow, extentsHigh);

 

Then I save it to the database.  It works fine up to this point, but I get the wrong centroid (and different than the command line "MASSPROP")

 

Anything obvious?  Any help would be appreciated.

Thanks,

Ed

6 REPLIES 6
Message 2 of 7
owenwengerd
in reply to: EMD1954

What are the actual values that you're passing for the origin, xAxis, and yAxis arguments to getAreaProp()? Perhaps the MASSPROP command uses the UCS instead of the World coordinate system.

--
Owen Wengerd
ManuSoft
Message 3 of 7
EMD1954
in reply to: owenwengerd

Origin is -50.1250, 76.0000, 0.0000 (it's the first point of the 3Dpoly that i created before it's turned into a region)
xAxis  is 1.0000, 0.0000, 0.0000
yAxis  is 0.0000, 1.0000, 0.0000

 

Function is attached as .txt file

 

Thanks,

Ed

 

 

Message 4 of 7
owenwengerd
in reply to: EMD1954

Try the WCS or UCS, then compare the results to MASSPROP.

--
Owen Wengerd
ManuSoft
Message 5 of 7
EMD1954
in reply to: EMD1954

Sorry for the trouble, but I don't understand.  I tried it in the "world" UCS, changed the view and set the UCS to "View" and even tried to set the UCS to "element".  What do you mean?  Sorry.

Message 6 of 7
owenwengerd
in reply to: EMD1954

I am referring to the first three arguments to getAreaProp(). For example, the WCS would be:

pRegion->getAreaProp(AcGePoint3d(0,0,0), AcGeVector3d(1,0,0), AcGeVector3d(0,1,0), ...);
--
Owen Wengerd
ManuSoft
Message 7 of 7
EMD1954
in reply to: EMD1954

Yes.  The problem was that "origin" was returning the first point of the original polyline, so I just zeroed the X and Y coordinates (I need Z for the proper elevation).  The xAxis and yAxis were correct:

 

pRegion->getPlane(plane);

plane.getCoordSystem(origin, xAxis, yAxis); 

 

origin.x = 0.0;

origin.y = 0,0;

 

Works great - thank you,

Ed

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

Post to forums  

Autodesk Design & Make Report

”Boost