DocumentName without extension?


(Declan Halpin) #1

Hi, I’m renaming a group of objects with DocumentName + Date + Time and I’d like to remove .3dm from the DocumentName before adding Date & Time. Could anyone advise, please?

I’m a total newb, obv.

This would be for RhinoScript, btw, not python.

TIA


#2

Hi @declan, does this help:

Option Explicit

Call Main()
Sub Main()

    Dim strDocName, strNameOnly, fso
        
    strDocName = Rhino.DocumentName()
    If IsNull(strDocName) Then Exit Sub
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    strNameOnly = fso.GetBaseName(strDocName)
    
    Rhino.Print strNameOnly

End Sub

_
c.


(Declan Halpin) #3

Thanks Clement! (& @Dale)