Variable boolstatus for InsertMateReference
Posted: Thu Oct 26, 2023 1:41 am
Hello
I've recorded a macro. It creates a Mate Reference based on selected surfaces using boolstatus. What I want is to select the surfaces by clicking and then create the Mate Reference. Since I'll be applying this to multiple parts, the constants within boolstatus need to be changed. Thank you in advance for your help
I've recorded a macro. It creates a Mate Reference based on selected surfaces using boolstatus. What I want is to select the surfaces by clicking and then create the Mate Reference. Since I'll be applying this to multiple parts, the constants within boolstatus need to be changed. Thank you in advance for your help
Code: Select all
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByRay(3.90459275934063E-03, 1.74419775687511E-02, -4.00804859780806E-02, 0.719981793085169, -0.488420146094646, 0.493023304230895, 3.8791577729578E-04, 1, True, 1, 0)
boolstatus = Part.Extension.SelectByRay(6.37084061600035E-03, 1.36439426446486E-02, -3.99999999999636E-02, 0.719981793085169, -0.488420146094646, 0.493023304230895, 3.8791577729578E-04, 2, True, 2, 0)
boolstatus = Part.Extension.SelectByRay(-8.83375323485325E-03, 8.12187193855607E-03, -7.99928660113096E-02, 0.719981793085169, -0.488420146094646, 0.493023304230895, 3.8791577729578E-04, 2, True, 4, 0)
Dim myFeature As Object
Set myFeature = Part.FeatureManager.InsertMateReference2("Varsayılan", Nothing, 0, 0, False, Nothing, 2, 0, False, Nothing, 3, 0)
Part.ClearSelection2 True
End Sub