Search the Community
Showing results for tags 'autocad lisp'.
-
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:
-
Hi everyone, we have already placed a block object in multiple locations. Now we need the same block in a converter rectangle array format. Is there any idea or Lisp program available?ilable
-
Hello, I need help regarding to change the linetype scale of every line on a certain layer based on its individual length. Thank you.
-
how to do the automatically offset in between two lines offset centerline for all
amarendra posted a topic in AutoLISP, Visual LISP & DCL
Hello Dear Friends, how to do the automatically offset in between two lines offset centerline for all. kindly find the attached for sample image with drawing. if anyone knows lisp please help me. I am using AutoCAD 2017 Thanks Amarendra HVAC sample Offset.dwg -
Dear All, I am completely new to autocad programming and want to take professional help or advice for getting the following task completed : 1. Import dxf file 2. Assign measurement data to premitives for tolerance. 3. Import point cloud. 4. Orient point cloud on cad entities. 5. Verify the dimension and generate deviation map 6. Generate inspection report. If someone can help me with this lisp code it will be of great help. Thanks in advance.
-
Hi everybody I have few question about AutoLISP. before that, I would like to write few lines about my AutoCAD-related skills. I can use 2D CAD almost perfectly and I know some basic features of 3D. I know how to use excel or simply note pad to create lines of texts containing CAD command and use it in AutoCAD. but I don't know LISP at all. these are my questions: 1- As far as I know there is a unlimited works can be done by LISP, so I am wondering why there is not any complete website that provides and offers LISP programs! (I mean both free website and online AutoLISP shop) 2- I live in Iran and I want to know about using LISP prog in west countries. I want to know how you western people use this AutoCAD feature! 3- how much time it takes for me to learn this programming language? Thank you