Hide Table of Contents
AddDistanceMate Method (IAssemblyDoc)

Adds a distance mate to this assembly.

.NET Syntax

Visual Basic (Declaration) 
Function AddDistanceMate( _
   ByVal AlignFromEnum As System.Integer, _
   ByVal Flip As System.Boolean, _
   ByVal Distance As System.Double, _
   ByVal DistanceAbsUpperLimit As System.Double, _
   ByVal DistanceAbsLowerLimit As System.Double, _
   ByVal FirstArcCondition As System.Integer, _
   ByVal SecondArcCondition As System.Integer, _
   ByRef ErrorStatus As System.Integer _
) As Mate2
Visual Basic (Usage) 
Dim instance As IAssemblyDoc
Dim AlignFromEnum As System.Integer
Dim Flip As System.Boolean
Dim Distance As System.Double
Dim DistanceAbsUpperLimit As System.Double
Dim DistanceAbsLowerLimit As System.Double
Dim FirstArcCondition As System.Integer
Dim SecondArcCondition As System.Integer
Dim ErrorStatus As System.Integer
Dim value As Mate2
 
value = instance.AddDistanceMate(AlignFromEnum, Flip, Distance, DistanceAbsUpperLimit, DistanceAbsLowerLimit, FirstArcCondition, SecondArcCondition, ErrorStatus)
C# 
Mate2 AddDistanceMate( 
   System.int AlignFromEnum,
   System.bool Flip,
   System.double Distance,
   System.double DistanceAbsUpperLimit,
   System.double DistanceAbsLowerLimit,
   System.int FirstArcCondition,
   System.int SecondArcCondition,
   out System.int ErrorStatus
)
C++/CLI 
Mate2^ AddDistanceMate( 
&   System.int AlignFromEnum,
&   System.bool Flip,
&   System.double Distance,
&   System.double DistanceAbsUpperLimit,
&   System.double DistanceAbsLowerLimit,
&   System.int FirstArcCondition,
&   System.int SecondArcCondition,
&   [Out] System.int ErrorStatus
) 

Parameters

AlignFromEnum
Type of alignment as defined in swMateAlign_e
Flip
True to flip mate entities, false to not (see Remarks)
Distance
Distance value (see Remarks)
DistanceAbsUpperLimit
Absolute maximum distance value (see Remarks)
DistanceAbsLowerLimit
Absolute minimum distance value (see Remarks)
FirstArcCondition
First arc condition as defined in swDistanceMateArcConditions_e; valid only for cylindrical distance mates (see Remarks)
SecondArcCondition
Second arc condition as defined in swDistanceMateArcConditions_e; valid only for cylindrical distance mates (see Remarks)
ErrorStatus
Success or error as defined by swAddMateError_e

Return Value

IMate2

Example

Remarks

To specify a distance mate without limits, set the DistanceAbsUpperLimit and DistanceAbsLowerLimit parameters equal to the Distance parameter.

If the mate is applied to the closest position that meets the mate condition specified by Distance, then setting Flip to true moves the components to the other possible mate position.

 

For cylindrical distance mates only, the following FirstArcCondition-to-SecondArcCondition distance combinations are possible:

FirstArcCondition as defined in swDistanceMateArcConditions_e to SecondArcCondition as defined in swDistanceMateArcConditions_e
swArcCondition_Center swArcCondition_Center
swArcCondition_Center swArcCondition_Minimum
swArcCondition_Center swArcCondition_Maximum
swArcCondition_Minimum swArcCondition_Center
swArcCondition_Minimum swArcCondition_Minimum
swArcCondition_Minimum swArcCondition_Maximum
swArcCondition_Maximum swArcCondition_Center
swArcCondition_Maximum swArcCondition_Minimum
swArcCondition_Maximum swArcCondition_Maximum

To add a distance mate:

 

  1. Call IModelDocExtension::SelectByRay and ISelectionMgr::GetSelectedObject6 to get each mate entity. (For cylindrical distance mates, the selections must be two cylindrical faces or one cylindrical face and one axis.)
  2. Call IEntity::Select4 to select each entity. 
  3. Call this method.
  4. Call IModelDoc2::EditRebuild3 after the mate is created.

If entities are not preselected, then ErrorStatus is swAddMateError_e.swAddMateError_IncorrectSelections, and nothing is returned.

 

 

See Also

Availability

SOLIDWORKS 2018 FCS, Revision Number 26.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:   AddDistanceMate Method (IAssemblyDoc)
*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) 2023 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.