Zorg Posted June 4, 2009 Posted June 4, 2009 How do i create a LISP so that my polylines linetype will set to 'DOT' then the command line prompt me for a Global Width. This is basically for converting more than 1000+ polylines to show a more detailed route of flexible ductwork. From what i understand this should be quite simple to create, it would benefit me massivley and is probably a good one for someone un experienced like myself to make. I just need some guidance & explination of varibles ect. Cheers guys. All help welcomed. Rergards, Z Quote
Freerefill Posted June 4, 2009 Posted June 4, 2009 You could do a command-line-cop-out and write a very simple LISP using (command "chprop"). The hard part would be creating your selection set, that is to say, determining what polylines need to be altered. Quote
Lee Mac Posted June 4, 2009 Posted June 4, 2009 No error trapping but: (defun c:plyupd (/ ss wid ply) (vl-load-com) (if (and (setq ss (ssget "_X" '((0 . "*POLYLINE")))) (not (initget 5)) (setq wid (getreal "\nSpecify Global Width: "))) (progn (setq ply (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss)))) (mapcar (function (lambda (x) (vla-put-ConstantWidth x wid))) ply) (mapcar (function (lambda (x) (vla-put-linetype x "DOT"))) ply))) (princ)) Quote
Zorg Posted June 4, 2009 Author Posted June 4, 2009 You're more machine than ReMark, Lee. What does (lambda (x)) denote? Cheers again dude!:wink: Quote
Lee Mac Posted June 4, 2009 Posted June 4, 2009 You're more machine than ReMark, Lee. What does (lambda (x)) denote? Cheers again dude!:wink: That denotes an anonymous function that I am applying to every member in the supplied list through mapcar. Happy to help out mate, Lee Quote
Zorg Posted June 4, 2009 Author Posted June 4, 2009 OkOk.. that all makes sense until mapcar last definintion of the day, promise Also, is there a way so that the command line will remember my last input when specifying global width and use that upon hitting return/right click? Oh, and set layer? Z Quote
Lee Mac Posted June 4, 2009 Posted June 4, 2009 You're more machine than ReMark, Lee. What does (lambda (x)) denote? Cheers again dude!:wink: Mapcar will apply a function to every member of a list and return a list of the results... all this is in the Visual LISP help in ACAD you know... (defun c:plyupd (/ ss wid ply) (vl-load-com) (or *wid* (setq *wid* 1)) (if (and (setq ss (ssget "_X" '((0 . "*POLYLINE")))) (not (initget 4)) (setq wid (getreal (strcat "\nSpecify Global Width <" (rtos *wid*) ">: ")))) (progn (or (not wid) (setq *wid* wid)) (setq ply (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss)))) (mapcar (function (lambda (x) (vla-put-ConstantWidth x *wid*))) ply) (mapcar (function (lambda (x) (vla-put-linetype x "DOT"))) ply))) (princ)) ^^ there you are... Quote
Zorg Posted June 4, 2009 Author Posted June 4, 2009 NiceyNicey! I'm learning.. but slow :\ I'm more studying what LISPs you've wrote upon request and breaking them down into things i can use and trying to apply them to my own experiments Z Quote
Lee Mac Posted June 4, 2009 Posted June 4, 2009 NiceyNicey! I'm learning.. but slow :\ I'm more studying what LISPs you've wrote upon request and breaking them down into things i can use and trying to apply them to my own experiments Z Thats pretty much exactly the way I learnt Lee Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.