Jump to content

Filename update modification


Recommended Posts

Posted

With respect to ACADE2010 I have a custom titleblock with various attributes mapped for auto updating and it works fine.

 

However prior to using 2010 Electrical, we used to manually suffix a revision code (two digits) to the filename, so that archived files can readily be recognised. Problem is, that ACADE puts the full filename (including the revision digits) into the filename attribute, and we already have a revision section elsewhere.

 

Having the revion in the filename IS handy (nothing worse than having to open a file to see what revisio it is), so I was wondering if it is updated using a lisp file, and could it be modified to suppress the last 6 digits before assigning the value to the filename attribute? :unsure:

 

Any thoughts woud be appreciated.

Posted

You can rename files in VL, using vl-file-rename if you like, or using the FileSystemObject (FSO)

Posted

I'd like to do it automatically, at the moment it already removed the .dwg from the filename, so it should be a case of removing a little more.

I suppose it will also depend on whether its checking for text (".dwg") or a set number of chars?

Posted

How many characters do you want removed and from which end?

 

Or, is there a string to search for in the filename?

Posted

We normally use "-rev00" suffixed to filename, (e.g. 4532_JDHGFHJGF_-rev00) in order for published files to be instantly recognised without opening them, but when doing a global update this whole string is then placed into the filename attribute in the title block i.e. showing the revision part as well. Problem is that the titleblock already has a section for revision data. It seems autoCAD already removes the .dwg from the filename, so could it be modified to removed more?

Posted

Ah, so you don't want to rename the files, just alter how AutoCAD updates your titleblock right?

 

OK,

 

You can get the filename in one of two ways (and maybe other ways)

 

(getvar 'DWGNAME)

 

(vla-get-name
 (vla-get-ActiveDocument
   (vlax-get-acad-object)))

 

So you can now use substr to remove what you like :)

 

(substr (setq Nme (getvar 'DWGNAME)) (- (strlen Nme) 4))

Posted

Do you think it would be possible to modify the existing code that removes the 'dwg? so that it removes more characters?

Posted

Not yet, but I'll have a search for the DCL that produces the update window (if its getable) & see where it leads me, I thought somebody in the 'know' may just know the name of the file, or tell me it cant be done....I don't mind thaving a trawl...you never know what you might find :)

 

I don't mind having a crack at the lisp, (although I'm a novice) nothing ventured nothing gained :D & if I can't find any usable files I'll attempt the code bit.

 

It would have been nice to get it to work properly.......well as I want it that is.

 

Regards

LL

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...