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

create hatch from dxf , error with AcGeEllipArc2d

1 REPLY 1
SOLVED
Reply
Message 1 of 2
421232206
639 Views, 1 Reply

create hatch from dxf , error with AcGeEllipArc2d

Look at the picture below, I want to draw hatch from dxf, everything is ok except with AcGeEllipArc2d,

you can see in the picture, the first 50 dxf code "3.3370" stands for the start angle, and the first 51 dxf code "9.03429" stands for the end angle.

and please the code below,

 

double dMajorRadius = pt2dEnd.asVector().length();
if (dEndAngle-dStAngle>PI*2)
{
dStAngle = 0.0;dEndAngle = PI*2;
}
dStAngle = 3.6755275;//here the start angle is 3.3370, but i have to use 3.6755275,
dEndAngle = 8.5368314;// the end angle is 9.03429, but i have to use 8.53
AcGeVector2d m1 = pt2dEnd.asVector().normal(),m2 =pt2dEnd.asVector().rotateBy(PI/2).normal();
AcGeEllipArc2d* pNewEllip = new AcGeEllipArc2d(pt2dSt,pt2dEnd.asVector().normal(),pt2dEnd.asVector().rotateBy(PI/2).normal(),dMajorRadius,dMajorRadius*dRadius,dStAngle,dEndAngle);
dStAngle = pNewEllip->startAng();
dEndAngle = pNewEllip->endAng();

 

the second picture shows:the hatch "50F"(handle) is the new one created by the code above,  and it is the same as the hatch "501",

but why?  the start angle ,the end angle, why can't I use the value from dxf ?

 

and if I use the code below,

double dMajorRadius = pt2dEnd.asVector().length();
if (dEndAngle-dStAngle>PI*2)
{
dStAngle = 0.0;dEndAngle = PI*2;
}
AcGeVector2d m1 = pt2dEnd.asVector().normal(),m2 =pt2dEnd.asVector().rotateBy(PI/2).normal();
AcGeEllipArc2d* pNewEllip = new AcGeEllipArc2d(pt2dSt,pt2dEnd.asVector().normal(),pt2dEnd.asVector().rotateBy(PI/2).normal(),dMajorRadius,dMajorRadius*dRadius,dStAngle,dEndAngle);

see the third picture, I get the wrong hatch(the red one), it is different from the old one,  

 

Technology change world! Coding change technology! We coders are coding!
1 REPLY 1
Message 2 of 2
421232206
in reply to: 421232206

i got the solution, there are two angles about a point on ellpise, dxf provide angle of point on ellipse, while angle of point on the big circle is required by AcGeEllipArc2d,we need convert
Technology change world! Coding change technology! We coders are coding!

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

Post to forums  

Autodesk Design & Make Report

”Boost