Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Catia FAI balloon renumber

Status
Not open for further replies.

StoicaStefanV

New member
Jul 6, 2016
3
RO
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.
 
Replies continue below

Recommended for you

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

Code:
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
- Text along a curve for Catia V5
 
Waw thank you so fast response this was grate but something i do wrong and i do know what


Code:
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


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

Eric N.
indocti discant et ament meminisse periti
 
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
 
google "convert text to integer with vba"
you should find some CInt...

Eric N.
indocti discant et ament meminisse periti
 
Hi,

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

Code:
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

- Romania
- EU
 
I would have loved to see also

Code:
txt.Text = CStr(number)

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

Eric N.
indocti discant et ament meminisse periti
 
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!
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top