Automatic sheet number from file name
Automatic sheet number from file name
(OP)
I want to automaticly add to my dwgs. the sheet number from the FILE NAME, to save time and avoid errors. e.g. (My file name is: A-01-SITE PLAN.dwg. From that name I only want to take "A-01" to add it to the title block. I found a diesel formula but it works backwards, here is the formula: $(UPPER,$(SUBSTR,$(getvar, "dwgname"),1,$(-,$(STRLEN,($(GETVAR,"DWGNAME"))),19))) this subtract starting from the end so you need to have 17 caracters to go to the first one. I don't want to substract. I would like to add the first 4 caracters only. Do you know how?
your help will be appreciated!!
thanks!
Anabel
your help will be appreciated!!
thanks!
Anabel





RE: Automatic sheet number from file name
With this routine tendras the 4 first characters of the name of the file...
(defun nombre-dwg ()
(setq n-dwg (getvar "dwgname"))
(setq nombre-bloque
(strcase (substr n-dwg 1 4))
)
)
If you need something more, you warn to me...
Un saludo de SpeedCAD... :)
CHILE
RE: Automatic sheet number from file name
I COULDN'T LOAD IT.
RE: Automatic sheet number from file name
It copies the code soon and it guards in block of notes. You must keep it with the extension *.lsp. In AutoCAD it loads with the commando _appload and soon in the line of commandos of AutoCAD you write (nombre-dwg) and enter, and soon you write in the line of commandos of AutoCAD
!nombre-bloque
RE: Automatic sheet number from file name
$(substr,$(getvar,dwgname),1,4)
RE: Automatic sheet number from file name
The diesel formula should really be
(substr (getvar "dwgname") 1 4)
Just copy the above to the command line of Autocad and execute (enter button). This should return with the first four characters of the drawing name.
Hope this satisfies you
MPSAJU