I have to say Fatty's routine looks overly complicated. (For example, I
don't see why it needs both originally-orange lines, or sets the offset
distance by a comparison of all four distances between their endpoints, if
that's simply the length of its line3.) But one thing that was wrong in my
previous excerpt that's right in Fatty's is the use of (equal) instead of
(=). This only requires one pick, again assuming your stipulation that the
white line is the last thing drawn (tested in 2004, and also attached):
(defun C:CopyOut (/ lastline Aend1 Aend2 perpline Bend1 Bend2 osstart
Bnearend Bfarend)
(setq lastline (entget (entlast))
Aend1 (cdr (assoc 10 lastline))
Aend2 (cdr (assoc 11 lastline))
perpline (entget (car (entsel "Pick a line to copy last line away from:
")))
Bend1 (cdr (assoc 10 perpline))
Bend2 (cdr (assoc 11 perpline))
osstart (getvar "osmode")
); end setq
(setvar "osmode" 0)
(if
(or
(equal Aend1 Bend1 0.001)
(equal Aend2 Bend1 0.001)
)
(setq Bnearend Bend1 Bfarend Bend2)
(setq Bnearend Bend2 Bfarend Bend1)
); end if
(command "copy" "l" "" Aend1
(polar
Aend1
(angle Bfarend Bnearend)
(distance Aend1 Aend2)
); end polar
); end copy
(setvar "osmode" osstart)
); end defun
You can shorten the name as you like, and/or add other controls, or adjust
the fuzz factor in the (equal) functions, etc., etc.
--
Kent Cooper
"Kent Cooper" wrote...
Say the endpoints of the white line are Aend1 and Aend2, and the endpoints
of the orange line that the user selects are Bend1 and Bend2. Simple
version something like this:
(if
(or
(= Aend1 Bend1)
(= Aend2 Bend1)
)
(setq Bnearend Bend1 Bfarend Bend2)
(setq Bnearend Bend2 Bfarend Bend1)
); end if
(command "copy" "l" "" Aend1
(polar
Aend1
(angle Bfarend Bnearend)
(distance Aend1 Aend2)
)
); end copy
In English, if either end of the white line is the same as Bend1 of the
orange line, then that's the nearer end, and Bend2 is the farther end. If
not, it's the other way around. Then you copy the Last item from anyplace
(could be Aend2 instead of Aend1, or Bnearend, or 0,0, or whatever, as long
as the designation on either side of the word "polar" is the same), in the
direction from the far end to the near end of the orange line, by a distance
equal to the length of the white line.
You probably want to turn off Osnaps. You can get more sophisticated with
checking whether they actually picked something, etc. Only works when, as
you say, the white line is the last item drawn.
--
Kent Cooper
wrote...
well, i know how to get the endpoints using (cdr (assoc 11)) & (cdr (assoc
10)) but i dont know how to do the angle thing. so if u wouldnt mind, i
would appreciate the guidance.