Jump to content

Modify LISP for changing block attributes


hosannabizarre

Recommended Posts

I have a useful lisp routine for changing the attributes of text nested in blocks. It goes:

 

(defun c:ATR (/ com val)

(initget 1 "Height Angle Style Layer Color")

(setq com (getkword "\nEnter Command (Height/Angle/Style/Layer/Color): "))

(setq val (getstring "\nEnter Value: "))

(prompt "\nSelect Attributes by Crossing Window: ")

(command ".attedit" "y" "*" "*" "*" "c" pause pause)

(while (> (getvar "cmdactive") 0)

(command com val "n")

)

(princ)

)

 

How could I modify this such that the "Layer" option is automatically selected (instead of the user being prompted to pick an attribute to change).

 

How can I modify it further such that the value for the Layer name is automatically asigned to "LAYER_11".

 

With the end result that all the user has to do is drag out a box, which will change the layer attribute to "LAYER_11"

 

I'm sure there can't be much to achieving this.

 

Thanks,

 

hosannabizarre

Link to comment
Share on other sites

Figured it out:

 

(defun c:ATR (/ com val)

(initget 1 "Height Angle Style Layer Color")

(setq com "Layer")

(setq val "LAYER_11")

(prompt "\nSelect Attributes by Crossing Window: ")

(command ".attedit" "y" "*" "*" "*" "c" pause pause)

(while (> (getvar "cmdactive") 0)

(command com val "n")

)

(princ)

)

 

This is great for changing the layer attribute of blocks without actually using EATEDIT.

 

Just change "LAYER_11" to the name of the layer you want to change to.

 

Swipe an area and BAM! All the layers, even nested stuff, gets changed.

Link to comment
Share on other sites

  • 2 months later...

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