Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Listbox in catia vba

Status
Not open for further replies.

NaWin55

Mechanical
Mar 21, 2020
97
IN
Hi all
I have this task where i need to find some type of hybridshapes and collect them in a listbox
i have done that part, but i need to create it in such a way that when user selects a item from the list box respective hybridshape or object should get selected in catia
here is the image
ListShapes_jiozxu.jpg


here is the code
Option Explicit
Dim ODoc As Document
Dim opartdoc As PartDocument
Dim oPart As Part
Dim ohybs As HybridBodies
Dim ohyb As HybridBody
Dim ohybshps As HybridShapes
Dim ohybshp As HybridShape
Dim i As Integer
Dim j As Integer

Private Sub UserForm_Initialize()

Set ODoc = CATIA.ActiveDocument
Set opartdoc = CATIA.ActiveDocument
Set oPart = opartdoc.Part

End Sub

Private Sub ListBtn_Click()

Set ohybs = oPart.HybridBodies
Set ohyb = ohybs.Item("Shapes")
Set ohybshps = ohyb.HybridShapes
For i = 1 To ohybshps.Count
Set ohybshp = ohybshps.Item(i)
ShapeBox.AddItem ohybshp.Name
ShapeBox.Font.Bold = True
ShapeBox.Font.Size = 25
Next

End Sub

Private Sub SelectBtn_Click()

End Sub

i dont know much about listbox handling
how do i create link between items in listbox and objects in catia

thanks
 
Replies continue below

Recommended for you

Hello,
I m not sure that I understand you well, but I will answer.

There is a lot of options on the Listbox, for example in your case, when you click on the list view item, it will do some action.

Same problem for example in this post:
So when the user clicks on the listview item you will have code to search the tree for that specified shape and select it. Don't forget to clear the selection at the start.

I hope this can help.

catiavbmacro.com/
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top