Hide Table of Contents
IGetEditTarget2 Method (IAssemblyDoc)

Gets the model document that is currently being edited.

.NET Syntax

Visual Basic (Declaration) 
Function IGetEditTarget2() As ModelDoc2
Visual Basic (Usage) 
Dim instance As IAssemblyDoc
Dim value As ModelDoc2
value = instance.IGetEditTarget2()
ModelDoc2 IGetEditTarget2()
ModelDoc2^ IGetEditTarget2(); 

Return Value

IModelDoc2 being edited


This method is useful when the user is performing an in-context edit of a part component because the currently active document returned from ISldWorks::ActiveDoc might not be the document that the user is editing. For example, the user can use in-context editing to modify an assembly component. The active document is the assembly, but this method returns the IModelDoc2 for the component being edited.

The IModelDoc2 object returned by this method might be that of the assembly if no part is being in-place edited. In other words, this method returns a valid pointer (non-NULL) even when user is not editing a part in-context.

You can use the IModelDoc2 object returned by this method to determine which assembly component is being edited in-context. In general, you should not use this IModelDoc2 object for feature creation within the component part. Feature creation typically requires the IModelDoc2 of the active document. During feature creation, SOLIDWORKS automatically determines whether the feature should be created and owned by the active assembly, or if it is an in-context edit in which the feature should be created and owned by the component part.

COM applications need to release the IModelDoc2 object returned because this method increments the reference count on the IModelDoc2 object even if the edit target is the active document.


See Also

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

Subject:   Feedback on Help Topics
Page:   IGetEditTarget2 Method (IAssemblyDoc)
*   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:


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

Web Help Content Version: API Help (English only) 2016 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.