How to use iLogic to return a filename?

I am having trouble using iLogic in a drawing template to retrieve the filename of the model (without the extension) for insertion in a title block and to use to populate the iProperties Part Number field.

Comments 0

5 Answers

Answering bit late, hoping it may be useful for some one who search answer for the same
Ilogic Command:
modelFullFileName = ThisDoc.ModelDocument.FullFileName
modelDirectoryName = IO.Path.GetDirectoryName(modelFullFileName)
modelFileName = IO.Path.GetFileName(modelFullFileName)
modelFileNamewithoutextentionsion = IO.Path.GetFileNameWithoutExtension(modelFullFileName)
MsgBox( modelFullFileName )
MsgBox( modelDirectoryName )
MsgBox( modelFileName )
MsgBox( modelFileNamewithoutextentionsion )

Note:I Got solution from the below forum.....
"IO.Path.GetFileNameWithoutExtension" will work for you....

do check out this site for vb path class command - options

Comments 0

Hi Lee,
Could you share your code to check it ???
or you still try to figure out what to write !!!


Comments 0

I am trying to leave the Part Number iProperty blank until a drawing is created at which point the Part Number automatically populates as the model filename minus the extension. The following code works, but I can't figure out how to drop the extension.

'Exit rule If no Part or Assembly Is in the drawing yet

If (ThisDrawing.ModelDocument Is Nothing) Then Return

'get the file name of the doc the drawing points to

modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)

iProperties.Value(modelName,"Project", "Part Number") = modelName

'update the drawing

Comments 0