displaying last part of project name in 2D titleblock

displaying last part of project name in 2D titleblock

Anonymous
Not applicable
344 Views
1 Reply
Message 1 of 2

displaying last part of project name in 2D titleblock

Anonymous
Not applicable

I alreaddy worked (thanks to someone else) to get the full project name automaticaly to display in the titleblock of my drawings but I only need the part of it that is inbetween parentheses. Example:

 

Projectname full: BEKAERT - TER BEKE - WAREGEM (BBCTBW)

Projectfile: BEKAERT - TER BEKE - WAREGEM (BBCTBW).ipj

Projectname to display in titleblock: BBCTBW

 

Code I was given to get the projectname and copy it to my iProperties:

 

Dim IPJ as String
Dim IPJ_Name As String
Dim IPJ_Path As String
Dim FNamePos As Long
'set a reference to the FileLocations object. 
IPJ = ThisApplication.FileLocations.FileLocationsFile
'get the location of the last backslash seperator 
FNamePos = InStrRev(IPJ, "\", -1)     
'get the project file name with the file extension
IPJ_Name = Right(IPJ, Len(IPJ) - FNamePos) 
'get the project name (without extension)
IPJ_ShortName = Left(IPJ_Name, Len(IPJ_Name) - 4)
'get the path of the folder containing the project file
IPJ_Folder_Location = Left(IPJ, Len(IPJ) - Len(IPJ_Name))

'Converts the project file name to UPPER CASE
IPJ_Shortname = UCase(IPJ_Shortname)

iProperties.Value("Project", "Project") = IPJ_Shortname

iLogicVb.UpdateWhenDone = True

How can I isolate the data inbeween parentheses?

 

Thanks so mutch in advance!

 

Beli

0 Likes
345 Views
1 Reply
Reply (1)
Message 2 of 2

drobbie
Advocate
Advocate

I updated your code a slight bit to search for the beginnning and ending parathesis and adjust the information that gets inserted to the Project Property field.

 

Dim IPJ As String
Dim IPJ_Name As String
Dim IPJ_Path As String
Dim FNamePos As Long
'set a reference to the FileLocations object.
IPJ = ThisApplication.FileLocations.FileLocationsFile
'get the location of the last backslash seperator
FNamePos = InStrRev(IPJ, "\", -1)
'get the project file name with the file extension
IPJ_Name = Right(IPJ, Len(IPJ) - FNamePos)
'get the project name (without extension)
IPJ_ShortName = Left(IPJ_Name, Len(IPJ_Name) - 4)
'get the path of the folder containing the project file
IPJ_Folder_Location = Left(IPJ, Len(IPJ) - Len(IPJ_Name))

'Converts the project file name to UPPER CASE
IPJ_ShortName = UCase(IPJ_ShortName)

'determine the location of the parethesis
IPJ_ShortName_Right = InStrRev(IPJ_ShortName, ")", -1)
IPJ_ShortName_Left = InStr(1, IPJ_ShortName, "(")

'Create the shorten version for use in the Titleblock
IPJ_Condensed = Mid(IPJ_ShortName, IPJ_ShortName_Left, IPJ_ShortName_Right - IPJ_ShortName_Left + 1)

iProperties.Value("Project", "Project") = IPJ_Condensed

 

 

 

 

Regards,

 

Douglas Robbie  

 

"When you focus on problems, you will have more problems. When you focus on possibilities, you'll have more opportunities." -- Harpreet Singh Batra