×
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

Catia FAI balloon renumber

Catia FAI balloon renumber

Catia FAI balloon renumber

(OP)
Hi all

I'm working in the aerospace, and using CATIA v5-6r2014. I had receiveda some very complex parts, that I need to create the FAI and the ballooned 2D drawings, for the FAI every measured value need's to be ballooned.
Some time I realise that I missed one and start to renumber all the balloons manually.

Is there other resonamble way to renumber all the balloons starting from one up
A macro an catia option or something
PS for my catia I have vbs v5

Thank you all in advance.

RE: Catia FAI balloon renumber

Hi,
it is quite easy, try this small script and modify it according your needs:

CODE --> vbs

Sub CATMain()
    Dim doc, myview, mytexts, txt, i, baloon
    
    Set doc = CATIA.ActiveDocument
    Set myview = doc.Sheets.ActiveSheet.Views.ActiveView
    Set mytexts = myview.Texts
    
    i = 0
    For Each txt In mytexts
        If txt.FrameType = 53 Or txt.FrameType = 3 Then
            txt.Text = i
            i = i + 1
        End If
    Next
End Sub 

Frame type value 3 and 53 stand for catCircle and locked catCircle.

Tesak
http://scripts4all.eu/txtoncurve/ - Text along a curve for Catia V5

RE: Catia FAI balloon renumber

(OP)
Waw thank you so fast response this was grate but something i do wrong and i do know what


CODE --> VBS

Sub CATMain()
    Dim doc, myview, mytexts, txt, i, baloon, baloonno, number
    
    Set doc = CATIA.ActiveDocument
    Set myview = doc.Sheets.ActiveSheet.Views.ActiveView
    Set mytexts = myview.Texts
  
number = InputBox("test","test","0")

baloonno = number+1
    For Each txt In mytexts
        If txt.FrameType = 53 Or txt.FrameType = 3 Then
			If txt.Text => number Then
           		 txt.Text = baloonno
           		baloonno = baloonno + 1
 			 End If
        End If
    Next
MsgBox(number)
End Sub 
i had introduced another variable baloonno if the active view is changed to continue numbers

if i enter a number between 1-9 the code makes the gap but stops to renumber at 10 and above
if i enter a number grater then 10 it leaves balloon 1 but renumber all balloons staring fro, my input

what i'm doing wrong


RE: Catia FAI balloon renumber

in VBA Greater than or equal operator is >= not =>

Eric N.
indocti discant et ament meminisse periti

RE: Catia FAI balloon renumber

(OP)
yes you are right i had tried that too

it seams like the code is working until he tries to compare values greater then 10

when check's if 10 > 5 i think he consider just the first digit 1 > 5 and skips

RE: Catia FAI balloon renumber

google "convert text to integer with vba"
you should find some CInt...

Eric N.
indocti discant et ament meminisse periti

RE: Catia FAI balloon renumber

Hi,

Eric is right as usual. Maybe you want to try something like this.

CODE --> catvbs

Sub CATMain()
    Dim doc, myview, mytexts, txt, i, baloon, baloonno, number
    
    Set doc = CATIA.ActiveDocument
    Set myview = doc.Sheets.ActiveSheet.Views.ActiveView
    Set mytexts = myview.Texts
  
number = InputBox("Start with what number you want first in the active view","Input start number","1")

    For Each txt In mytexts
    
        If txt.FrameType = 53 Or txt.FrameType = 3 Then
                If Cint(txt.Text) <= number Then
                     txt.Text = number
                    number = number + 1
  
                ElseIf  Cint(txt.Text) >= number Then
                     txt.Text = number
                    number = number + 1
                 End If
        End If
        
    Next

End Sub 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: Catia FAI balloon renumber

I would have loved to see also

CODE --> vba

txt.Text = CStr(number) 

as something like text = number is reminding me about apples and oranges.

Eric N.
indocti discant et ament meminisse periti

RE: Catia FAI balloon renumber

Hi, i'v used your code, and it works if i need to renumber balloon from the first to the last.
The problem is, what if i need to renumber middle baloon?

1
2
3
4
need to add 2 items here to be number 5 and 6
5
6
7

So the code should say, if the number is greater than 4 you add N position of your choosing. In our case let's say 2 since i added 2 pieces.
But if it is smaller leave baloon as it is, so at the final result i shoul have.

1
2
3
4
5<new
6<new
7<old 5 became 7
8<old 6 became 8
9<old 7 became 9

I tryed to edit the code, but i think i'm missing something basic.
I tryed to tell the software if Cint(txt.Text) is greater than 4 add 2, but it seems it will run without operations.
Maybe because the Cint(txt.Text) is also used for cycling the for loop.

Thanks!

RE: Catia FAI balloon renumber

if you want a smart script I would propose this:

you have 1,2,3,4,5,6,7 and you want to insert X new after 4

you need to ask user where to insert (A) and also how many (B) .

then you check all balloon, if number bigger than A then change its number X to new value X+B

with A=4 and B = 2 you will have 1,2,3,4,7,8,9

your script should now create the missing balloon.

create loop i of B cycles, ask user to activate a view in which the balloon A+i(B) should be created and indicate location, then create balloon with proper number in new active view at location, cycle...

This will finally gives you 1,2,3,4,5,6,7,8,9

Eric N.
indocti discant et ament meminisse periti

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