Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/20/2024 in all areas

  1. (defun C:spool_labels ( / prefix cnt oldclayer oldattdia oldattreq pt) (setq prefix (getstring t "\nENTER PREFIX: ") cnt (getint "\nENTER INTEGER TO START: ") ;; want the program to figure this out oldclayer (getvar 'clayer) oldattdia (getvar 'attdia) oldattreq (getvar 'attreq) ) ;; Turn dialog off for the attributes (setvar 'attdia 0) (setvar 'attreq 1) ;; Create layer for the blocks to be inserted on (command "-layer" "make" "Blocks-Spool Label" "color" "magenta" "" "") (while (setq pt (getpoint "\nPICK INSERTION POINT: ")) ;; get insertion point for block (command ".-insert" ;; command to insert a dynamic block "_MDP-Label-Spool" ;; name of block to insert "_non" pt ;; insertion point for block "1" ;; x scale value for the block "0" ;; rotation value for the block ;; concatenate the prefix to the counter for the name (strcase (strcat prefix "#" (itoa cnt))) ) ;; increment the counter (setq cnt (1+ cnt)) ) ;; restore change system values (setvar 'clayer oldclayer) (setvar 'attdia oldattdia) (setvar 'attreq oldattreq) (princ) ) The above code is what I am working on. @devitg After looking a my question again. Notice I was very vague. Sorry about that. @BIGAL I like that train of thought. The end goal is, I want to be able to select an attribute in a block or type in to get the prefix value. Then repeat inserting blocks with new values. If the prefix was typed and not found on the current tab start inserting block with <prefix> # 1 If the prefix was typed and found on the current tab start inserting block with <prefix> # <next number> If attribute is selected start inserting block with <prefix in attribute> # <next number> I think I need the logic of setting the cnt variable before entering the while loop. Thank you for your time and knowledge. demo.dwg
    1 point
  2. Two other ways (command "LINE" p1 (mapcar '+ p1 (list 0.0 BM 0.0))) ; (list x y 0.0) (command "LINE" p1 (polar p1 (/ pi 2.) bm))
    1 point
  3. Do you need a LISP solution? You might look at the Reference Manager, it's in your Programs>AutoCAD folder. How to change Xref paths for multiple drawings in AutoCAD Products (autodesk.com)
    1 point
×
×
  • Create New...