Does any one know how to call the 'p transparent command inside the following rountine? :
(defun c:asd( / p1 p2)
(setq p1 (getpoint "\nStart point: "))
(while (not p2)
(setq p2 (getpoint p1 "\nSecond point: "))
(if p2
(progn
(command "_pline" p1 p2 "'p" p2 p1 "" "") <== How to perform a pan function here?
(setq p1 p2 p2 nil)
)
)
)
)
Rosa Hsiao
I can imagine circumstances, if you start off close enough to an edge of the
screen area, under which you might not have room to draw the next segment in
the direction you want to go. Consider Zoom Center instead:
....
(progn
(command "_pline" p1 p2 "")
(command "-zoom" "c" p2 "")
(setq p1 p2 p2 nil)
)
....
which will put your latest point in the center of the screen.
(By the way, if you're ending the pline command for each segment, you may as
well use ordinary lines.)
If you don't want to end the pline with each segment, I tried typing in a
transparent hyphen-pan in mid-command, and hope the same would work inside a
(command) function. If so, this might do it, unless there's some
prohibition against starting a (command) function when in mid-command (i.e.
not at the Command: prompt):
....
(if p2
(progn
(command "_pline" p1 p2 "'-pan" p2 p1)
(setq p1 p2 p2 nil)
)
....
Typing '-pan works, but -'pan does not.
Kent Cooper, AIA
"bm01" wrote...
Of course you can't do it quite this way, because after you pan, you just
want to give it another point, not call up the pline command again, since
you should already be in it. You'd have to start pline earlier, then have
this part of it simply take a new p2 and pan (or zoom c).
(By the way, in your original code, you probably want to prompt for the
"Next point: " rather than the "Second point: ".)
Kent Cooper, AIA
"Kent Cooper, AIA" wrote...
> ....
You don't actually have to be drawing an actual pline to have the final
product be a pline, just creatively program for display and final result. :)
"Kent Cooper, AIA" <kco...@schwamarchitects.com> wrote in message
news:40c85a06_1@newsprd01...
(defun c:asd( / p1 p2)
(setq p1 (getpoint "\nStart point: "))
(command "_pline" p1)
(while (not p2)
(setq p2 (getpoint p1 "\nNext point: "))
(if p2
(progn
(command "'-pan" p2 p1)
(setq p1 p2 p2 nil)
)
)
)
)
Since, as I recall, (setq) returns the last value that it set, this might
feed in a "nil" to the Pline command where it's looking for a next point.
Whether that's going to end the command, I'm not sure -- I'll let you try it
out. If it does, this might get around it:
(defun c:asd( / p1 p2 temppt)
(setq p1 (getpoint "\nStart point: "))
(command "_pline" p1)
(while (not p2)
(setq p2 (getpoint p1 "\nNext point: "))
(if p2
(progn
(command "'-pan" p2 p1)
(setq p1 p2 p2 nil temppt p1)
(command "u")
)
)
)
)
That lets the (setq) line return an actual point (which could be anything --
0,0, or whatever, but I put in a point that already exists in the routine),
so maybe Pline will still be running. Then it undoes that last temporary
pline segment and (I hope) leaves the command awaiting a next point again.
I have no time right now to try it all out myself....
Kent Cooper, AIA
"Kent Cooper, AIA" wrote...
> ....
> You'd have to start pline earlier, then have
> this part of it simply take a new p2 and pan (or zoom c).
> ....
Here is a rendition that works, but you don't have the Close option you do
with pline. Just have to add in a method for accepting a 'c' and closing
the polyline if that's the desired result.
(defun c:asd( / p1 p2 pset lset)
(setq lset (ssadd))
(setq p1 (getpoint "\nStart point: "))
(setq pset (list p1))
(setq p2 (getpoint p1 "\nNext point: "))
(setq pset (cons p2 pset))
(command "_line" p1 p2 "")
(ssadd (entlast) lset)
(command "_pan" p2 p1)
(while (/= p2 NIL)
(setq p1 p2)
(setq p2 (getpoint p1 "\nNext Point: "))
(if p2 (setq pset (cons p2 pset)))
(command "_line" p1 p2 "")
(ssadd (entlast) lset)
(command "_pan" p2 p1)
);while
(command ".erase" lset "")
(command ".pline")
(foreach pt pset
(command pt)
)
(command "")
);defun
"Kent Cooper, AIA" <kco...@schwamarchitects.com> wrote in message
news:40c9b1ce$1_1@newsprd01...
I have tested your routine and it really works for me,except that I don't have the Close/Undo option as I usually do with pline + 'pan transparent command. But it does solve most of of my problem. Thanks for all your help.
Rosa
"Jason Wilder" <jas...@no.email> 撰寫於郵件 news:40c9d69e$1_1@newsprd01...
Bob