help with catia search macro
help with catia search macro
(OP)
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.





RE: help with catia search macro
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....
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
RE: help with catia search macro
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
End If
Next
Next
'If CurrentView.Name <> "Background View" Then
'TextFont = odrwview.Item(i).Texts.Item(numtxt).GetFontSize(0, 0)
'If TextFont > 7 Then
'Change the color of the text in RED
'drwselect.Add odrwview.Item(i).Texts.Item(numtxt)
'drwselect.VisProperties.SetRealColor 255, 0, 0, 0
'End If
'End If
'CATIA.ActiveWindow.ActiveViewer.Reframe
'MsgBox "Text highlighted in RED has text height > 7 mm", vbInformation
End Sub
RE: help with catia search macro
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
RE: help with catia search macro
RE: help with catia search macro
Maybe CATIA.StartCommand "Magnifier" if you want to have just a visual confirmation ?
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
RE: help with catia search macro