Get date from a custom property

I'm trying to get the custom property of Date Drawn from the custom properties.  The date is in there are as a type of "date".  How do I extract that data?

I use the command:

PrpValModDate as String

PrpValModDate = swModel.CustomInfo2("", "ModeledDate")

But the date is coming up blank.

Any thoughts would be appreciated.

Thanks,

Tom

SolidworksApi macros
Answers 1
KR
KR 2012-04-18 Best Answer

Tom,

IModelDoc2::CustomInfo2 is obsolete and you have better options available.  Use ICustomPropertyManager::Get4 to get the custom property non-evaluated or evaluated value.

=====

Dim swApp As SldWorks.SldWorks

Dim swModel As ModelDoc2

Dim swCustProp As CustomPropertyManager

Dim val As String

Dim valout As String

Dim bool As Boolean

Sub main()

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swCustProp = swModel.Extension.CustomPropertyManager(Empty)

    bool = swCustProp.Get4("Date Drawn", True, val, valout)

    Debug.Print "Value: " & val

    Debug.Print "Evaluated value: " & valout

End Sub

=====

Keith

Video Tutorials for the SolidWorks API