Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fixed AlignmentArc by 3 Points without a previous entity ID [C3D2012]

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
ryarmak
423 Views, 4 Replies

Fixed AlignmentArc by 3 Points without a previous entity ID [C3D2012]

Is there a way to use AddFixedCurve() that takes 3 points and a previous entity id, without a previous entity id? Like by sending some sort of null?

 

I cannot seem to extract the information required to recreate fixed 3 point arcs properly.  The only one without an entity requirement that looks like it could work for me is the Point3d, Vector3d, Point3d version and taking StartDirection to use for the Vector3d.  Except for the ridiculousness of how alignment creation tools require Point3d/Vector3d/Enums and the properties actually stored on the alignments are Point2d/Doubles/Booleans. 

 

I'm currently using

private Vector3d vectorize(double dir) { return new Vector3d(Math.Sin(dir), Math.Cos(dir), 0); }

 to convert between the directions given from any of the AlignmentEntities.  Maybe that isn't the right thing? Because I'm getting some horrible results doing fixed curves (StartDirection) but it seems to work for float curves (DirectionAtPoint2).


Any help or hints would be appreciated.  Pretty much the rest of the code is just pulling info from one alignment and using that to recreate the entities in another.  Works perfectly for most things except these dang fixed curves. 

 

4 REPLIES 4
Message 2 of 5
tyronebk
in reply to: ryarmak

Use this version of the method (which I believe you are):

public AlignmentArc AddFixedCurve(
	int previousEntityId,
	Point3d startPoint,
	Point3d middlePoint,
	Point3d endPoint
)

and specify 0 for the previousEntityId. That looks like what I've done in one of my old commands and it seems to work fine.

Message 3 of 5
ryarmak
in reply to: tyronebk

I wasn't sure if that was going to work so I avoided it.  I'll give it a try!  I'll report back either with problems or a solution click.

 

Thanks

Message 4 of 5
Partha.Sarkar
in reply to: ryarmak

Hi byarmak,

 

If you don't want to use previous enityt id then you have other options too. Please check this link below for different type of AddFixedCurve() like the following one -

 

public AlignmentArc AddFixedCurve(  Point3d centerPoint,  Point3d passThroughPoint,  bool isClockwise )

 

http://docs.autodesk.com/CIV3D/2014/ENU/API_Reference_Guide/html/58c5b585-6744-f5e2-1fb1-274ec5d57cd...

 

Thanks,



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Message 5 of 5
ryarmak
in reply to: Partha.Sarkar

I've been looking into those, the only one I could find that actually has a chance to make the exact 3 point curve from the information able to be gotten from an existing 3 point curve I believe is the Point3d, Vector3d, Point3d one that has the starting direction along with start and end passthrough points.  Except I failed at making the Vector3d from the StartDirection property of another curve (which might mean that my private method that does that calculation might be flawed and will break... more testing required).

 

Just finished testing the previous suggestion of just using 0 as prevId, and it worked great.  Every alignment I tested (I'm using Isaac Rodriguez' test alignment drawing included with his Colibra library download, and it has a pile of alignments) worked using this method.  I was avoiding trying to require a previous entity id because it would have required overloading one of my semi-recursive commands that goes through to copy the AlignmentEntities and force some extra logic in places where I shouldn't really need it. 

 

Thanks again for the help everyone.

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

Post to forums  

Rail Community


Autodesk Design & Make Report