Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

CATIA VBA & DRAWINGS / texts visual properties

Status
Not open for further replies.

jissididi

Automotive
Mar 17, 2015
46
Hi everybody

I'm writing a new macro to check texts in drawings.
I want to get the visualproperties of each text of each distinc view of each distinct drawingsheet

And so far the only way of doing this was using selection.add but it's sooooooo long that I need your help to find a better way of doing it

i've been trying to use :
Code:
myselection.item(i).visproperties.GetShow showstate
to iteratively get the visual property of each element of the selection but it didn't work

the workking code goes something like this

Code:
Dim CATIA As Object
Dim myselection As Selection
Dim textlist() As String
Dim showstate As CatVisPropertyShow

Set CATIA = GetObject(, "CATIA.Application")
Set myselection = CATIA.ActiveDocument.Selection

for each sheet in CATIA.ActiveDocument.sheets
    for each view in sheet.views
        redim textlist(view.texts.count)
        myselection.clear
        for i = 1 to view.texts.count
            myselection.add texts.item(i)
            myselection.VisProperties.GetShow showstate
            If showstate = 1 Then ''''''''''''''''''''''''''''''''''caché
                textlist(i) = ", HIDDEN TEXT"
            ElseIf showstate = 0 Then ''''''''''''''''''''''''''''''visible
                textlist(i) = ", VISIBLE TEXT"
            End If
            myselection.clear
        next
        'do stuff with the textlist()
    next
next

Thank you for the help ;)

jissi
 
Replies continue below

Recommended for you

Hi.

It's the only option in Automation. By the way, you can really speed the things up by executing **CATIA.HSOSynchronized = False**

Other than that you can use Knowledgeware to query all objects of DrwText type and check their Show property.
And, of course, there's always CAA.

EDITED: I've just realized that you can access abovementioned Knowledgeware properties with Selection.Search.
Code below searches and adds to Selection all visible text on all views (except for background) on all sheets:
Code:
CATIA.ActiveDocument.Selection.Search "CATDrwSearch.DrwText.Visibility=Visible,all"

 
Thank you Little Cthulhu,

it is important to me to know exactly where the texts are located.
And btw, by using the :

Code:
CATIA.ActiveDocument.Selection.Search "CATDrwSearch.DrwText.Visibility=Visible,all"

the selection made does not take into account the baloons and all the other types of texts in the drawing (but the drawingview.texts yes)

That's why I would like to ger them ALL ;)


Best regards
 
Well, I was hoping that you would do a bit of research by yourself.

Key points:
1. You can traverse up in a hierarchy of objects using Parent property. Texts are aggregated within DrawingView.
2. Selection allow you to search for literally any type of object in CATIA. Search window (Edit - Search menu) has a nice feature of deducing object type of a selected element which can help you to identify all text types you'd like to search for.

Code:
myselection.Search "CATDrwSearch.DrwBalloon.Visibility=Visible + CATDrwSearch.DrwCallout.Visibility=Visible + CATDrwSearch.DrwText.Visibility=Visible,all"
 
"Well, I was hoping that you would do a bit of research by yourself."

I will think about it next time

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor