Hi
i am facing this issue where i need to get the name of the hybridshape or surface which is selected
but its not working properly here is the userform and macro
when i select it shows "CATIASelection7"
but it should show Fill.1 or whatever the hybridshape that is selected
here is the VBScript
Option Explicit
Dim oDoc As Document
Dim oPartDoc As PartDocument
Dim oPart As Part
Dim oBodys As Bodies
Dim oBody As Body
Dim oSel As Selection
Dim oSel2 As Object
Dim hybBodys As HybridBodies
Dim hybBody As HybridBody
Dim hybShapefact As HybridShapeFactory
Dim hybshapes As HybridShapes
Dim hybshape As HybridShape
Private Sub CancelBtn_Click()
Unload Me
End Sub
Private Sub surfaceBtn_Click()
Set oDoc = CATIA.ActiveDocument
Set oPartDoc = CATIA.ActiveDocument
Set oPart = oPartDoc.Part
Set oSel = CATIA.ActiveDocument.Selection
Set oSel2 = oSel
oSel.Clear
Dim varFilter(1) As Variant
varFilter(0) = "Face"
varFilter(1) = "Face"
Dim status As String
status = oSel2.SelectElement3(varFilter, "Select Face", False, CATMultiSelTriggWhenUserValidatesSelection, False)
If (status = "Cancel") Then
MsgBox "User Cancelled"
Else
nameBox.Text = oSel.Name
End If
End Sub
i am facing this issue where i need to get the name of the hybridshape or surface which is selected
but its not working properly here is the userform and macro
when i select it shows "CATIASelection7"
but it should show Fill.1 or whatever the hybridshape that is selected
here is the VBScript
Option Explicit
Dim oDoc As Document
Dim oPartDoc As PartDocument
Dim oPart As Part
Dim oBodys As Bodies
Dim oBody As Body
Dim oSel As Selection
Dim oSel2 As Object
Dim hybBodys As HybridBodies
Dim hybBody As HybridBody
Dim hybShapefact As HybridShapeFactory
Dim hybshapes As HybridShapes
Dim hybshape As HybridShape
Private Sub CancelBtn_Click()
Unload Me
End Sub
Private Sub surfaceBtn_Click()
Set oDoc = CATIA.ActiveDocument
Set oPartDoc = CATIA.ActiveDocument
Set oPart = oPartDoc.Part
Set oSel = CATIA.ActiveDocument.Selection
Set oSel2 = oSel
oSel.Clear
Dim varFilter(1) As Variant
varFilter(0) = "Face"
varFilter(1) = "Face"
Dim status As String
status = oSel2.SelectElement3(varFilter, "Select Face", False, CATMultiSelTriggWhenUserValidatesSelection, False)
If (status = "Cancel") Then
MsgBox "User Cancelled"
Else
nameBox.Text = oSel.Name
End If
End Sub