The following is a CATIA drawing view macro to help you learn how to program for the drafting workbench since macros cannot be recorded in it. To create 2D CATIA drawing views from 3D models with a CATVBA macro follow these steps:
Use the DrawingViews collection to create an empty DrawingView:
1 2 3 | Dim oView As DrawingView Set oView = oSheet.Views.Add() |
Next, retrieve the GeneravtiveBehavior object:
4 5 6 | Dim oGenB As DrawingViewGenerativeBehavior Set oGenB = oView.GenerativeBehavior |
Now, establish the link with the 3D CATIA model, like so:
7 8 9 10 11 | Dim oParentDoc As PartDocument Set oParentDoc = CATIA.Documents.Item("MyPart.CATPart") oGenB.Document = oParentDoc.Product |
Finally, set the View attributes, such as the hidden line mode:
12 | oGenB.HiddenLineMode = catHlrModeOn |
The DrawingView object contains the DrawingViewGenerativeBehavior object, which owns the methods for creating 2D views from 3D models.
Thanks for reading about my CATIA drawing view macro. Read more CATIA tutorials.
Hi
How can i create table from user-form to catia drawing sheet
Dim oView As DrawingView
Set oView = oSheet.Views.ActiveView
Dim oTable As DrawingTable
Set oTable = oView.Tables.Add(100., 100., 2, 2, 20., 50.)
Hi
I am building a CATIA macro in MS Excel.
I can get the drawing scale by “drawingView.scale ” , but can not set the scale by “drawingView1.scale = 0.5”. The VB program reminds of an error. The code in CATIA is ok but can not run in excel VB program.
Can you give me some suggestion? Thanks a lot in advance. Hope to receive the answer.
Hi, I have a 3D product which contains app 100 parts. How can I use this macro to get all these individual parts to 2D drawing ?