.NET

Reply
Active Contributor
tangferry
Posts: 43
Registered: ‎04-21-2005
Message 1 of 2 (275 Views)

Is this a bug of CircularArc3d class?

275 Views, 1 Replies
07-10-2005 10:59 PM
I want to get an arc passing through three given points.I use the CircularArc3d class to get the center,radius,startAngle and endAngle of the arc.But the arc does not pass through the three points.
static public void test() // This method can have any name
{
// Put your command code here
Point3d pt1=new Point3d(0,0,0);
Point3d pt2=new Point3d(10,10,0);
Point3d pt3=new Point3d(10,20,0);
CircularArc3d cirArc=new circularArc3d(pt1,pt2,pt3);
Arc arc=new Arc(cirArc.Center,cirArc.Radius,cirArc.StartAngle,cirArc.EndAngle);
Database db=Application.DocumentManager.MdiActiveDocument.Database;
DBTransMan tm=db.TransactionManager;
using(Transaction trans=tm.StartTransaction())
{
BlockTable bt=(BlockTable)tm.GetObject(db.BlockTableId,OpenMode.ForRead);
BlockTableRecord btr=(BlockTableRecord)tm.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite);
btr.AppendEntity(arc);
tm.AddNewlyCreatedDBObject(arc,true);
trans.Commit();
}
}
*Albert Szilvasy
Message 2 of 2 (275 Views)

Re: Is this a bug of CircularArc3d class?

07-14-2005 09:09 AM in reply to: tangferry
No, I don't think this is a bug. This should do it:

Arc convertArc2Arc( CircularArc3d arc )

{

Vector3d refVec = arc.ReferenceVector;

Plane plane = new Plane(arc.Center, arc.Normal);

double ang = refVec.AngleOnPlane(plane);

return new Arc(arc.Center, arc.Normal, arc.Radius,arc.StartAngle + ang,
arc.EndAngle + ang );

}

Albert

wrote in message news:4897476@discussion.autodesk.com...
I want to get an arc passing through three given points.I use the
CircularArc3d class to get the center,radius,startAngle and endAngle of the
arc.But the arc does not pass through the three points.
static public void test() // This method can have any name
{
// Put your command code here
Point3d pt1=new Point3d(0,0,0);
Point3d pt2=new Point3d(10,10,0);
Point3d pt3=new Point3d(10,20,0);
CircularArc3d cirArc=new circularArc3d(pt1,pt2,pt3);
Arc arc=new
Arc(cirArc.Center,cirArc.Radius,cirArc.StartAngle,cirArc.EndAngle);
Database db=Application.DocumentManager.MdiActiveDocument.Database;
DBTransMan tm=db.TransactionManager;
using(Transaction trans=tm.StartTransaction())
{
BlockTable bt=(BlockTable)tm.GetObject(db.BlockTableId,OpenMode.ForRead);
BlockTableRecord
btr=(BlockTableRecord)tm.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite);
btr.AppendEntity(arc);
tm.AddNewlyCreatedDBObject(arc,true);
trans.Commit();
}
}
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.