Hide Table of Contents
GetObjectByPersistReference3 Method (IModelDocExtension)

Gets the object assigned to the specified persistent reference ID.

.NET Syntax

Visual Basic (Declaration) 
Function GetObjectByPersistReference3( _
   ByVal PersistId As System.Object, _
   ByRef ErrorCode As System.Integer _
) As System.Object
Visual Basic (Usage) 
Dim instance As IModelDocExtension
Dim PersistId As System.Object
Dim ErrorCode As System.Integer
Dim value As System.Object
 
value = instance.GetObjectByPersistReference3(PersistId, ErrorCode)
C# 
System.object GetObjectByPersistReference3( 
   System.object PersistId,
   out System.int ErrorCode
)
C++/CLI 
System.Object^ GetObjectByPersistReference3( 
&   System.Object^ PersistId,
&   [Out] System.int ErrorCode
) 

Parameters

PersistId

Object's persistent reference ID (see Remarks)

ErrorCode

Success or error code as defined by swPersistReferencedObjectStates_e (see Remarks)

Return Value

Object (see Remarks)

Example

Sub main ()  

    Set swApp = Application.SldWorks 

    Set Doc = swApp.ActiveDoc
    Set SelMgr = Doc.SelectionManager
    If SelMgr.GetSelectedObjectCount(-1) = 0 Then Debug.Print "No selections found.": Exit Sub 

    Dim persistRef As Variant
    Dim selObj As Object 

    Set selObj = SelMgr.GetSelectedObject6(1, -1)
    persistRef = Doc.Extension.GetPersistReference3(selObj)
    Debug.Print UBound(persistRef)
    Set selObj = Nothing
    Set selObj = Doc.Extension.GetObjectByPersistReference3(persistRef, longstatus)
    Debug.Print (Not selObj Is Nothing) 

    Dim selConfig As Configuration
    Set selConfig = selObj.GetSpecificFeature2 

End Sub

Example

Remarks

A persistent reference ID is related to a model. It is portable and can be saved within the model or in other places. Some persistent reference IDs are general to all models and can be instantiated from all models. Your application must handle persistent reference IDs and their relationships among models.

 

Before calling this method, call IModelDocExtension::GetPersistReference3 to get the object's persistent reference ID.

The swPersistReferencedObject_Suppressed and swPersistReferencedObject_Deleted enumerators only apply to references of topological entities.

 

IModelDocExtension::GetObjectByPersistReference3 was designed to return the base class of a feature to take advantage of the base feature class functionality. Objects returned by IModelDocExtension::GetObjectByPersistReference3 are often features, including IConfiguration, IRefPlane, and IRefAxis objects. You must first obtain a reference to a feature, and then use IFeature::GetSpecificFeature2 to get the original object.

 

See Persistent Reference IDs for more information. 

 

See Also

Availability

SOLIDWORKS 2007 SP3, Revision Number 15.3


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   GetObjectByPersistReference3 Method (IModelDocExtension)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2017 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.