Hello
I use this solidworks VBA routine to retrieve the entities contained in a constraint and it usually works pretty well.
The problem I encounter concerns the particular case where the constraint is of the Concentricity type between a cylinder and a sketch point.
By replacing swMateEnt.ReferenceType with swMateEnt.ReferenceType2, I can identify that SwMateEnt is of type swSelEXTSKETCHPOINTS however, I can't access select the object. Do you have an idea?
Thank you in advance.
Function SelectMateEntity(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swMateEnt As SldWorks.MateEntity2, nMark As Long) As Boolean
Dim swEnt As SldWorks.Entity
Dim swSelMgr As SldWorks.SelectionMgr
Dim swSelData As SldWorks.SelectData
Dim bRet As Boolean
Select Case swMateEnt.ReferenceType
Case swMateEntity2ReferenceType_Point, _
swMateEntity2ReferenceType_Line, _
swMateEntity2ReferenceType_Circle, _
swMateEntity2ReferenceType_Plane, _
swMateEntity2ReferenceType_Cylinder, _
swMateEntity2ReferenceType_Sphere, _
swMateEntity2ReferenceType_Cone, _
swMateEntity2ReferenceType_SweptSurface
Set swSelMgr = swModel.SelectionManager
Set swSelData = swSelMgr.CreateSelectData
Set swEnt = swMateEnt.Reference
swSelData.Mark = nMark
bRet = swEnt.Select4(True, swSelData)
SelectMateEntity = bRet
Exit Function
Case swMateEntity2ReferenceType_Set, _
swMateEntity2ReferenceType_MultipleSurface, _
swMateEntity2ReferenceType_GenSurface, _
swMateEntity2ReferenceType_Ellipse, _
swMateEntity2ReferenceType_GeneralCurve, _
swMateEntity2ReferenceType_UNKNOWN
Case Else
End Select
SelectMateEntity = False
End Function