Comment utiliser InsertReferencePoint solidworks

Bonjour,

je souhaite creer un point d'intersection entre mes 2 axes et il apparait un message d'erreur : l'objet invoque est deconnecté de ses 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)

 

merci de votre aide

Bonjour. Essaye:

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

 

Bonjour,

 

Ca fonctionne tres bien merci beaucoup

quel est la difference entre le false et le true ?

Append
If...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" dans SelectByID2 est l'équivalent d'avoir la touche "Shift" enfoncée lorsque tu fais plusieurs sélection.

Si ma réponse fonctionne merci de la marquer comme correcte