Hello
Let me explain my problem:
I want to get the name present in the creation tree by selecting a face. Except that I can't do it.
Here's my code:
Code:
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Sun swSelMgr As SldWorks.SelectionMgr
Dim swFace As SldWorks.Face2
Dim swfeat As SldWorks.Feature
Dim swfacefeat As SldWorks.Feature
Dim swent As SldWorks.Entity
Dim swseldata As SldWorks.SelectData
Dim vface As Variant
Sub test()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
If swSelMgr.GetSelectedObjectType3(1, -1) = swSelFACES Then
Set swFace = swSelMgr.GetSelectedObject6(1, -1)
Set swseldata = swSelMgr.CreateSelectData
vface = swFace.GetFeature
Set swfeat = vface
MsgBox swfeat. Name
Else
MsgBox "select a piercing"
End
End If
End Sub
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Sun swSelMgr As SldWorks.SelectionMgr
Dim swFace As SldWorks.Face2
Dim swfeat As SldWorks.Feature
Dim swfacefeat As SldWorks.Feature
Dim swent As SldWorks.Entity
Dim swseldata As SldWorks.SelectData
Dim vface As Variant
Sub test()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
If swSelMgr.GetSelectedObjectType3(1, -1) = swSelFACES Then
Set swFace = swSelMgr.GetSelectedObject6(1, -1)
Set swseldata = swSelMgr.CreateSelectData
vface = swFace.GetFeature
Set swfeat = vface
MsgBox swfeat. Name
Else
MsgBox "select a piercing"
End
End If
End Sub
Would there be someone to help me???
Thanks in advance
Gael