Macro - Part.GetTitle in Drawings
Macro - Part.GetTitle in Drawings
(OP)
IModelDoc2.GetTitle
When issued in drawings, it returns the sheet info:
ie. CW201AM - Sheet1
I want to rip just the filename:
CW201AM.slddrw -> CW201AM
I am making a macro to SaveAs PDF and don't want to have to go back through later and strip out all of the "useless" info.
I was thinking of writing some code that would interpret where the first space is, but I don't like that idea incase my drawings do have a space in the filename.
Is there another function I can call?
When issued in drawings, it returns the sheet info:
ie. CW201AM - Sheet1
I want to rip just the filename:
CW201AM.slddrw -> CW201AM
I am making a macro to SaveAs PDF and don't want to have to go back through later and strip out all of the "useless" info.
I was thinking of writing some code that would interpret where the first space is, but I don't like that idea incase my drawings do have a space in the filename.
Is there another function I can call?
Devon Murray, EIT [Mechanical]
Solidworks 2011 SP 2.0






RE: Macro - Part.GetTitle in Drawings
CODE
Dim name As String
name = fs.GetBaseName(document.GetPathName)
where document is your object of type IModelDoc2. The GetBaseName method extracts the file name (without extension) from the full path returned by IModelDoc2.GetPathName.
Eric
RE: Macro - Part.GetTitle in Drawings
http:
http://
http://
Deepak Gupta
SW 2010 SP4.0 & 2011 SP1.0
DriveWorks Pro 7 SP5
Boxer's SolidWorks™ Blog