Jump to content

Lisp to Alter Mapping


woodman78

Recommended Posts

I have a lisp to alter mapping that we use in the background of our drawings. It is quite slow and was wondering if anyone can offer any suggestions on how to improve.

 

Part of it explodes the block map tiles in order to set everything to bylayer. Can this be done without exploding which slows things down alot?

 

(defun c:osmap1 (/ pref ss)
 (vl-load-com)
 (setq pref "CCC_OSMAP_") ;; <<-- Prefix
 (vlax-for lay (vla-get-layers
                 (vla-get-ActiveDocument
                   (vlax-get-acad-object)))
   (if (/= "0" (vla-get-Name lay))
     (vla-put-name Lay
       (strcat pref (vla-get-Name lay)))))
(command "_-layer" "c" "253" "*" "")

(and (setq ss (ssget "X" (list (cons 0 "INSERT")))))
(command "explode" SS "")
(command "_change" "all" ""  "p" "color" "Bylayer" "")
(command "_-layer" "F" "CCC_OSMAP_BDY_SYM" "F" "CCC_OSMAP_HT_CTRL" "F" "CCC_OSMAP_ROADS_CTR" "F" "CCC_OSMAP_ROADS" "F" "CCC_OSMAP_POLE_SYMB" "F" "CCC_OSMAP_LEGEND" "")
(command "_-purge" "a" "*" "N")
(command "regenall")

 (princ))

 

Thanks.

Link to comment
Share on other sites

This would set all your Blocks entity's layers to ByLayer without exploding them .

And regen all after that.

 

(vlax-for x (vla-get-blocks
             (vla-get-activedocument (vlax-get-acad-object))
           )
 (vlax-for blks x
   (if (not (eq (vla-get-color blks) acByLayer))
     (vla-put-color blks acByLayer)
   )
 )
)

Tharwat

Link to comment
Share on other sites

Don't forget about the built in setbylayer command.

 

Not the best option for automation, but it's a very useful command to know. :wink:

Link to comment
Share on other sites

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