Author Topic: Picking a point on a specified angle.  (Read 1976 times)

0 Members and 1 Guest are viewing this topic.

Bryco

  • Water Moccasin
  • Posts: 1883
Picking a point on a specified angle.
« 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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Picking a point on a specified angle.
« Reply #1 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.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Picking a point on a specified angle.
« Reply #2 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;

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Picking a point on a specified angle.
« Reply #3 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.