startAngle in Arc ctor

startAngle in Arc ctor

dirk.neethling
Advocate Advocate
665 Views
3 Replies
Message 1 of 4

startAngle in Arc ctor

dirk.neethling
Advocate
Advocate

I'm programmatically transferring the Alignment Object from Autocad 2016 Civil3D to Revit.

The Alignment object has several properties, however, due to the limited number of constrcutors on the Arc class, only 1 Arc constructor is of interest:

 

 public static Arc Create(
Plane plane,
double radius,
double startAngle,
double endAngle
)

 

Unfortunately the vector from which the startAngle is measured is not defined.

 

I have the following inforrmation from Autocad:

 

XYZ StartPoint = new XYZ(533.9217456, 144.1244247, 10);

XYZ CenterPoint = new XYZ(673.141807, -63.52377422, 10);

double Radius = 250;

XYZ EndPoint = new XYZ(760.14143, 170.849999, 10);

 

from these I can determine the following:

 

XYZ refVec = CenterPoint - XYZ.Zero;

XYZ xVec = (CenterPoint - StartPoint).Normalize();

XYZ yVec = (CenterPoint - EndPoint).Normalize();

XYZ normal = xVec.CrossProduct(yVec);

 

using the vectors from origin to CenterPoint and origin to StartPoint, I can determine the startAngle:

double DeflectedAngle = refVec.AngleTo(xVec);

 

With

double Delta = 0.94606029451277518;

 

this yields:

Plane plane = app.Create.NewPlane(normal, CenterPoint);

Arc arc = Arc.Create(plane, Radius, DeflectedAngle, DeflectedAngle + Delta);

 

However there is a small unexpected offset between the vector CenterPoint to StartPoint and the start of the arc, see attachment.

 

So my question is: from which vector is the startAngle measured? 

 

 

0 Likes
666 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Dear Dirk,

 

I could search for an answer for you.

 

Here is some background info on arcs and other curves, for instance:

 

http://thebuildingcoder.typepad.com/blog/2010/01/curves.html

 

More comfortable and reliable for both of us might be for you to try the other Arc.Create method instead, taking XYZ, Double, Double, Double, XYZ, and XYZ arguments, specifying center, radius, unit vectors, and angles.

 

That gives you total control over the definition of the start angle.

 

I hope this helps.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 4

dirk.neethling
Advocate
Advocate

Hello Jeremey,

 

thanks for the pointer. I assume you are talking about this constructor:

 

public static Arc Create(
XYZ center,
double radius,
double startAngle,
double endAngle,
XYZ xAxis,
XYZ yAxis
)

 

The problem with that signature is the same: what is the definition of startAngle? I wish they would just properly define it in the specs.

I tried to calculate it by doing a dotProduct of xAxis and XYZ.BasisX. But the arc is offset by a discrepancy of about 20°.

dirk

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

Dear Dirk,

 

I am pretty sure it is well defined.

 

I would assume that a start angle of zero means 'start where the X axis points to'.

 

Any value higher than zero rotates around the Z axis, which is defined by the cross product of X and Y.

 

I do not know exactly what you mean by the description iof your calculation.

 

I suggest you take a look at the Revit SDK samples.

 

I see 35 occurrences of Arc.Create in there.

 

Certainly one of them will clarify the approach for you.

 

Please let us know how you end up solving this.

 

Thank you!

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes