Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SSS148 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Selected Hybridshape name

Status
Not open for further replies.

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
Name_d86xx6.jpg


In this image i selected surface from geometry not from model tree
Name2_gxiolj.jpg


how to solve this

thanks
 
Replies continue below

Recommended for you

VBA:

Dim obj as Object: set obj = CATIA.ActiveDocument.Selectioj.Item(1).Value
If obj is Reference then
Set obj = obj.Parent
End if
Msgbox obj.Name
 
By the way, SelectElement... documentation clearly states that you should NOT call it from a userform.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor