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.

Answer
 
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....
http://forums.autodesk.com/t5/Autodesk-Inventor-General/iLogic-Path-amp-File-name-of-model-from-within-an-IDW/m-p/3351121#M427367

do check out this site for vb path class command - options
http://msdn.microsoft.com/en-us/library/System.io.Path.aspx

 
Comments 0

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

Regards

 
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
InventorVb.DocumentUpdate()

 
Comments 0