I'm writing a macro that will populate a property with a property expression
Example: Custom Property "Material" = "SW-Material@Part2.SLDPRT"
Notice that the file is called "Part2.SLDPRT" because it is new and have not been saved.
From an API call, how do I get the value "Part2.SLDPRT"? Modeldoc.getpathname() will give empty string ""
If the user saves the file, my code will work because getpathname has a value. Do I have to make the user save first? If so, why. The use could do this through the interface and get the right value because SolidWorks "Knows" that the part is called Part2.SLDPRT". Does the API expose this?
Here is the basic code
Public Sub main() Dim swModel As ModelDoc2 swModel = swApp.ActiveDoc Dim strDocName As String = swModel.GetPathName Dim CheckWeight As String = """SW-Mass@" & strDocName & """" swModel.CustomInfo2("", "Weight") = CheckWeight End Sub How do I make this work if the file is new and not saved yet? Kent
