Hi
in attached file i have numbers of block with attribute that has 4 tags 1-code 2- Height( level or Z ) 3-alpha desc 4-point number.
the blocks were inserted in wrong location so i had to move the blocks to correct location so the value of height are not correct i need a lisp to chenge the value of the hieght tag base of insert point of block . appreciate it if sombody can help me.
Solved! Go to Solution.
Solved by 3wood. Go to Solution.
Solved by hmsilva. Go to Solution.
Solved by paullimapa. Go to Solution.
Try the attached no error checking lisp function CZ.lsp
It will find all blocks matching name CROSS2 and replace the 2nd Attribute which is the Height tag with the Field value that matches with the current inserted Z elevation of the block.
Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator | Layer Apps | List on Steroids | VP Zoom Scales
Exchange App Store
Hi toomohdi,
a different approach from the solution provided by Paul Li, just to change the attribute value to the 'z' value from the block insertion point
(vl-load-com) (defun c:demo (/ attlst i obj pt ss val) (if (setq ss (ssget "_X" '((0 . "INSERT") (2 . "CROSS2") (66 . 1)))) (repeat (setq i (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq i (1- i)))) pt (vlax-get obj 'InsertionPoint) val (rtos (last pt) 2 3) attlst (vlax-invoke obj 'GetAttributes) ) (foreach a attlst (if (= (vla-get-TagString a) "Height") (vla-put-TextString a val) ) ) ) ) (princ) )
Hope that helps
Henrique
Actually you only need to add 100 to all height attributes.
Just try attached ALTEXT.vlx and settings as below, select "2" (the 2nd attribute) to change when it prompts: "hich attribute to be changed (Enter 0 to search attribute tag name): Attribute No.<1>:"
I also attached the fixed drawing for your information.
thanks Paul Li,
the lisp run perfectly but change the height values to ####.
That's strange....what version of AutoCAD are you running and are you running on Windows 7 32bit or 64bit?
Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator | Layer Apps | List on Steroids | VP Zoom Scales
Exchange App Store
3wood
thanks you are right i did chenge location of the blocks by 100 meter in height just to create DWG file for this qustion in my case the value is not consistants so best way is to use insert point of the blocks.thanks a lot for your time .appreciate all.
i did try it in autocad 2009 on windows 7 32 bit at home .i would like to be able work with 2015 and win 7 64 bit.is it possible.
Try this modified version which checks for 32bit vs 64bit operating system
Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator | Layer Apps | List on Steroids | VP Zoom Scales
Exchange App Store
yes now it is working it just give i digit after dot. 204.2 how can i modify it to give 3 digits after dot.
is it possible to make it select all block on the drawing insted of "CROSS2"i mean edit any type of shape comes in Tag 2. becous most of time we have deferent block in drawing that has to edit.
I've modified & placed comments in the code showing:
1. change that allows for selection of all Blocks with Attributes
2. where & how to adjust decimal precision
Note: This only works on Blocks with more than 1 Attribute and will always place the Field linking the z insertion point on the 2nd Attribute. The routine will fail if it runs into a Block with only 1 Attribute
Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator | Layer Apps | List on Steroids | VP Zoom Scales
Exchange App Store
is it possible to modify your lisp to select all blocks in drawing no mater what kind of block is in Tag 2 we have,cercle,triangle,ractangle,CROSS1 and ..........
Paul Li
thanks alot ,i will try it sunday at work in my office .you have been very helpfull.thanks.
As I stated previously the current routine will work on all Blocks and will always replace the 2nd Attribute value regardless of the Tag name.
Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator | Layer Apps | List on Steroids | VP Zoom Scales
Exchange App Store
You are welcome.
Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator | Layer Apps | List on Steroids | VP Zoom Scales
Exchange App Store
Paul Li
sorry again I noticed that now height Tag is highlighted with white color how can i fix it.
To set the second attribute to block's Z value, just save following code as a lsp file, then select "Use formula" option in ALTEXT (updated as attached) to use it.
;;; This is an example formula for ALTEXT.vlx (defun ALTEXT_FORMULA () (if ALTEXT_BLK_ENT (rtos (cadddr (assoc 10 ALTEXT_BLK_ENT)) 2 3) ;Refer to rtos usage to change unit mode & precision. ) )
Can't find what you're looking for? Ask the community or share your knowledge.