×
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 macro to automate drawing sheet numbers

Catia macro to automate drawing sheet numbers

Catia macro to automate drawing sheet numbers

(OP)
I'm trying to write a macro which automates the sheet numbers on my drawings. For example sheet 2 of 3.

I have found a code which works to print this information in the sheet background although I cannot find a way to update these numbers if a sheet is later added or deleted. At the moment if I run the macro again it simply prints the new numbers on top of the previous (so you can see both).

I'm trying to find a way that the existing text box can be either updated or deleted by the macro when an update is needed.

Hope this makes sense! Any help would be greatly appreciated.

RE: Catia macro to automate drawing sheet numbers

Just an idea: first time when you create the textbox, name it specifically. Thus, when running the script again, you can address it directly from the collection of Texts of your Background View.

RE: Catia macro to automate drawing sheet numbers

First, count the number of sheets of your file,
then go to each sheet, and add the number.

try this:

CODE -->

Dim MyDoc As Document
Dim MyDrawingDoc As DrawingDocument
Set MyDrawingDoc = CATIA.ActiveDocument

Dim DrwDocument   As DrawingDocument
Dim DrwSheets     As drawingSheets
Dim DrwSheet      As drawingSheet
Dim DrwView       As DrawingView
Dim DrwTexts      As DrawingTexts
Dim Text          As DrawingText
Dim Fact          As Factory2D
Dim Point         As Point2D
Dim Line          As Line2D
Dim Cicle         As Circle2D
Dim Selection     As Selection
Dim GeomElems     As GeometricElements

For Each DrwSheet In MyDrawingDoc.Sheets

Dim sheet As Integer
Dim sheet_count As Integer
sheet = sheet + 1
sheet_count = MyDrawingDoc.Sheets.Count

'Insert sheet number

Set MyText1 = MyDrawingViews.ActiveView.Texts.Add(("Sheet " & sheet & " / " & sheet_count), 100, 14.5)
MyText1.WrappingWidth = 23
MyText1.SetFontSize 0, 0, 1.8

next 

Tiago Figueiredo
Tooling Engineer

Youtube channel:
https://www.youtube.com/channel/UC1qdlBeJJEgMgpPLV...

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