Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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))

Posted

You're more machine than ReMark, Lee. :shock:

 

What does

(lambda (x))

denote? :huh:

 

Cheers again dude!:wink:

Posted
You're more machine than ReMark, Lee. :shock:

 

What does

(lambda (x))

denote? :huh:

 

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

Posted

:huh: OkOk.. that all makes sense until

mapcar

:lol:

 

last definintion of the day, promise :oops:

 

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? :cute:

 

Z

Posted
You're more machine than ReMark, Lee. :shock:

 

What does

(lambda (x))

denote? :huh:

 

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...

Posted

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 :P

 

Z

Posted
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 :P

 

Z

 

Thats pretty much exactly the way I learnt :D

 

Lee

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...