×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

help with catia search macro

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

Hi,

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

(OP)
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

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

(OP)
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.

RE: help with catia search macro

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 ?

Regards
Fernando

https://picasaweb.google.com/102257836106335725208

RE: help with catia search macro

(OP)
any way to zoom into it?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources