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)
C# 
System.object FeatureByPositionReverse( 
   System.int Num
)
C++/CLI 
System.Object^ FeatureByPositionReverse( 
&   System.int Num
) 

Parameters

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

Example

Remarks

Do not assume that the name or the order of SolidWorks features is always the same. For example, you should not assume that the last feature in the list is always the Annotations folder. Additionally because feature names can be customized, you cannot assume that the first reference plane feature is named Plane1 or that the Annotations folder is called Annotations. See IFeature::GetTypeName and IFeature::Name for more information.

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, in SolidWorks 98Plus, 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 may 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 may be running and may have also modified your document. Feature count can be determined by calling IModelDoc2::GetFeatureCount.

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

IModelDoc2::FeatureByPositionReverse can access suppressed features.

 

See Also

Availability

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

 
*Email:  
Subject:   Feedback on Help Topics
Page:   FeatureByPositionReverse Method (IModelDoc2)
*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) 2013 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.