Can I include part of the name of a file in the custom properties?

Hello

In my company, the Solidworks file name is composed of the part number and the part name. Is it possible to embed the file name directly in my reference tab and description of my custom properties.

Kind regards

Maxence

I do it easily with the tools of the MyCADTools suite in addition to SolidWorks.

1 Like
 Sub AjoutePropriétés()

        lRetVal = swDoc.AddCustomInfo2("Description", 30, "")
        lRetVal = swDoc.AddCustomInfo2("PartNo", 30, "")

        PathName = swDoc.GetPathName
        FileName = Right(PathName, Len(PathName) - InStrRev(PathName, "\"))
        Ref = Left(FileName, 10)
        PieceExtension = Mid(FileName, 14)
        Piece = Left(PieceExtension, (Len(PieceExtension) - 7))

        swDoc.CustomInfo("Description") = Piece
        swDoc.CustomInfo("PartNo") = Ref

    End Sub

You can make a macro like that