AnsweredAssumed Answered

ePDM GetVar pulling old values??

Question asked by Danny Bradford on May 25, 2016
Latest reply on Jun 10, 2016 by Brandon Plubell

Greetings all,

We have code, seen below, that pulls the Revision of the Drawing. Since there is no object that actually represents the drawing we are pulling the value from a specific sheet. Since users have complete control of the Sheet names we are forced to check for "Sheet1" then since AutoCAD has a similar situation we search for "SH1" next and if neither exist we just grab the next config, ie sheet, from the end.

 

We had a situation where a user renamed the sheets later in the drawing lifecycle. The current version is 85 and does not contain "Sheet1" but a much older version does contain "Sheet1"

 

What this has brought to light is that the GetVar, since we are specifically looking for Sheet1 config will seek out that config in the "newest available". How do we force GetVar to only pull from the current, or latest, version of the drawing? In our problem case it should have found nothing for "Sheet1" because that does not exist any longer.

 

 

Code:

Public Function ParGetProperty(ByVal configNames As String(), ByVal propertyName As String, ByRef value As Object, ByRef exception As ProcessException, Optional ByVal preferredConfigs As String() = Nothing) As Boolean

value = Nothing

exception = Nothing

 

Try

Dim properties As IEdmEnumeratorVariable5 = m_File.GetEnumeratorVariable()

 

If preferredConfigs IsNot Nothing Then '<-- preferredConfigs is a string array with 2 values: "Sheet1" and "SH1"

For Each configName As String In preferredConfigs

If properties.GetVar(propertyName, configName, value) Then  '<-- property name in this case is "Revision". This is the problem line!!

Return True

End If

Next

End If

 

For Each configName As String In configNames

If properties.GetVar(propertyName, configName, value) Then

Return True

End If

Next

 

Return False

 

Catch pe As ProcessException

exception = pe

exception.SendAlertAndLog("EPDM")

Return False

 

Catch ex As Exception

exception = New ProcessException(ex)

exception.SendAlertAndLog("EPDM")

Return False

 

End Try

End Function

Outcomes