Has anyone seen a routine to create an osnap "to"? Like - "to" * . line to draw \ . \ * "start" \_ arbitrary object Starting at "start" draw a line or arc or pline at any angle "to" an arbitrary object. (Angle specified by snapangle or user's mouse.) And making it transparent and looking like an osnap so it can be used directly within a command. Command: Line [pick start] to [select the target object]. Perhaps some hints at where to look in the magic world of vlax? Or is this one of those things that need Basic or C++? rs
No. Nearest will override snapangle and orthomode. What could happen is: Command: LINE Start point: [select a point] Next point: TO [select a target] [a dashed vector extends from the "from" point through the mouse location to a target symbol on the target object. The vector and target symbol update dynamically as the mouse moves. User may now choose to select a guide point by clicking anywhere or by invoking an osnap on some other object, or may accept the snapangle and orthomode if they are on.] [The line is drawn between the START point and the target object in the direction indicated by the above methods.] Next point: [Line and polyline commands continue as normal] There's nothing exotic going on here; maybe some slick footwork extending the tracer line and showing the target on the "to" object. The part I need help with is making this all transparent while within a command -- like osnap. rs
I'm at a loss to understand what you mean by 'to an arbitrary object'. We do not osnap to objects, we osnap to points on objects. So, what do you mean by 'to an arbitrary object' ?
Ya got me there. So I just did. It is surely a thing of beauty. But I don't see how I can use it to project a line from a point at a specific angle to some object. Polar angles are too coarse. rs
Ok, right. I want to identify the point at which the angle I am using (say 23.57 degrees intersects the target object and then complete the line or pline to that point. Again, I know how to do that in a separate function (c:lineto()) I'd like to see if it could be done within a command just by typing "to." rs
No, I don't think so, but here's what I do. Draw the line at the desired angle to any point. Enable "Extension" and "Intersection" object snap. Then, grip edit the end of the line that should be on the arbitrary object, and follow the extension tracking vector to a point on the desired object, and when you see the "X for intersection then click, and you get what you want.
Bob, Regarding polar, try this. Notice as you draw the line, it only polar snaps to the input angle. You can also use otrack to acquire points. They can be used in conjunction with the single polar angle to establish projected snap points. That's useful if the line at the chosen angle doesn't intersect the object in question. Joe Burke ;; 4/24/2004 - demo polar tracking at input angle only ;; otrack is on (defun c:demo ( / osm polang polmode poladd angstr ) (setq osm (getvar "osmode")) (setq polang (getvar "polarang")) (setq polmode (getvar "polarmode")) (setq poladd (getvar "polaraddang")) (setq angstr (rtos (getreal "\nEnter polar angle in degrees: ") 2 6)) (setvar "osmode" 32) ;intersection (setvar "polarang" 0) ;no polar angles other than addang (setvar "polarmode" 4) (setvar "polaraddang" angstr) (command "line" pause pause "") (setvar "osmode" osm) (setvar "polarang" polang) (setvar "polarmode" polmode) (setvar "polaraddang" poladd) (princ) )
Hmm... looks like I need to deal with the AUTOSNAP sys var too. Revised demo: ;; 4/25/2004 - demo polar tracking at input angle only (defun c:demo ( / auto osm polang polmode poladd angstr ) (setq auto (getvar "autosnap")) (setq osm (getvar "osmode")) (setq polang (getvar "polarang")) (setq polmode (getvar "polarmode")) (setq poladd (getvar "polaraddang")) (setq angstr (rtos (getreal "\nEnter tracking angle: ") 2 6)) (setvar "autosnap" 29) ;AS marker on, AS magnet on, polar on, otrack on (setvar "osmode" 32) ;intersection (setvar "polarang" 0) ;no polar angles other than addang (setvar "polarmode" 4) (setvar "polaraddang" angstr) (command "line" pause pause "") (setvar "autosnap" auto) (setvar "osmode" osm) (setvar "polarang" polang) (setvar "polarmode" polmode) (setvar "polaraddang" poladd) (princ) )
Similar solution to what I use, only because I'm lazy and it's a relative angle I use copyrot to copy the object line to the start point and input the angle, then grip/otrack/int. -- Jamie Duncan "How wrong it is for a woman to expect the man to build the world she wants, rather than to create it herself." - Anais Nin (1903-1977)
;;Quick and dirty - off to church.. ;;Example: Line <pick> 'to <pick> <select> (defun c:to ( / p1 p2 ent ei) ;;D.C. Broad - Informal implementation of "to" snap. ;;4/25/04 (setq p1 (getvar "lastpoint")) (setq p2 (getpoint p1 "\nPick direction: ")) (command p2 "") (setq ent (nentsel "\nSelect object: ")) (command "extend" ent "" p2 "") (setq ei (entget (entlast))) (setq p2 (cdr(assoc 11 ei))) (command "line" p2) (princ) )
Thank you all! Here's my humble workaround: (defun c:lt( / p1 p2 ang target osm ) ;line to. Follow ortho or get a guide point. (setq osm(getvar "osmode")) (setvar "osmode" 0) (setq p1(getpoint "\nStart point: ")) (setq ang (getangle p1 "\nPick or type an angle: ")) (setq target(entsel "\nTarget object: ")) (setq p2 (polar p1 ang 0.00001)) (command "line" p1 p2 "") (command "extend" target "" p2 "") (setvar "osmode" osm) (princ)) rs