Search the Community
Showing results for tags 'attribute value'.
-
Hello, can anyone help me please with this topic? I have 9 layouts. I've inserted the same block to each layout. I want to change some attributes (the title of the drawing inside block) for each layout out of those 9. The Layout name is variable according to the number of project which I have at that moment (SCH 23-123_01 or SCH 23-125_01 for example), but the attribute values are always the same (for example "1 floor" for layout 1, and "section A-A" for layout 2 etc.) I'm newbie in AutoCAD LISP files, so I've tried something with ChatGPT, but it doesn't seems to work. (defun c:Updateattributes () ;; Define your block name and attribute tag (setq blockName "Pečat Marko Vukićević") (setq attributeTag "NAZIV CRTEŽA") ;; Define a list of attribute values corresponding to each layout (setq attributeValuesList '("OSNOVA JAME" "PRESECI VOZNOG OKNA" "OSNOVA VRHA VOZNOG OKNA I DETALJ MONTAŽNE KUKE" "DETALJ PRAGA VRATA" "TEHNIČKE SPECIFIKACIJE" "OSNOVA KABINE" "PRESECI OPREME I RASPORED KONZOLA" "PREGLED SIGURNOSNIH PROSTORA" "POGLED PRISTUPNIH STRANA")) ;; Start iterating through layouts (vlax-for (layout (vla-get-Layouts (vla-get-ActiveDocument (vlax-get-acad-object)))) (vla-activate layout) ;; Check if the block exists in the layout (if (tblsearch "Pečat Marko Vukićević" blockName) ;; If the block exists, update the attribute value (progn (vla-get-active (setq pspace (vla-get-ModelSpace layout))) (vlax-for obj (vla-get-Block pspace) (if (= blockName (vla-get-Name obj)) (progn ;; Find the attribute reference (vlax-for attrRef (vlax-invoke obj 'GetAttributes)) (if (= attributeTag (vla-get-TagString attrRef)) ;; Update the attribute value from the list (vla-put-TextString attrRef (pop attributeValuesList)) ) ) ) ) ) ) ) (princ "\nAttribute values updated for all layouts.") (princ) ) I've asked Chat GPT also if special characters like "č" "ć" "š" "ž" is possible to have in LISP, and I've got the positive answer, but I'm not sure that is true. Can someone please verify me this information as well? If someone has slightest idea in which direction I should go, It would mean a lot to me. Thanks in advance! P.S. In the attached file there is a sample of my drawings. Also I would like to rename another attribute inside block to be the same as the layout name, but that is on another level. Demo.dwg
- 14 replies
-
- lisp
- autocad lisp
-
(and 2 more)
Tagged with:
-
AutoLisp for deleting value of an attribute inside block of a block
pp2104 posted a topic in AutoLISP, Visual LISP & DCL
Hi! I am just new here and also a newbie in doing lisp routines. I was wondering if there is an autolisp that could possibly delete a text value of a specific attribute text inside a block of a block. I don't want to totally delete the attribute, just the value. I already tried several examples on the internet but doesn't really get to my satisfaction and as to how I want it to be. The only available lisp routine that I found so far is just yes, deleting the value but only works if the block attribute is outside the title block or even inside the title block itself but not when the attribute block is already inside a block of the title block. I need to do this for over 80 drawings and I was hoping to not doing it in an old fashioned way of opening each drawing just to edit-in-place the title block and then deleting the value of that attribute. Can anyone help me please? that would be very much appreciated. Thanks in advance.- 8 replies
-
- attribute value
- attribute blocks
- (and 3 more)
-
Hi all! I would like to give (notedit) a tag attribute value to existing multiple blocks. The attribute is defined as ‘SIGNCODE’ but the value of thisattribute is currently empty.Also I need to givedifferent values to the ‘SIGNCODE’ for multiple blocks in the same file. I am using AutoCAD 2013. The full story is: Due to my project’s requirements, I hadto add additional attributes to existing block. Now I need to fill the valuesof these additional attributes. Each value applies for more than one blocks in the file. Example: If my file contains 300 blocks I wouldlike to give a ‘EX3’ value to the ‘SIGNCODE’ for 100 blocks, a ‘FB’value to the ‘SIGNCODE’ for 50 blocks, and a ‘AE’ value to the sameattribute for the rest of the blocks in the file. PS: I checked older post ‘Editing the same attribute in multipleblocks at one time???’ but the ATTEDIT solution does not work in my case. Alsoselecting multiple blocks and then filling the properties pallet does not work as theblock attributes do not show in the properties.. Your help highly appreciated!
- 3 replies
-
- block attributes
- attribute value
-
(and 1 more)
Tagged with:
-
Reading Attribute value is being trimmed by empty space
Muthanna posted a topic in AutoLISP, Visual LISP & DCL
Hi everyone, I am a software developer , i program in C# C++ and Java, but lately i have been given a task to help out our engineering department to write some code + script to fix cad prints which they have issues with. our problem is we use a third party application which generates an AutoCad drawing. this third part application sets the dimscale to 1:000; But the drawing's title block scale attribute has has the correct scale value. My task was to write code in lisp and our script to automate this process; which will requires the program to read the value for the scale attribute and apply it to the drawing dimscale. after reading some tutorials and searching the web i cam across some functions that did most of my task...Thanks to this community and its forums. my main function that reads the attribute value i got from on of the threads as shown below: (defun c:AttLst (/ ss eLst bEnt aEnt aEntLst aVal blkLst) (vl-load-com) (if (setq ss (ssget "X" (list (cons 0 "INSERT") (cons 66 1) (if (getvar "CTAB") (cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (setq eLst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) (foreach e eLst (setq bEnt (cdr (assoc 2 (entget e))) aEnt (entnext e)) (while (= "ATTRIB" (cdr (assoc 0 (setq aEntLst (entget aEnt))))) (if (= (cdr (assoc 2 aEntLst)) "SCALE") (progn (setq aVal (cdr (assoc 1 aEntLst)) blkLst (cons (cons bEnt aVal) blkLst)))) (setq aEnt (entnext aEnt))))) (princ "\n<!> No Attributed Blocks Found <!>")) (alert (vl-princ-to-string blkLst)) (princ)) This function works great when the scale value has no white spaces; but when there is white spaces it only returns the right side of the scale value example 1 : SCALE 1:5 ==> Result = (( TitleBlockName. 1:5)) example 2 : SCALE 1 : 10 ==> Result = (( TitleBlockName. 1 : )) as you see in example 2 the return value is missing the right side value can you please help me with this issue to figure out why its returning the left side only?- 5 replies
-
- autolisp
- autocad2010
-
(and 2 more)
Tagged with:
-
Find and Select blocks that have certain attributes & Change colour in multple files
liamdonnelly0209 posted a topic in AutoLISP, Visual LISP & DCL
Hi All. I am trying to achieve the following: for example... in 100 floor plans there are blocks that have certain attribute values. i want to be able to create a script/lisp that will find all blocks that include a certain piece of text ie "window" in the attribute value and change the block to a certain colour. Essentially it is the same way that the "FIND" command works but via command line/lisp/script etc instead. This will be so i can apply this specific task without user input on the 100 floor plans. Is there a way to do this as ive searched hundreds of terms/forums/ideas etc and came up with only find and replace tools or change all text in a drawing to certain colour. Your help is greatly appreciated =] -
I am trying to simplify my companies current process of updating BOM. We currently type all part dimensions in an excel spread sheet to get the weight of different group of materials. I wanted to make a lisp that after changing one or many of the dimensions in the BOM blocks it would recalculate the weight, avoiding any typo errors when manually recalculating. Ideally it would compare the item number (eg "37014") and then multiply the 2 dimensions and quantity. Then add all of items and put the total in the bottom right block of that group (eg "753.5") I am not sure how to start this lisp any help will be greatly appreciated. all the blocks are called "97bill" and the attributes are "bubbleno" "qty" "material" "itemnumber" "total-units". Thanks
- 2 replies
-
- attribute value
- attribute blocks
-
(and 2 more)
Tagged with:
-
Morning Everyone, I've just won a fabulous project with a very well known supermarket producing phasing drawings for their new store fit-outs; I receive their drawings in DWG format with as you can imagine thousands of blocks detailing the shop fixtures. Each blocks contact a minimum of 5 attributes that they use for merchandising etc. This information is of no use to me what so ever and I would like to delete the information from the block as it messes up my phasing drawings making them illegible . Is there a lisp or any code that could remove all the attribute entry information (nothing else without resetting the block as they are mostly dynamic blocks) so I dont have to select each and every block to delete the information. I have tried freezing the attribute layer out of the drawing but this doesn't work due to not all the attributes being setup on the same layering standard . Look forward to hearing from you all Stenna
- 13 replies
-
- attribute value
- attribute edit
-
(and 1 more)
Tagged with:
-
Hi guys, I'm a new member as you can see, but i've been coming here for many years to find information about lisp. I've done a thread search and haven't located a solution to my issue. I am self taught, so there is only so far i can go without getting the experts involved. My question (i think) is very similar to this thread http://www.cadtutor.net/forum/showthread.php?31762-Need-help-extracting-attribute-values-in-Lisp What i need to do is: 1. Extract two attribute values (Tags are "DRGNO" "DRGREV") from an inserted block (Block name "DRG_SHEET.dwg"). 2. Build a string in the Command Line using those 2 values. It seems very simple, i just haven't fully wrapped my head around the list manipulation tools in AutoLISP. Any help would be greatly appreciated. Thanks, Scott.
- 2 replies
-
- lisp
- attribute value
-
(and 1 more)
Tagged with:
-
Can Attribute Values Change Visibility States
Alaskachick posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
The Question: Can Visibility States be changed by an Attribute Value instead of the drop down arrow? The Situation: I am building an annotative block that the user wants to change appearance (ie different hatches inside a circle) based on an attribute value (1,2 or 3). The attribute is invisible and is one of +/-40 other attributes. I can change the appearance with visibility states and the little pull-down arrow on the block or the properties menu, but the user wants to be able to change it with attribute value. Is this even possible?- 4 replies
-
- blocks
- attribute value
-
(and 1 more)
Tagged with: