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

Is this a bug of CircularArc3d class?

1 REPLY 1
Reply
Message 1 of 2
tangferry
507 Views, 1 Reply

Is this a bug of CircularArc3d class?

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();
}
}
1 REPLY 1
Message 2 of 2
Anonymous
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();
}
}

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost