Hide Table of Contents
FeatureByPositionReverse Method (IModelDoc2)

Gets the nth from last feature in the document.

.NET Syntax

Visual Basic (Declaration) 
Function FeatureByPositionReverse( _
   ByVal Num As System.Integer _
) As System.Object
Visual Basic (Usage) 
Dim instance As IModelDoc2
Dim Num As System.Integer
Dim value As System.Object
value = instance.FeatureByPositionReverse(Num)
System.object FeatureByPositionReverse( 
   System.int Num
System.Object^ FeatureByPositionReverse( 
&   System.int Num



Number of feature from the last feature in the FeatureManager design tree; 0 is the last feature in FeatureManager design tree

Return Value

Pointer to the nth from last feature in the document



This method returns features in the current order for the model, and this order changes when the model is edited.

Your application should not assume that:

  • features retain the same relative or absolute position throughout the model’s lifetime. For example, you should not assume that Sketch1 always appears before Sketch2.
  • any feature has a specific name. Because features can be renamed, you cannot assume that the first reference plane feature is named Plane1.

When traversing the FeatureManager design tree, your application should use IFeature::GetTypeName2 and IFeature::GetSpecificFeature2 to identify specific features instead of relying solely on IFeature::Name.

This method returns features in the model definition order, which is not the same as the order displayed in the user interface. See ITreeControlItem for details.

Because SOLIDWORKS does not guarantee the name or positioning of default features, your application should not make any assumptions in this area. If your application is trying to access geometric features (i.e., sketches, fillets, bosses, reference surfaces, etc.) using IModelDoc2::FeatureByPositionReverse, then it is safest to determine the number of default features at the top and bottom of the list for each particular document. This could be done once for each document by traversing the FeatureManager design tree using IModelDoc2::FirstFeature and IFeature::GetNextFeature. Based on the feature type, IFeature::GetTypeName, you can recognize where new features will be placed in the FeatureManager design tree upon creation.

For example, a new fillet is created at position (n-1) where n is the total number of features in the part. Therefore, to obtain this feature, then specify 1 for PositionFromEnd. This allows you to obtain the newly created fillet feature which is 1 from the bottom of the list.

If you are using this method to obtain the last feature object created by your application, then, as a precaution, you might also want to check the feature count immediately before your feature creation and immediately after your feature creation. If the feature count has increased by 1, then it is relatively safe to assume that only your application has modified the document and added a feature. However, this is not a guaranteed methodology because another third-party applications might be running and might have also modified your document. Feature count can be determined by calling IModelDoc2::GetFeatureCount. However, IModelDoc2::GetFeatureCount does not recognize Sheet-Metal and Flat-Pattern folders as features in the FeatureManager design tree. Sheet-Metal and Flat-Pattern folders were introduced in SOLIDWORKS 2013.

To access the first feature in the FeatureManager design tree and sub-features, use IModelDoc2::FirstFeature and IFeature::GetFirstSubFeature methods, respectively.

IModelDoc2::FeatureByPositionReverse can access suppressed features.


See Also


SOLIDWORKS 2001Plus FCS, Revision Number 10.0

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:   FeatureByPositionReverse Method (IModelDoc2)
*   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.