Hide Table of Contents
GetCreateFeatureErrors Method (IFeatureManager)

Gets the errors that occurred during the last call to IFeatureManager::CreateFeature.

.NET Syntax

Visual Basic (Declaration) 
Function GetCreateFeatureErrors( _
   ByRef Msgs As System.Object, _
   ByRef FeatureTypeName As System.String _
) As System.Integer
Visual Basic (Usage) 
Dim instance As IFeatureManager
Dim Msgs As System.Object
Dim FeatureTypeName As System.String
Dim value As System.Integer
value = instance.GetCreateFeatureErrors(Msgs, FeatureTypeName)
System.int GetCreateFeatureErrors( 
   out System.object Msgs,
   out System.string FeatureTypeName
System.int GetCreateFeatureErrors( 
&   [Out] System.Object^ Msgs,
&   [Out] System.String^ FeatureTypeName


Array of errors as defined by swCreateFeatureError_e
Feature type name

Return Value

0 <= Number of messages issued at the time of last call to IFeatureManager::CreateFeature <= 20



' ===============================================
' Preconditions:
' 1. Open Public_documents\SOLIDWORKS\SOLIDWORKS 2024\samples\tutorial\api\AdvancedMates\advancedmatedemo1.sldasm.
' 2. Create two distance mates to center the steel disc inside the magnet.
' Postconditions:
' 1. Inspect the Immediate window.
' 2. Mate controller feature is not created.
' 3. Observe the returned error code: 6 indicates that the number of mate selections (2)
'    do not match the number of values (3) in the specified position data array.
' ========================================================
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim Assem As SldWorks.AssemblyDoc
Dim boolstatus As Boolean
Dim i As Long, j As Long, longstatus As Long, longwarnings As Long
Option Explicit

Sub main()

    Set swApp = Application.SldWorks
    Set Part = swApp.ActiveDoc
    Set Assem = Part
    Dim myModelView As Object
    Set myModelView = Part.ActiveView
    myModelView.FrameState = swWindowState_e.swWindowMaximized
    Part.ClearSelection2 True
    Dim var As Variant
    var = Assem.CollectAllSupportiveMates
    Debug.Print "Mates:"
    For i = 0 To UBound(var)
        var(i).Select2 True, 0
        Debug.Print "  " & var(i).Name
    Dim featMgr As SldWorks.FeatureManager
    Set featMgr = Part.FeatureManager
    Dim mateControllerObj As MateControllerFeatureData
    Set mateControllerObj = featMgr.CreateDefinition(swFmMateController)
    mateControllerObj.AddNewPosition ("Position1")
    mateControllerObj.AddNewPosition ("Position2")
    mateControllerObj.AddNewPosition ("Position3")
    Dim position2ValArr(2) As Double
    position2ValArr(0) = 1.0646
    position2ValArr(1) = 0.0635
    position2ValArr(2) = 1.02
    Call mateControllerObj.SetValues("Position2", position2ValArr)
    Dim posVar As Variant
    Dim valArr As Variant
    posVar = mateControllerObj.GetPositions()
    valArr = mateControllerObj.GetValues("Position3")
    Dim position3ValArr(2) As Double
    position3ValArr(0) = 1SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IFeatureManager~GetCreateFeatureErrors.html#
    position3ValArr(1) = 0.0635
    position3ValArr(2) = 1.05
    Call mateControllerObj.SetValues("Position3", position3ValArr)
    mateControllerObj.AddConfigurationFromPosition "Position 2", False
    mateControllerObj.DeletePosition ("Position 1")
    Dim posArr(2) As String
    posArr(0) = "Position3"
    posArr(1) = "Position2"
    posArr(2) = "Position1"
    mateControllerObj.ReOrderPositions ((posArr))
    Dim mateContFeat As SldWorks.Feature
    Set mateContFeat = featMgr.CreateFeature(mateControllerObj)
    Dim err As Variant
    Dim FeatureType As String
    Dim cnt As Long
    cnt = featMgr.GetCreateFeatureErrors(err, FeatureType)
    Debug.Print "Number of errors returned: " & cnt
    Debug.Print "Feature type: " & FeatureType
    For j = 0 To UBound(err)
        Debug.Print "Error code as defined by swCreateFeatureError_e: " & err(j)

End Sub


This method is valid only after attempting to create Mate Controller features using IFeatureManager::CreateFeature.

See Also


SOLIDWORKS 2024 FCS, Revision Number 32

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:   GetCreateFeatureErrors Method (IFeatureManager)
*   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) 2024 SP0

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.