NaWin55
Mechanical
- Mar 21, 2020
- 98
Hi
I have a user form here i want to display the selected hybridshape name which is present in any geometrical set
i tried this code but it is showing like this
Selection_RSur
Face
Brp
GSMSymmetry.1;(Brp
GSMSweep.1;(Brp
GSMExtrude.6;2
Brp
GSMLine.84)));Brp
GSMExtrude.6;0
Brp
GSMLine.84)))))));None
);Cf12
));EdgeFillet.1_ResultOUT;Z0;G9061)
but if select a FILL it should Fill.1 or if i select a EdgeFillet it should show Edgefillet.1 like that
here is the code
Option Explicit
Dim oDoc As Document
Dim oPartDoc As PartDocument
Dim oPart As Part
Dim osel As Selection
Dim oSel2 As Object
Private Sub UserForm_Initialize()
Set oDoc = CATIA.ActiveDocument
Set oPartDoc = CATIA.ActiveDocument
Set oPart = oPartDoc.Part
End Sub
Private Sub SelectFeature_Click()
Set osel = CATIA.ActiveDocument.Selection
Set oSel2 = osel
osel.Clear
Dim varFilter(0) As Variant
varFilter(0) = "AnyObject"
Dim status As String
status = oSel2.SelectElement2(varFilter, "select Face", False)
If (status = "Cancel") Then
MsgBox "user Cancelled"
Else
SurText.Text = oSel2.Item(1).Value.Name
End If
End Sub
In this image i selected surface from geometry not from model tree
how to solve this
thanks
I have a user form here i want to display the selected hybridshape name which is present in any geometrical set
i tried this code but it is showing like this
Selection_RSur
but if select a FILL it should Fill.1 or if i select a EdgeFillet it should show Edgefillet.1 like that
here is the code
Option Explicit
Dim oDoc As Document
Dim oPartDoc As PartDocument
Dim oPart As Part
Dim osel As Selection
Dim oSel2 As Object
Private Sub UserForm_Initialize()
Set oDoc = CATIA.ActiveDocument
Set oPartDoc = CATIA.ActiveDocument
Set oPart = oPartDoc.Part
End Sub
Private Sub SelectFeature_Click()
Set osel = CATIA.ActiveDocument.Selection
Set oSel2 = osel
osel.Clear
Dim varFilter(0) As Variant
varFilter(0) = "AnyObject"
Dim status As String
status = oSel2.SelectElement2(varFilter, "select Face", False)
If (status = "Cancel") Then
MsgBox "user Cancelled"
Else
SurText.Text = oSel2.Item(1).Value.Name
End If
End Sub

In this image i selected surface from geometry not from model tree

how to solve this
thanks