SolidWorks two times Development -09--add Coordination Reference

Source: Internet
Author: User
Tags integer
Refer to the following code to select the two sides of the part, and then add a matching reference for this part, first select the face for the reference of the first reference surface. and is the same direction, coincide with. The second one is reverse, coincident with.
Need to see the Part.FeatureManager.InsertMateReference function. The first parameter is the name that fits the reference, and the following three defines a reference for a group. The first is the entity of the selected entity, followed by the matching type (integer index), positive and negative (integer index).

Dim Swapp as Sldworks.sldworks
Dim part as Sldworks.modeldoc2
Dim Selmgr as Sldworks.selectionmgr
Dim Feature as Sldworks.feature
Dim Facefst as Sldworks.face2
Dim facesed as Sldworks.face2
Dim Facefstent as Sldworks.entity
Dim Facesedent as Sldworks.entity
Dim Tempfeat as Object


Sub Addcleatmateref ()
Set Swapp = Application.sldworks
Set part = Swapp.activedoc
Set selmgr = Part.selectionmanager

Set tempfeat = selmgr. GETSELECTEDOBJECT5 (1)
If Tempfeat. GetType = 2 Then
Set facefst = tempfeat
Set facefstent = facefst
Else
MsgBox "Please select Plane"
End If
Set tempfeat = selmgr. GETSELECTEDOBJECT5 (2)
If Tempfeat. GetType = 2 Then
Set facesed = tempfeat
Set facesedent = facesed
Else
MsgBox "Please select Plane"
End If
Set Feature = Part.FeatureManager.InsertMateReference ("Fit reference 1", Facefstent, 2, 1, Facesedent, 2, 2, nothing, 0, 0)
End Sub


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.