hi, i am new in catia programing. I would really appreciate it if someone could help me get the program started. I would like to select a text in excel and it does something similar to ctrl H and search for the part number and zoom into the 2D drawing.
As I can understand, you are trying to search in an EXCEL file something (ctrl F not H), if the part number exist then switch to CATIA drawing and zoom into that text, write?
So, your macro should be done in EXCEL (but not necessary) and "work" with CATIA.
Did you try something? Just for your information, in my opinion drafting workbench is not so friendly in automation....
hi i was able to achieve it, but i do not know the vba code to reframe to a text
Option Explicit
Private Sub CommandButton1_Click()
ListBox1.AddItem ("2057510200-REF")
End Sub
Private Sub ListBox1_Click()
CATIA.DisplayFileAlerts = False
Dim oDrwDocument As Document
Dim oDrwviews As DrawingViews
Dim drwSelect As Selection
Dim iViews As Long
Set oDrwDocument = CATIA.ActiveDocument
' Retrieve the drawing document's view collection
Set oDrwviews = oDrwDocument.Sheets.Item(1).Views
'For each view search text
Set drwSelect = CATIA.ActiveDocument.Selection
For iViews = 1 To oDrwviews.Count
'Scan all the Texts of the Views
Dim itxt As Integer
For itxt = 1 To oDrwviews.Item(iViews).Texts.Count
Dim getPart As String
getPart = ("*" & oDrwviews.Item(iViews).Texts.Item(itxt).Text & "*")
If InStr(getPart, ListBox1.Text) Then
drwSelect.Add oDrwviews.Item(iViews).Texts.Item(itxt)
CATIA.ActiveWindow.Reframe
Exit Sub
yes i did, it didnt zoom into my text, because it only calls on reframe views. if you can help me determine what calls Ctrl H and ultilize the reframe from there, that would help alot.
I don't think is possible in vba (I didn't search for this in docs, maybe someone else can give more ideas, maybe use SendKeys in the new pop-up window ?).
Maybe CATIA.StartCommand "Magnifier" if you want to have just a visual confirmation ?