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,
Solved! Go to Solution.
Solved by 421232206. Go to Solution.