Jump to content

lisp to clean architectural background for MEP design


mikey0615

Recommended Posts

Hi,

 

I would like to find a list that does below:

 

  • Set by layer
  • Laythw
  • Turn on all layer 
  • Turn all layer to color(8) grey
  • Remove all hatch.
  • Remove dimensions
  • Remove elevation tag
  • Remove section tag
  • remove window and door tag

 

Link to comment
Share on other sites

Can you upload a dwg with an example of each of these tags?  I'm not sure what you mean there

 

Anyway, here is most of your request.

Command CP (for Clean Plan).

You may need to press escape when the routine is done (I get a message "Hatch boundary associativity removed." on the command line)

 

;; TO DO:
  ;;Remove elevation tag
  ;;Remove section tag
  ;;remove window and door tag

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(vl-load-com)

(defun layer_change_color (layerName color / )
  (command "-LAYER" "_C"  color layerName "" )
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; CP for Clean Plan
(defun c:cp ( / ss i obj)
  ;; mute the command line
  (setvar "cmdecho" 0)

  ;;Laythw
  (command "Laythw")
  ;;Turn on all layer
  (command "-LAYER" "ON" "*" "")
  ;;Turn all layer to color(8) grey
  (layer_change_color "*" )
 
  ;;Remove all hatch.
  ;;Remove dimensions
  (setq ss (ssget "_X" (list (cons 0 "HATCH,DIMENSION") )))
  (setq i 0)
  (repeat (sslength ss)
    (entdel (ssname ss i))
    (setq i (+ i 1))
  )
 
  ;;Set all entities to ByLayer
  (setq ss (ssget "_X"))
  (setq i 0)
  (repeat (sslength ss)
    (setq obj (vlax-ename->vla-object (ssname ss i)))
    (vla-put-color obj 256); ByLayer
    (setq i (+ i 1))
  )
 
  ;; unmute the command line
  (setvar "cmdecho" 1)
 
  (princ "\nDone.  Please press escape.")
  (princ)
)

Edited by Emmanuel Delay
Link to comment
Share on other sites

Maybe a typo here we all do it, learnt something new today "laythw"

 


(layer_change_color "*" 

(layer_change_color "*"  8 )

Edited by BIGAL
Link to comment
Share on other sites

Here's my script file. Open in Notepad. Each line break is considered an Enter keystroke. Just so you can follow the logic. 

 

Also, the "SBL" I believe is a LISP routine, so that may break the script for anybody else. 

 

-TZ

BACKGROUND_v3.scr

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