×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Automatic sheet number from file name
4

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

RE: Automatic sheet number from file name

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

RE: Automatic sheet number from file name

(OP)
THANK YOU SPEEDCAD, BUT IT DOES NOT WORK
I COULDN'T LOAD IT.

RE: Automatic sheet number from file name

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

RE: Automatic sheet number from file name

This diesel formula may work to extract the first four  characters:

$(substr,$(getvar,dwgname),1,4)

RE: Automatic sheet number from file name

2
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources