Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Automatic sheet number from file name 4

Status
Not open for further replies.

5220

Computer
Jun 24, 2003
3
0
0
US
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
 
Replies continue below

Recommended for you

Hi...

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
 
Hi...

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

 
duck0601
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
 
Status
Not open for further replies.
Back
Top