PDA

View Full Version : Multiple Point



erona
24th May 2005, 04:20 am
Hi there lisp gods,

I wanted to create a lisp that can invoke the multiple point command without using the pull down menus. I know that this starts with MULTIPLE then followed by POINT to work. I do not have enough powers to write the correct routine for this one. Below is what I have so far. It only allowed me to create one point and not multiple points which I wanted.


(defun c:mp () (command "multiple" "point" ))

Thanks for your help in advance...

CarlB
24th May 2005, 06:43 am
That code looks OK to me , how did you try to insert points following that? This should work:

(command "multiple" "point")
(foreach x (list pt1 pt2 pt3 pt4)
(command x)
)
(command);to cancel the point command

instead of the 'foreach' you could use (apply 'command (list of points))

CarlB
24th May 2005, 06:55 am
Re-reading your post, I think I got off track...you are entering points from the normal AutoCAD interface, no? So something like:

(defun c:mp ()
(command "multiple" "point")
(while (> (getvar "cmdactive") 0)
(command pause);pause for single user input
);while
(command);cancel
(princ);quiet exit
);defun

---or----

(defun c:mp ()
(setvar "cmdecho" 0)
(while (setq Pt (getpoint "\nEnter point: ")
(command "point" Pt)
);while
(princ)
);

erona
24th May 2005, 07:31 am
Yep, you were right.

I used both of routines you previously posted but they just allowed me to create one point too. :?

This sounds so simple but I can't get it to work. I'm not much of a lisp person. :(

CarlB
24th May 2005, 05:37 pm
erona,

You're right, this syntax doesn't work. Apparently the "multiple" commands work differently than the native AutoCAD commands when used in lisp code. The second method I posted would work if I had watched my parentheses. Try this:



(defun c:mp ()
(setvar "cmdecho" 0)
(while (setq Pt (getpoint "\nEnter point: "))
(command "point" Pt)
);while
(princ)
);

erona
25th May 2005, 06:18 am
Wow! Thanks CarlB! :shock:

Works perfectly the way I wanted it. :D

I must say, this works better than AutoCAD's Multiple Point feature.