How to use Solidworks InsertReferencePoint

Hello

I want to create an intersection point between my 2 axes and an error message appears: the invoked object is disconnected from its clients

Set swApp = Application.SldWorks
Set ModelDoc = swApp.ActiveDoc

Set Part = swApp.ActiveDoc

boolstatus = Part.Extension.SelectByID2("Axe1", "AXIS", 0, 0, 0, True, 1, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Axe2", "AXIS", 0, 0, 0, True, 1, Nothing, 0)
Dim vRefPointFeatures As Object
vRefPointFeatures = Part.FeatureManager.InsertReferencePoint(6, 0, 0.01, 1)

 

thank you for your help

Hello. Try:

Option Explicit
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim vFeat As Variant
Dim boolstatus As Boolean
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
boolstatus = swModel.Extension.SelectByID2("Axis1", "AXIS", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = swModel.Extension.SelectByID2("Axis2", "AXIS", 0, 0, 0, True, 0, Nothing, 0)
vFeat = swModel.FeatureManager.InsertReferencePoint(swRefPointType_e.swRefPointIntersection, 0, 0.01, 1)
swModel.ClearSelection2 True
End Sub

 

Hello

 

It works very well, thank you very much

What is the difference between false and true?

Append
Yew...An, if entity is...Then...
TrueNot already selectedEntity is appended to the current selection list
 Already selectedEntity is removed from the current selection list
FalseNot already selectedCurrent selection is cleared and then the entity is put on the list
 Already selectedCurrent selection list remains the same

"True" in SelectByID2 is the equivalent of having the "Shift" key pressed when making multiple selections.

If my answer works, please mark it as correct