VB: Is there a way to separate the filename from the title shownin SW?

  • Thread starter Thread starter Tobias Begalke
  • Start date Start date
T

Tobias Begalke

Hi everybody,

does anyone happen to know if the Solidworks VB-API provides a function
through which it's possible to separate the title of a part or assembly
from its actual filename? I have a set of files that already exist, some
possibly with identical names. When I import them into our EDM system,
the system gives every file a new unique name. I'd like to use that new
name whenever an engineer checks out a file but it would be desirable if
Solidworks used the original name in the model tree and window title.

I've looked into ModelDoc2::SetTitle2 but it only works with new files
that haven't been saved yet....any ideas?

Thanks a lot!
Tobias
 
through which it's possible to separate the title of a part or assembly
from its actual filename?

How about ModelDoc2.GetPathName? That will return the full filespec
of the document. Having the complete path lets you deal easily with
duplicate file names.

To strip off the pathname from the full filespec, check out the "Split"
function, using a "\" as a delimiter. The "Split" function is a VB/A function,
and should port just about anywhere.
 
Back
Top