Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making LISP place "DWGMANE" into an attribute value?

Status
Not open for further replies.

ghlong

Specifier/Regulator
Jul 25, 2003
2
Hi everyone! I am returning to AutoCAD 2002, after working 13 yrs with MicroStation. Funny what one forgets about LISP when away for so long.

I am trying to write a routine that places sys vari "DWGNAME" into a block attribute value "DWG_NUMBER". DBOR2D.DWG is the name of the title block.

I am familiar with the old LISP from Release 10 and I am trying to relearn LISP with AutoCAD 2002. I have the extraction from the dwg file figured out...

(setq dn (substr (getvar "DWGNAME") 1 (-(strlen (getvar "DWGNAME")) 4)))

..but I am fighting with the proper code of inserting the dn variable into the "DWG_NUMBER" attribute.

Sorry for being long winded beginning this thread. I am not looking for actual code, but more confirmation it can be done with LISP and directions to references on how to do it.

Thanks in advance,
George
 
Replies continue below

Recommended for you

Hi...

(defun dwg-atributo (/ dn p-ins atributo)
(setq dn (substr (getvar "dwgname")
1
(- (strlen (getvar "dwgname")) 4)
)
) ;_setq
(if (not (tblsearch "block" dn))
(progn
(setq p-ins (cadr (grread 1)))
(vl-cmdf "_.-attdef" "" "DWG_NUMBER" "" dn p-ins 2.5 0)
(setq atributo (entlast))
(vl-cmdf "_.-block" dn p-ins atributo "")
(prompt "\nIndique punto de inserción: ")
(vl-cmdf "_.-insert" dn pause "" "" "")
) ;_progn
) ;_if
) ;_defun

(defun c:dwginsert ()
(setvar "cmdecho" 0)
(vl-cmdf "_.undo" "_begin")
(dwg-atributo)
(vl-cmdf "_.undo" "_end")
(setvar "cmdecho" 1)
(prin1)
) ;_defun

(prompt "\n*** nuevo comando DWGINSERT definido. ***")
(prin1)
 
SpeedCAD, thanks for the help! I guess I didn't specify my concern correctly.

The attribute "dwg_number" exists in a block, "dref2d". I just want to populate that existing attribute with the system var "DWGNAME".

George
 
How about using RTEXT
Command:rtext

Initializing...

Current settings: Style=SSF 2002-A Height=1 1/8" Rotation=0
Enter an option [Style/Height/Rotation/File/Diesel] <Diesel>: D

A empty dialog box will pop up.
Insert the following code into the dialog box.

$(getvar, &quot;dwgname&quot;)

Charles S. Parnell
Southern Store Fixtures
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor