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

AcDbHatch and AcGeCircArc3d as edge

1 REPLY 1
Reply
Message 1 of 2
igor.ivanov
483 Views, 1 Reply

AcDbHatch and AcGeCircArc3d as edge

Hello again.

 

Have discovered another problem. Little bit baground. I working on software which transforms dwg:s from one coordinate systems to another.

The transformation is always not uniform, so I do it by transforming each entity by point by point. I understand that in the case of the Arc the non uniformely transformed Arc is not Arc anymore, but it is acceptible result when Arc is transformed by transforming start, mid and end points. Some dwg files have a lot of hatches and they transforms wrong. So I discovered the problem in the example shown below:

 

I draw entities

 

Line from (0,7) to (0,5)

Arc by center point (0,0) start point (5,0), End Point (0,5)

Line from (7,0) to (5,0)

Arc by center point (0,0) start point (7,0), End Point (5,0)

 

After it I used hatch command to create solid hatch from this entities hatch->select objects. After it I remove Hatch associativity. You can see what I have drawn on the next picture:

 

ArcHatch.jpg

The problems start when I transform this entity by iterating trough it loops using

 

Acad::ErrorStatus getLoopAt(
    int loopIndex, 
    Adesk::Int32& loopType, 
    AcGeVoidPointerArray& edgePtrs, 
    AcGeIntArray& edgeTypes
) const;

for loopType == AcDbHatch::kCirArc I get pointer to AcGeCircArc3d:

 

AcGeCircArc3d *pGeArc = (AcGeCircArc3d *)edgePtrs[j];

 

The Normal of the pGeArc drawn from (5,0) to (0,5) is (0,0,-1). First question is why?

The second question is: when I get this arc coordinates , angles before transformation they are in WCS and are correct, so what is the transformation matrice for transformed points so they can be passed in to this Arc using

 

set(TransStPt,TransMidPt,TransEndPt);

or set(TransCenter,.........) ?

 

I tried next code:

 

AcGeMatrix3d geMat,inv_geMat;

geMat.setToIdentity();

geMat = geMat.planeToWorld(pGeArc->normal());

inv_geMat = geMat.inverse();

 

and then just tried to transforms every transformed point (before passing it to set function) by geMat or inv_geMat, but results are always like in the next picture:

 

ArcHatchWrog.jpg

 

Any suggestions?

1 REPLY 1
Message 2 of 2
owenwengerd
in reply to: igor.ivanov

I'm not sure I quite understand the problem, but some comments:

1) Arcs are always counterclockwise from start to end, so the reversed normal indicates that the arc was drawn from tol-left to bottom-right.

2) Arc angles are in ECS, not WCS.

3) Hatch boundaries are noriously tricky. Have you compared the transformed endpoints of the arcs and lines to verify that they are in fact coincident?

--
Owen Wengerd
ManuSoft

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

Post to forums  

Autodesk Design & Make Report

”Boost