×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*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.

# Modify Text in Title Blocks on every CatDrawing that is open.4

## Modify Text in Title Blocks on every CatDrawing that is open.

(OP)

This is how the Title Blocks looks (every CatDrawing the same.)

Now what i have to do is to modify Text1 , Text2 , Text3 ,Text4 and Text 5 on every page. I am new to catia , and VB too. I have tried to create a macro that asks me ..what new text should be and type them in the text boxes but i have failed.

For example:

New project:

Text1 = a1
Text2 = b1
Text3 = c1
Text4 = d1
Text5 = e1

After few days update is needed and after some changes :

Text1 must become = a2
Text2 must become = b2 and so on.

Sometimes i have to do this for 2 or 3 sheets and i do it..manually on each page. But other times i have to do this for 100 or more..

The Title Blocks are allways in SheetBackground , and it's custom made (it't not one from Catia title blocks library)
If needed , i can send you a CatDrawing sheet, just ask.

Hope i will find here some help.
Best regards , and thank you for your time.

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

Hi,

The screen capture is too small, better upload the drawing because you have to identify also those text strings in order to assign them new values.

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

Your title block is in fact a ditto. I noticed in latest CATIA releases (yours is r19) the method search text substring is not working like in r16 or r18, Dassault changed something...so this must be checked in on line docs...and for the time being I don't have so much time.

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

FYI:
It is posible to have the subsequesnt sheet inheret the background from the first sheet.
Tools>Options>Mechanical Design>Drafting>Layout : New Sheet

This must be done when the new sheet is added.

If you already have a drawing with multiple sheets, then I think coding it will be the only way.
Start off by trying some stuff manually with the macro recorder running.
Also,, take a look at the canned macros that come with catia.
There is code in there that shows how to loop through elements on a drawing.

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

(OP)

I dont have to create any new sheet.

I must open all CatDrawings in Catia. (Every CatDrawing has a single Sheet.)
And then must update those text fields.

I have tried recordering a macro , but when i select and modify those texts , nothing seems to appear as code.
Also checked V5Automation documentation , and over the catia macros but i still didn't get it.
Don't really know how that ditto is defined , how i can get info about it so that i can access and modify those text fields.

See picture in attachment.Maybe is more descriptive
:(

Thank you.

Sorry my english is not very good.

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

Drafting is one of the worst workbenches when recording macros...I never used r19 but in r18 ou could search a text string even inside the ditto, that's why you could use a macro to search and modify the text string.

Now I'm using r21 and I'm not able to do a search text string inside ditto (or 2D component instance as is known in v5).

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

(OP)
As long as it is possible to edit manually those text fields , i assume that it is possible by coding too.

I have also tried to manually search with Find , those text strings , but they can't be found.

Is there a way to create a macro so i can view the properties of that object ? Maybe if i can find how that TextBoxs are named..maybe i can change someway it's value.

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

If you first Explode the 2D Component Instance, you can modify its elements.

So, i guess:
For Each Sheet
Explode background Elements
find text note in background
change text note's text
Next Sheet

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

Faudrait peu etre contacter Renault pour savoir comment travailler avec les dessins...

Eric N.
indocti discant et ament meminisse periti

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

Our clients don't allow us to explode dittos...I would also like to know a way how to do it in macro.

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

If it is not exploded, I do not think it is possible to modify its objects.

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

2
It can be done !

#### CODE -->

Sub modify()

Dim oDrawing As DrawingDocument
Set oDrawing = CATIA.ActiveDocument

Dim oSheets As DrawingSheets
Set oSheets = oDrawing.Sheets

Dim oSheet As DrawingSheet
Set oSheet = oSheets.Item("Sheet.1")

Dim oView As DrawingView
Set oView = oSheet.Views.Item(2)
oView.Activate

Dim o2DComponents As DrawingComponents
Set o2DComponents = oView.Components

Dim o2DComponent As DrawingComponent
Set o2DComponent = o2DComponents.Item(1)

For i = 1 To 100
Dim oText As DrawingText
Set oText = o2DComponent.GetModifiableObject(i)

oText.Text = "Alex"

Next i

End Sub 

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

(OP)
I have asked someone at work who has experience in vb for catia and making macros and told me that the table is a 'vigniette' (french term) , or a 'editable detail' and it can be modified by macro (as long as it is possible to edit it manually by double clicking the text fields end edit them).Unfortunatly he didnt want to tel me more , just search for it in catia help. I did search for it and didnt find anything alike :(

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

(OP)
Alex thank you. Now i left from work and heading home.I will try your script and come back with a feedback.

Regards

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

Hi,

Excellent idea Alex, star from me.

Cozmin, iata codul tau (here is your code) , of course it can be improved

#### CODE --> CATScript

Sub CATMain()

Dim oDrawing As DrawingDocument
Set oDrawing = CATIA.ActiveDocument

Dim oSheets As DrawingSheets
Set oSheets = oDrawing.Sheets

Dim oSheet As DrawingSheet
Set oSheet = oSheets.Item("Sheet.1")

Dim oView As DrawingView
Set oView = oSheet.Views.Item(2)
oView.Activate

Dim o2DComponents As DrawingComponents
Set o2DComponents = oView.Components

Dim o2DComponent As DrawingComponent
Set o2DComponent = o2DComponents.Item(1)

' Retrieve the modifiable text of the ditto
Dim oText As DrawingText
Set oText = o2DComponent.GetModifiableObject(1)

Count = o2DComponent.GetModifiableObjectsCount

For i = 1 To Count
Set oText = o2DComponent.GetModifiableObject(i)

If oText.Text = "Text 1" Then
oText.Text = "A1"
ElseIf oText.Text = "Text 2" Then
oText.Text = "B1"
ElseIf oText.Text = "Text 3" Then
oText.Text = "C1"
ElseIf oText.Text = "Text 4" Then
oText.Text = "D1"
ElseIf oText.Text = "Text 5" Then
oText.Text = "E1"
End If
Next ''i

End Sub 

Eric, j'étais presque sûr que Cozmin ne sera pas obtenir une réponse rapide

### RE: Modify Text in Title Blocks on every CatDrawing that is open.

(OP)
Your code included in a For loop , is doing right what i needed.It's changing those text fields on every CatDrawing that is opened.
Thank you all a lot for your support.

CatScript :

Sub CatMain()

For I = 1 To CATIA.Documents.Count

Here Code posted By Alex or Fernando

Next

End Sub
------------------------
Thank you again. Best wishes.

#### 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.

#### Resources

eBook - Efficient and Effective Production Support with 3D Printed Jigs and Fixtures
Jigs and fixtures offer manufacturers a reliable process for delivering accurate, high-quality outcomes, whether for a specific part or feature, or for consistency across multiples of parts. Although the methodologies and materials for producing jigs and fixtures have evolved beyond the conventional metal tooling of years past, their position as a manufacturing staple remains constant due to the benefits they offer. Download Now
Overcoming Cutting Tool Challenges in Aerospace Machining
Aerospace manufacturing has always been on the cutting edge, from materials to production techniques. However, these two aspects of aerospace machining can conflict, as manufacturers strive to maintain machining efficiency with new materials by using new methods and cutting tools. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!