TheSwamp

Code Red => .NET => Topic started by: Bryco on April 26, 2008, 05:47:14 PM

Title: Picking a point on a specified angle.
Post by: Bryco on April 26, 2008, 05:47:14 PM
I'm converting a ref section function from vba and I would like to improve it a little.
Making and inserting the bubble block with a jig is done.
Making and inserting the arrow and tail blocks is done.
Rotating the arrow and tail with a jig is done.
Now I need to get the user to pick a point to place the tail on the chosen angle.
In vba I used  "POLARADDANG" to set the angle ("AutoSnap", 8 and "polarmode", 6) so the user would have a visible line to pick a point on.
This worked well but an escape could leave settings messed up.
Is there a better method in C#?
I'll start looking at a jig for moving the tail along the angle.
Title: Re: Picking a point on a specified angle.
Post by: Kerry on April 26, 2008, 07:45:02 PM
Bryco,
I've used a similar functionality from Lisp .. but haven't attempted to translate it to C# yet.
I can't think of anything built in that will make the project easier.

The ESC/CANCEL would need to be trapped in the getpoint Prompt and variables restored [perhaps using a presaved list from a finally statement]

Sounds like a fun project.
Title: Re: Picking a point on a specified angle.
Post by: Bryco on April 26, 2008, 09:54:37 PM
Thanks for the reply Kerry.
I sure am glad there's so much maths on tap with C#.
Block rotation is a tricky beast, the following is working well
CoordinateSystem3d Cs = ucs.CoordinateSystem3d;
 Plane Pn = new Plane(Cs.Origin, N);
 double AngOnPlane = Cs.Xaxis.AngleOnPlane(Pn);
 br.Rotation = br.Rotation + AngOnPlane;
Title: Re: Picking a point on a specified angle.
Post by: Bryco on April 29, 2008, 02:07:11 PM
A jig does the job fine. Using a closest  point on line function, the blockref moves along the line perp to the mouse. No need to set variables.