Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
Sign up to vote on this title
Useful
Not useful
VB Scripting
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Contents
��������� �����������................................................................................................ Sign up to vote on this title
����������.................................................................................................................... Useful Not useful ������� 1: ������� �������.................................................................................................
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Contents
��������� �����������................................................................................................ Sign up to vote on this title
����������.................................................................................................................... Useful Not useful ������� 1: ������� �������.................................................................................................
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
��� ���� ...........................................................................................................
�������� ��� ���������� ....................................................... ................................................................................. .......................... �������: ������� ��� ������� ������� �� � ���� .........................................................
������� 4: ���������� �����...................................................................................... Sign up to vote on this title
��� ������ �������.......................................................................................... Useful Not useful
������� ��������............................................................................................
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
������ ���� ���� ........................................................................................................
������ ������� � �������� ����...............................................................................
����� ������� 3� ���������� ���� .............................................................................
���� �������������.................................................................................................. Sign up to vote on this title
����� ��������............................................................................................................ Useful Not useful
����� ��� ������...............................................................................................................
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Copyright Information Copyright ©2012 by Nick Weisenberger Sign up to vote on this title
Useful
Not useful
All rights reserved. No part of this book may be reproduced or transmitted i
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Chapter 1: Getting Started Sign up to vote on this title
Through a series of example codes and tutorials I’ll explain how to use a Useful Not useful create CATScript macros for CATIA V5. No programming experience is require
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
(Excel, Word, CATIA, etc.), VBScript, JavaScript, Visual Basic 6.0, M Developers Studio.NET, and others. For CATIA V5 running on UNIX, em allow for VBScripts to be run with no interface building tools. Some CA from this text may work under UNIX OS but not all due to differences betw two systems. However, this will not be coveredSign inup this text. to vote on this title How to Create Macros
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
145 views
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
How to Open and Run Macros
There are multiple ways to open the macros window: 1. Go to Tools>Macro>Macros
Sign up to vote on this title
2. Use the Macros toolbar
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Always UNDO what you just recorded and run the macro. If th works from within CATIA and repeats what you just did, then the macro ob works fine. If it does NOT work from within CATIA, you need to fix it. I Sign up to vote on this title NOT work from within CATIA it will NOT work once you cut and paste Useful Not useful VB application. Look through the recorded macro. Many times extra lines of code ar
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
(single, double, integer, string, etc.) or an object type (more complex). Strings a especially useful because they hold text. Message boxes are frequently used display strings to users while the program is running. Looping is often used perform iterative actions •
•
Sign up to vote on this title
Object – An entity (in CATIA or VB). Points, Pads, Parameters, etc. a Useful Not useful all examples of CATIA objects. Property – A characteristic of an object. For example, the name of
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Spaces: Add extra blank spaces to your script to improve clarity. Thes are ignored by VBScript.
Comments: Add comments to your statements using an apostrophe ('), the beginning of a separate line, or at the end of a statement. It isrecom Sign up to vote on this title that you add comments wherever possible, to make your scripts e Useful Not useful understand and maintain, especially if another user has to make chang later on down the road.
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Sub CATMain() Dim strFullName as String strFullName = CATIA.FullName
Sign up to vote on this title
Dim doc1 as Document
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Sub CATMain() ‘Display a message box with the full name o document Msgbox CATIA.ActiveDocument.FullName Sign up to vote on this title ‘Display a message box with numbe useful Useful Notthe selections in the document Msgbox CATIA.ActiveDocument.Selection.Count
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Chapter 2: Fundamentals Sign up to vote on this title
Structure
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Dim oSel As Selection Set oSel = CATIA.ActiveDocument.Selection oSel.Clear oSel.Add(ObjectToAdd)
Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Dim VisProps As VisPropertySet Set VisProps = objSel.VisProperties ‘gets the color Sign up to vote on this title
VisProps.GetRealColor(255,0,0) Useful
’sets the color
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
another example of how to display a “Hello” message box using mult statements.
Sub CATMain()
Sign up to vote on this title
Dim strMessage as String
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Get Workbench
The Document object also has methods such as the “GetWorkbenc method. The GetWorkbench command takes a string as an argument andreturns Sign up to vote on this title Workbench object. To load the structural workbench:
Dim doc1 as Document
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Simple Viewer Commands
There are a few steps and methods toSign change the viewpoint of a up to vote on this title useful CATIA w Useful document. First, we need to access the 3D viewer from theNot current
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
145 views
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
‘Creating a new view (or Camera): objViewer.NewCamera() ‘To reframe a window objViewer.Reframe() Zoom In ‘To
Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Chapter 3: Building Blocks
Now it’s time to build upon the fundamentals we’ve learned to m programs more complex and robust. Sign up to vote on this title
Error Handling
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
On Error Resume Next Dim pdoc1 as PartDocument Set pdoc1 = CATIA.ActiveDocument MsgBox pdoc1.FullName
Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Sub CATMain() On Error Resume Next
‘Insert various programming statements here along ‘logic and conditionals that deal with errors tha Sign up to vote on this title Useful useful after Not ‘generated. Assume Err.number is not zero ‘statements run
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Create a Yes/No Message Box
Use the following code to create a pop-up message box with thetitle option to cli Sign up to vote on this Useful Not useful Yes or No:
If MsgBox ("To export results to PowerPoint clic
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Method 1:
Sub CATMain() Sign up to vote on this title
Dim documents1 as Documents
Useful
Not useful
Set documents1 = CATIA.Documents
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Changing the Background
Background Color can be set by passing values orvote from antitle array. One u Sign to up to on this Not usefulwith a wh of changing the background color may be to takea Useful screencapture background for easy printing (and using less ink)! Use this code to change t
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Example: Display the Density of a Part
The “&” symbol works much the same as the concatenate for Microsoft Excel by combining multiple elements. For example, if you wa Sign up to vote on this title up message box to read “The density is 55” where 55 is a variable wh Useful Not useful update with the part try this code:
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Chapter 4: Additional Tools Sign up to vote on this title
The Object Browser
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Userforms give you the ability to quickly and easily create graphical user in (GUI) for your macro programs. The foundation of any GUI in a Visu program is a “Form”, onto which various buttons, text fields, list fields, etc dragged onto. Users can input text, choose from a list of options, our command button which runs a subroutine that uses user input Sign upthe to vote on this titleoptions. Forms, buttons, text fields, etc. can be thought kinds o Useful of Notspecial useful as that instead of running “methods” have “events”. In the same way that a me function or a subroutine that runs whenever called from within a prog
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Parts and Products
A useful code you may find helpful is toSignidentify whether up to vote on this title a file is CATProduct or a CATPart. One method is like this: Useful Not useful Dim parentFileName As String
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Also, there are two internal names for products inside CATIA Product Name and the Instance Name. These can both be accessed via the Object Model using two different properties: Example: SubAssy1(SubAssy1.1) where the Sign product name up to vote on thisis titleSubAssy1 instance name is AubAssy1.1: Useful Not useful Product Name: objProduct.Name Instance Name: objProduct.PartNumb
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
win.Height=InputBox("Enter height, reference is upper left hand corner", "Change height", win.height) If win.Height="" Then Exit Sub End If
Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
To update a part use the update function: Dim part1As Part Set part1 = partDocument1.part Part1.Update Sign up to vote on this title
Measurement Macros
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Dealing with Different Versions of CATIA
Only one version of CATIA V5 can be registered with Windows at a giv time. If you have R16, R17, and R18SP2 installed on your PC, only one of these at t currently registered. You can find which one isSign registered looking up to vote onby this title directory when you register. To automate a specific version you fi Not CATIA useful Useful of have to register that version with Windows. Here are the steps to un-register or register a CATIA V5 version:
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Chapter 5: Export to Excel How to export to Excel
Spreadsheets are used in the world ofSign engineering to title create part l up to vote on this useful A macro NotExcel. bills of material. These are typically created inUseful Microsoft created to export data from CATIA into an Excel spreadsheet, quickly aut
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Launching Excel from CATIA
There are several methods to go about launching the Microsoft Exc program from within CATIA. One method forces the user to close any open Exc Sign up to vote on this title files before running the macro through error handling:
On Error Resume Next
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Screen Updating and Excel Visibility
When you do not want to see your screen follow the actions of yo procedure (macro), you start and end your code with the following sentence Sign up to vote on this title
Useful Not useful At the start: Application.ScreenUpdating = False
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
You can use a variable to assign a cell number. For example, if you have For Loop and want the Excel row number to increase by one for each iteration the loop you might use this: Dim RwNum As Integer Sign up to vote on this title
For I = 1 to 10
Useful
Not useful
Excel.Cells(RwNum, 4) = getThickness
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
'NOW returns the current date and time Excel.Cells(2,13).Formula= "=NOW()" Sign up to vote on this title
'Specify date format for NOW formula Useful Not useful
Excel.Cells(2,13).NumberFormat = "m/d/yyyy"
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Const xlCenter = -4108 Const xlAscending = 1 Const xlYes = 1 Const xlSortOnValues = 0 Const xlSortNormal = 0
Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Inserting Rows and Columns
Inserting new rows and columns into your spreadsheet is very easy. First, cell in the spreadsheet and then specify if you want to insert a rowabove Sign up to vote on this title these examples:
Useful
'insert a row at the top for headers
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Deleting Rows and Columns
Sometimes it is helpful to create extra columns in your spreadsheet to he with sorting, but they are not needed and can be removed at the end. To delete Sign up to vote on this title row or column in your exported Excel file, activate the sheet and specify the row Useful Not useful column number to be deleted.
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
More examples: ‘change the font type, size, borders, colors, text etc. With Excel.Range("A"&"1", "G"&RwNum) Sign up to vote on this title
.Font.Name = "Arial"
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
To insert a diagonal line through a cell use the following code: Excel.Range("K"&Last,"M"&Last).Select Sign up to vote on this title
Excel.Selection.Borders(xlDiagonalDown).LineStyle = Useful Not useful xlNone
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Chapter 6: Export to PowerPoint
Before launching PowerPoint we need to declare all of our obje variables, including declaring the PowerPoint application. The followin Sign up to vote on this title creates a new PowerPoint application if none are opened or starts Useful Not useful presentation if PowerPoint is already being used.
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Now, we are going to add a title slide to our PowerPoint presentation. The are a number of different slide styles you can add, which is designated by t second number inside the parenthesis after the “Add.” The first number is the sli number. You can also set the header text box of the slide to display the part name your CATIA object or any other custom text. Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Dim objSlide As PowerPoint.Slide Set objSlide = oPPTPres.Slides.Add(i+1, 36) ‘capnamer is the name of the catpart Sign up to vote on this title
objSlide.Shapes(1).TextFrame.TextRange.Text = capNa Useful Not useful
Set pic=objSlide.Shapes.AddPicture(strName, False,
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Chapter 7: Additional Information, Help, and Examples Useful Windows Functions
There are many other useful functions that are available through making calls Sign up to vote on this title useful examples Useful NotSome Windows libraries. These are available from Microsoft’s website.
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Dim info Set info = oSelElem.Parent.Parent If Err.Number=0 Then
Sign up to vote on this title
Useful MsgBox "Parent Name = " & info.Name
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
IF exportFormat <> "xls" THEN IF exportFormat <> "txt" THEN
msgbox "Did not enter txt or xls. Program cancelle
please retry macro." Else
Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Set objCamera3D = CATIA.ActiveDocument.Cameras.Item 'Input box to name the screen capture image file Dim partname As String partName = Inputbox ("Please name the image.") Sign up to vote on this title
If partName="" Then
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
'======================================================
If MsgBox ("To reframe and automatically switch to IS
view click Yes. To take the image as shown on scree click No.", vbYesNo) = vbYes Then
Sign up to vote on this title
Useful
Not useful
objViewer3D.Viewpoint3D = objCamera3D.Viewpoint3D
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
'take picture objviewer3D.Capturetofile 4,strname End If Sign up to vote on this title
'*******************RESET********************** Useful Not useful objViewer3D.FullScreen = False
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
Dim Set Dim Set
viewer1 As Viewer viewer1= CATIA.ActiveWindow.ActiveViewer viewpoint1 As Viewpoint3D viewpoint1= viewer1.Viewpoint3D Sign up to vote on this title
Dim ObjViewer3D As Viewer3D Useful Not useful Set objViewer3D = CATIA.ActiveWindow.ActiveViewer
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
With oSel .Clear .Add oAnnotation Call .VisProperties.SetVisibleColor(0, 0, 0, 0) End With oAnnotation.ModifyVisu Sign up to vote on this title End If Useful Not useful Next Next
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
With oSel .Clear .Add oAnnotation Call .VisProperties.SetVisibleColor(255, 255, 255, 255) End With oAnnotation.ModifyVisu Sign up to vote on this title End If Useful Not useful Next Next
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
1
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
For additional help and examples, please visit http://scripting4v5.com http://cadsystemshelp.blogspot.com.
Final Thoughts
Sign up to vote on this title
Useful
Not useful
Now you know how to write VBScript macros for CATIA V5! Yo
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
�� ��������� ��� ����� �5: �������� �������
About the Author Sign up to vote on this title
Useful and useful Nick Weisenberger grew up in Columbus,Ohio graduated from t Not University of Toledo, in Toledo, Ohio, with a degree in Mechanical Engineerin
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
1
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
���� ��������
Appendix I: Acronyms
The following terms are used throughout this text (in alphabetical order):
•
Sign up to vote on this title API: Application Programming Interface
•
CAD: Computer Aided Design
•
CATIA: Computer Aided Three Dimensional Interactive Applicatio
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
WORKSHOP Tutorials
The following pages contain seven step-by-step tutorials desig help teach you macro programming in CATIA V5. Sign up to vote on this title
Contents
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
WORKSHOP 1 Fundamentals Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
145 views
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
Workshop 1 – Introduction
Description
VBScript is a subset of the Visual Basic Programming language (VBA). All elements of VBScript are present in VBA, but some VBA elements are not implemented in VBScript. The result of the slimming d up to vote on this title process is a very small language that is easy Sign to use. Code specific to CA Not useful Useful saved as .CATScript. In this workshop you will learn some of the basic fundamentals needed to create and run macros. You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Why use macros?
Documents
Sheet Music
Save time and reduce the possibility of human error by autom repetitive processes.
• Standardization • Improve efficiency Expand CATIA capabilities
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
How to add a macro library
Documents
Sheet Music
Use the following steps to setup an existing macro library: Go to Tools>Macro>Macros Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
•Click "Macro libraries…"
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
Make sure the Library type is set to "Directories" then click "Add existing
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
Browse to "C:\MyCatScripts" or wherever your catscripts are saved then click ok. Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
Close the macros libraries window. After you have created some macros you will see a list of the .CATscript files here.
Sign should up to vote on load this title even af You only need to do this once- the library restarting CATIA. Useful Not useful
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
To open and run macros
There are multiple ways to open the macros Sign up to vote onwindow: this title
• Tools>Macro>Macros Macros toolbar
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Recording a Macro
Documents
Sheet Music
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
To create an icon for each macro: Go to Tools>Customize>Commands tab> scroll down to Macros>click "Show Properties"
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
Under Commands, select the macro then the "…" box. The icon browser pops up. Over to choose from. Select one then hit close. Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
Sign up to vote on this title
Useful
Not useful
• Finally, drag and drop the .CATScript file from the command w You're Reading a Preview to whatever toolbar you would like the icon to appear on
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Fundamentals Example
Documents
Sheet Music
Hit alt+F8 to open the macro window. Create a new CAT macro named msgbox. Click the Edit button. Copy and paste code below. The following code will display a message box wit text "Hello." strHello is a variable declared as a string (or text) strHello is then defined. Every Sub must end with "End Sub". C Save. Close the editor and run your macro. The "Hello" messa Sign up to vote on this title should appear. Useful Not useful You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 1 – Conclusion
Documents
Sheet Music
This concludes workshop 1. In this workshop you have learned to: •Create a new macro •Create an icon for your macro •How to record a macro
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
WORKSHOP 2 Creating Your Own VBA Modules and Classes Tutorial Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 2 – Introduction
Documents
Sheet Music
Description
Although most of the CATIA VBA programming that you will will involve the use of classes that are defined by the CATIA programming API, you will likely find it useful to define your own up to vote onclass this title in order classes. In this workshop you will createSign a custom Usefuldesign. Not useful demonstrate the fundamentals of VBA object You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 1
Documents
Sheet Music
• Open the VBA editor by hitting Alt + F11. Create a new macro library project, called "myVBA".
• Double click on your newly created library (which will appear in Cur Libraries). Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 2
Documents
Sheet Music
•Ensure the project and properties boxes are visible by going to the top and clicking View >View Project Explorer and View Properties Window •Right click on VBAProject (myVBA in this example) > Insert> Module. •Use the (Name) field in the properties box to rename it
Sign up to vote on this title
"Create_New_Part_Document"
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 3 Documents
Right click on the “Modules” folder of the VBA project and select Insert > Class Mod
Sheet Music
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 4
Documents
Sheet Music
• In the code window enter the line:
P ublic Mes s ag e A s S tring Sign up to vote on this title
• Create another module on the
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
0
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 5
Documents
Sheet Music
Enter the code seen to the right into the “UseTheMessenger” module. Note the following:
Sub CATMain() Dim oMssgr As Me
A Messenger object is dimmed. Set oMssgr = New Because you created the class module oMssgr.Message named “Messenger” this class is Sign up to vote on this title MsgBox oMssgr immediately available in your VBA Useful Not useful project. You're Reading a Preview
The “New” keyword orders the creation
End Sub
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 6
Documents
Sheet Music
• Return to the code window for the class module “Messenger" and make changes shown below. These changes have the effect of “hiding” the variable, but then create a read-only property named “Message” whose stored in the strMessage variable. Sign up to vote on this title
• Now go back to the “UseTheMessenger” module and make the change Useful Not useful below and to the right. You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 7
Documents
Sheet Music
Attempt to run “UseTheMessenger” and note that although the Messag can be “set”, it fails when the property is “gotten”. This is because no method has been defined (although, “Property Let” has been defined).
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 8
Documents Sheet Music
• Return to the code window for the class module “Messenger” and add a Get” method as shown below.
• Run the UseTheMessenger module again. It should work and the mes should be displayed.
Note: the advantage of strictly defining these “Let” and “Get” methods is Sign up to vote on this title the programmer control over whether a variable is read-only or read-wr Useful Not useful code that is in the “Let” and “Get” methods can contain more complex o and logic. You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 9
Documents
Sheet Music
Assume it would be desirable to keep count of how many times the Me property‟s value is changed. To do this, create a private integer variab change the “Property Let” method of the Message property, and add a “ Get” method for a new property named “MsgChangeCount”. Private strMessage As String Private iCount As Integer
Sign up to vote on this title
Useful
Property Let Message(strMessageIN String) You're As Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 10
Documents
Sheet Music
• Change the “UseTheMessenger” module as shown below. Run it and should be displayed saying “Message changed 1 times”.
• Change the “UseTheMessenger” module as shown to the lower right an again. A message should be displayed saying “Message changed 2 tim Sub CATMain() Dim oMssgr As Messenger
Sign up to vote on this title Sub CATMain() Useful Not useful Dim oMssgr As Messenger
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 11
Documents
Sheet Music
• Although the class works presently, there is one area where the cla could be more explicit. The “iCount” variable is incremented by on time the Message property is changed, but it isn‟t clear what value starts at. Testing the code has shown that it does start at zero, h best to be explicit. Sign up to vote on this title
• In the code window for the Messenger class module, click the left Useful Not useful down menu and choose “Class”. You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 12
Documents
Sheet Music
The result of the previous step should be that the text for the subroutine “Class_Initialize” appears in the code window. Enter the code shown b this sub. This has the effect of setting the value of the iCount to zero wh Messenger object is created with the “New” command. Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 13 Documents Sheet Music
• Properties have been defined for the messenger class. Now create a this class. This method will capitalize the message that is stored in the property. Enter the code seen below in the Messenger class module.
• The function “UCase” is a standard VBA function that takes a String as and returns the same string in all capital letters. Private strMessage As String Private iCount As Integer
Sign up to vote on this title
Useful
Not useful
Property Let Message(strMessageIN As String)
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 14
Documents
Sheet Music
• Change the “UseTheMessenger” code so that it calls this new capitalize shown. • Run the code. Note that the capitalize method has the intended effect the message box text from “Hello” to “HELLO”. Sign up to vote on this title
Sub CATMain()
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 2 – Conclusion
Documents
Sheet Music
This concludes Workshop 2. In this workshop you have learned •Create a VBA class
•Define a read-only property for the class Sign (only provide a “Prope up to vote on this title method) Useful Not useful You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
WORKSHOP 3 Creating a Basic VBA Program from Scratch Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
CATIA V5 Macro Programming
1
Download
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 3 – Introduction
Documents
Sheet Music
Description
In this workshop, as opposed to starting a CATIA VBA program by recording a macro, you will instead insert a new module into an existing CATIA VBA library and type the progr statements in manually. You will also see the difference betw var Subs and Functions, and get experience Sign up using to vote on“primitive” this title types, arrays, and For loops. Useful Not useful
Outline
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 1: Create a new module named Workshop2_01
Documents
Sheet Music
• Right-click on the myVBA project on the Project tree and select Insert • Rename the newly created module “Workshop2_01”
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 2
Documents
Sheet Music
• In the code window, type the code shown below • Click Save on the File menu to save the your changes. Sub CATMain() 'Declaration of variables Dim intA As Integer Dim intB As Integer Dim intC As Integer
Sign up to vote on this title
Useful
'Valuate two of the variables intA = 2
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 3
Documents
• Close the VBA editor.
Sheet Music
• Open the Macros menu through Tools > Macro > Macros.
• Select the WorkShop2_01 macro on the list and click the Run butto • Note that the value “5” is displayed in the message box. Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 4 Documents
• Right-click on the myVBA project on the Project tree and select Insert
Sheet Music
• Rename the newly created module “Workshop2_02”. • In the code window, type the code shown below.
Sub CATMain() Dim intA As Integer
Sign up to vote on this title
Useful
Dim intB As Integer Dim intC As Integer
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 5
Documents
Sheet Music
• Click Save on the File menu to save the your changes.
• Run the macro, this time by using using the “Run” button in the VBA editor requires that the cursor in the code window is sitting within the “CATM Sub CATMain() Dim intA intA As Integer Integer Dim intB intB As Integer Integer Dim intC intC As Integer Integer intA in tA = 2
Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
0
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 6
Documents
Sheet Music
• Right-click on the myVBA project on the Project tree and select Insert • Rename the newly created module “Workshop2_03” • In the code window, window, type the t he code shown below • Click Save on the File menu to save the your changes. • Run the macro, this time by using the “Run” button in the VBA editor editor. . Sign up to vote on this title that the cursor in the code window is sitting within the “CATMain” Sub.
Sub CATMain() Dim intA intA As Integer Integer
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 7 Documents
Sub CATMain()
Sheet Music
• Right-click on the myVBA project on the Project tree and select Insert > Module Module..
Dim intA(3) As Integer Dim intB(3) As Integer Dim intC intC As Integer Integer intA(1) = 1 intA(2) = 2
• Rename the newly created module “Workshop2_ “Workshop2_04” 04”
intA(3) = 3
Sign up to vote on this title intB(1) = 1 intB(2) = 2
• In the code window, type the
intB(3) = 3
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
0
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 3 – Conclusion
Documents
Sheet Music
This concludes Workshop 3. In this workshop you have learne • Create a CATIA VBA program from scratch Sign up to vote on this title
• Use “primitive” variable types such as integers and strings Useful Not useful
You're Reading a Preview Use a Sub (subroutine) to encapsulate code that is to be call
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
WORKSHOP 4 Objects in CATIA VBA Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
CATIA V5 Macro Programming
1
Download
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 4 – Introduction
Documents
Sheet Music
Description
In this workshop you will explore the basics of objects, the properties, and their methods in CATIA VBA programming. Sign up to vote on this title
Outline
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 1 Documents Sheet Music
• Create a new module in the myVBA macro library called “CATIAbasicObjects” • In the code window type “Sub CATMain()” and hit Enter.
• In the CATMain() Sub, type “CATIA.” Sign up to vote on this title (notice the period) and note that the Useful Not useful “Intellisense” drop-down appears, displaying a list of properties and You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 2
Documents
Sheet Music
• Scroll down the Intellisense drop-down and note that the “Windows” property is
• So “Documents” and “Windows” are both properties of the CATIA object, but the are also objects themselves. Moreover, they are a special type of object: they are collections. • Erase the text “CATIA.” that you just entered. Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 3
Documents Sheet Music
• Open 3 new parts in CATIA, accepting their default names and save th anywhere on disk. • Enter the code below into the code window.
• Run the macro using the “Run” button. The count of open documents s displayed. Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 4
Documents
Sheet Music
Add the code shown to the right and re-run the macro:
Note: The method Item() was used on the Documents object “docume to retrieve a member of the collection.Then the “Name” property and “F property of the Document object “doc1” were used. These properties r which were displayed in the message boxes. Sign up to vote on this title
Sub CATMain()
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 5 Documents Sheet Music
• Modify the previous code as shown in the code window to the right • Run the new code using the “Run” button.
Sub CATMain()
Dim documents1 As Docume
Set documents1 = CATIA.Doc
Note that the “For each” loop iterates MsgBox "The number of docu Sign up to vote on this title through the Documents collection documents1.Count Useful Not useful “documents1”. The same effect could be Dim doc1 As Document achieved with the below code, but aReading “For a Preview You're
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 6 Documents Sheet Music
Modify the previous code as shown in the code window to the right: 1) Uncomment a couple lines 2) Comment the “For Each” loop out completely 3) Add more code
Sub CATMain() Dim documents1 As Documents Set documents1 = CATIA.Documents
MsgBox "The number of documents is " documents1.Count
Sign up to vote on this title Dim doc1 As Document Useful Not useful Set doc1 = documents1.Item(1)
Run the new code using the “Run” You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 7
Documents
Sheet Music
Note that the PartDocument object “partDoc1” is “Set” to the Document “doc1”. The setting of a variable to an object of a different type is possi case because the PartDocument class “inherits” from the Document cla depicted in the CATIA object diagram below. Not only does PartDocum from Document, but so does ProductDocument, DrawingDocument, etc Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 8 Documents Sheet Music
• Modify the previous code as shown in the code window to the right by adding the line: partDoc1.Close • Note in the Intellisense drop-down that the “Close” method has a green icon to indicate that it is a method as apposed to a property. • The icon for a property can be seen for the property “FullName”
Sub CATMain()
Dim documents1 As Documen
Set documents1 = CATIA.Docu
MsgBox "The number of docu documents1.Count
Sign up to vote this title Dim doc1onAs Document
Set doc1 = documents1.Item(1 Useful useful Not
You'rebutton Reading a Preview Run the new code using the “Run”
MsgBox doc1.Name
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 4 – Conclusion
Documents
Sheet Music
This concludes Workshop 4. In this workshop you have learned • Access the properties of objects • Iterate through the items of a collection
Sign up to vote on this title
Useful
Not useful
Reading a Preview Set a variable of one typeYou're to an object of another type that it
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
WORKSHOP 5 Navigating a Part Document with Error Handling Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 5 – Introduction
Documents
Sheet Music
Description
In this workshop you will learn to “drill down” the object struc part document while using error handling to deal with certain programmatic challenges. Sign up to vote on this title
Outline
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 1 Documents Sheet Music
• First, we are going to create some geometry to test our macro on. Units do not matter for this exercise.
• Create a new part • In the part design workbench, draw a sketch of a square on any plane • Pad the sketch (to any length)
• Under Geometrical Set 1, create an offset plane a datum (explicit) p Signand up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 2 Documents Sheet Music
• Create a new module in the myVBA macro library called NavigatePart • Enter the code shown on the right
• With the new part open, run the code using either the play button or th Macro > Macros menu. NOTE: Nothing happens
• Now, create a new product document and leave open in this CATIA as the Signitup to vote on title Not usefulappear Useful document. Run the code again and the message boxshould
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 3
Documents
Sheet Music
Open the V5Automation.chm file and go to the object diagram for part documents. The first goal that will count the number of sketch-based-features. These feature objects are all different kinds o diagram shows that we will have to “drill down” like so: Part > Bodies > Body > Shapes. Click on next to the “Shape” box to see a more detailed view of Shape objects.
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 4: Use the Shape Object Diagram Documents Sheet Music
As you can see, there are many classes that inherit from the more general S Here you can see SketchBasedShape, BooleanShape, DressUpShape, and TransformationShape. We want to count the number of SketchBasedSha are in the part.
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 4: Add Code to Count SketchBasedShape Objec Documents Sheet Music
• Add the code shown to the right to the previously entered code. Note that this first section of code “grabs” the Shapes collection underneath the first part body.
Dim body1 As Body
Set body1 = partDoc1.Part.Bodies.Item Dim shapes1 As Shapes Set shapes1 = body1.Shapes
• This next section of code prepares the variables we will use to “grab” individual objects from the Shapes collection
Dim shape1 As Shape
Sign up to vote on this title Dim sketchShape As SketchBasedSha Useful Not useful Dim count1 As Integer count1 = 0
• The for each loop “grabs” each Shape in the Shapes collection, then attempts to set the more specific You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 5: Add Code to Count BooleanShape Objects
Documents
Sheet Music
Another method for counting the number of sketch based features is the For Next loop. Note the Item(1) in the code. This means we will only look at the first geometrical set within a part file. If you want to expand the code you
Dim body1 As Body Set body1 = partDoc1.Part.Bodies.Item Dim shapes1 As Shapes Set shapes1 = body1.Shapes Sign up to on this title shapecount = vote shapes1.count
Useful
Not useful
Dim shape1 As Shape
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 6: Use the Part Document Object Diagram
Documents
Sheet Music
Return to the part document object diagram of the .chm docum
(picture on the following page). Note that the Part object has a collection
HybridBodies. This is a collection of all the geometrical sets of the part,
programmatic name of a geometrical set is HybridBody. We wantto add Sign up to vote on this title
count the number of datum planes. A datum plane is ahybrid Not usefulshape, bu Useful
know for sure what it‟s programmatic nameais. Click on the red arrow in You're Reading Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 7: Use the HybridShape Object Diagram Documents Sheet Music
There are many classes that inherit from the abstract class HybridShape, as can b We are looking for a class that is the equivalent of a datum plane. The class HybridShapePlaneExplicit looks like the right one.
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 8: Add Code to Count Datum Planes
Documents
Sheet Music
Insert the following code below what we already have. You should get the resulti message box. For k = 1 To geocount
Set part1 = partDoc1.Part Dim hybridShapeFactory1 As HybridShapeFactory Set hybridShapeFactory1 = part1.HybridShapeFactory Dim hybridBodies1 As HybridBodies Set hybridBodies1 = part1.HybridBodies
Set datumPlane = hybridBody1.Hybri If Err.Number = 0this Then Sign up to vote on title
Useful
Not useful
count2 = count2 + 1
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 5 – Conclusion
Documents
Sheet Music
This concludes Workshop 5. In this workshop you have learned
•Use the object diagrams found in the “.chm” file to understand CATIA objects Sign up to vote on this title
Useful
Not useful
•Navigate the structure of a CATIA part document by iterating through the various collections that aapart contains You're Reading Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
WORKSHOP 6 Creating Sketch Geometry Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 6 – Creating Sketch Geometry
Documents
Sheet Music
Description
In this workshop you will explore the creation of sketch geom in a part document. The purpose of this is to illustrate the use of “fac to create objects in a part document. Sign up to vote on this title
Outline
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 1: Start Recording a Macro Documents
• Create a new part document
Sheet Music
• Start recording a new macro. • Name it “Create_Sketch_01”
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 2. Start the sketch
Documents
Sheet Music
• Start a sketch with the “Sketch” button
• Select the yz plane as the sketch Plane Sign up to vote on this title
• Create a line away from the origin that isn‟t parallel to Not the “V” axis or useful Usefulto axis You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 3: Start Commenting the Code Documents Sheet Music
Open the CATIA VBA editor code that was recorded (see good first step after recording to add comments to clearly c sequence of “stages” of the start, add the comments see call-out the first step, which i Sign up to vote on this title of the Usefulpart Not useful body. Sub CATMain() You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
CATIA V5 Macro Programming
1
Download
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 4: Comment and test the code
Documents
Sheet Music
Sub CATMain() „=============================================== „ Get the part body „===============================================
• Add these comments in o out the next “stage” in the addition of a sketch to the
Dim partDocument1 As PartDocument Set partDocument1 = CATIA.ActiveDocument Dim part1 As Part Set part1 = partDocument1.Part Dim bodies1 As Bodies Set bodies1 = part1.Bodies
• Add this “End” command will cause the macro to s Sign when up to vote title it on is this run. Useful Not useful
• Open a new part docume
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Save
Embed
Share
Print
CATIA V5 Macro Programming
1
Download
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 5: Comment and test the code Documents „===============================================
Upload
Uploaded by Tomas Lopez
145 views
Sheet Music
„ Add a sketch on the Y-Z Plane „=============================================== Dim sketches1 As Sketches Set sketches1 = body1.Sketches Dim originElements1 As OriginElements Set originElements1 = part1.OriginElements Dim reference1 As Reference Set reference1 = originElements1.PlaneYZ Dim sketch1 As Sketch Set sketch1 = sketches1.Add(reference1)
• Remove the “End” command comment to call-out the next sta • This next stage of code can be containing two parts:
1. The creation of an 9 member 2. The calling of the “SetAbsolu method.
Sign up to vote on this title
Useful Not useful The array contains the numerica
that describes a 2D axis system You're Reading a Preview positioned in 3D space.
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
CATIA V5 Macro Programming
1
Download
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 6: Replace code with simpler code
Documents
Sheet Music
Set sketch1Variant = sketch1 sketch1Variant.SetAbsoluteAxisData arrayOfVariantOfDouble1 „===============================================
• Remove the “End” command a comment to call-out the next sta creating sketch geometry
„ Creating Sketch Geometry
„=============================================== part1.InWorkObject = sketch1 Dim factory2D1 As Factory2D Set factory2D1 = sketch1.OpenEdition() Dim geometricElements1 As GeometricElements Set geometricElements1 = sketch1.GeometricElements
• The first command sets the “In Object”. Leave this command Sign up to vote on this title
Useful Not useful that • Note the GeometricElemen only used to get this Axis2D obj
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 7: Identify code for removal (1/3)
Documents
Sheet Music
Dim line2D1 As Line2D Set line2D1 = axis2D1.GetItem("HDirection") line2D1.ReportName = 1 Dim line2D2 As Line2D Set line2D2 = axis2D1.GetItem("VDirection") line2D2.ReportName = 2 Dim point2D1 As Point2D
• The commands such “line2D1.ReportName “ look peculiar. They serve no purpose. next slide for tips on investigate the purpo Sign up to vote on this title command. Useful Not useful
Set point2D1 = factory2D1.CreatePoint(20#, -20#) point2D1.ReportName = 3
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 7: Identify code for removal (2/3)
Documents
Sheet Music
• The programming object in que the class “Line2D”. Hit F2 to en object browser and search “CATIALine2D” Sign up to vote on this title
• All the“Members” of CATIALine Useful Not useful (Line2D) are listed. Right-click You're Reading a Preview “ReportName” and select “Help
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 7: Identify code for removal (3/3)
Documents
Sheet Music
• On the documentation page that co note that “Geometry2D” is the class because although “ReportName” is property of “Line2D”, this property i inherited from “Geometry2D” Sign up to vote on this title
Useful
You're a Preview • Reading The description
Not useful
of the ReportName
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
CATIA V5 Macro Programming
1
Download
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 8: Renaming and more code removal Documents Sheet Music
„===============================================
„ Creating Sketch Geometry „=============================================== part1.InWorkObject = sketch1 Dim factory2D1 As Factory2D Set factory2D1 = sketch1.OpenEdition()
• This stage of code, after modifications, is shown to
• Note that first two points a created, and it appears as the line gets created by u same coordinates of the p Sign up to vote on this title
• The “StartPoint” Useful Not usefulproperty Set axis2D1 = “EndPoint” property need sketch1.GeometricElements.Item("AbsoluteAxis") You're Reading a Preview explicitly set to the two po Dim axis2D1 As Axis2D
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
0
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 6 – Conclusion
Documents
Sheet Music
This concludes Workshop 6. In this workshop you have learned to: •Start a CATIA VBA program by first recording a macro Sign up to vote on this title
Useful
Not useful
•Record the creation of a single line in a sketch You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
145 views
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
Save
Embed
Share
Print
Download
News
Documents
Sheet Music
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
WORKSHOP 7 Using Forms in CATIA VBA Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Workshop 7 – Introduction
Documents
Sheet Music
Description
In this workshop you will learn how to use VBA forms in ord provide users with a user interface from which they can launch C VBA programs. Sign up to vote on this title
Outline
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 1a: Create a new form in the macro library
Documents
Sheet Music
• Open the CATIA VBA editor so that the myVBA macro library is visible. the “Create_Sketch_01” module is present. • Right-click on the macro library and select “Insert > UserForm” Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 1b Documents
• Name it the form “frmCreateLine” by editing the “(Name)” property. Sheet Music
• Edit the caption of the form by using the “Caption” property.
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 2: View the Code of the Form Documents Sheet Music
• With “frmCreateLine” selected in the project tree, click the “View Code” button” • Note that a code window appears. There are two drop-down menus, one that shows which object‟s code
Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 3a: View the Code of the Form Documents Sheet Music
• You need to create create a module that displays displays the form you just created. new module and name it “Show_CreateLine_ “Show_CreateLine_Form” Form”
Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 3b: View the Code of the Form
Documents
Sheet Music
Run this new macro using the “Run” button. A blank form should a the CATIA CATIA window. Click on the form with with your mouse and a message appear displaying displaying “hello”. As you can see, the form recognizes the clic it runs the code each time you you click it. Close the form by using the “x” top right corner. Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 4: Create a Text Box
Documents
Sheet Music
• Return to the form in the VBA editor, left-click and hold on the “TextBox” button of the form toolbar, and drag and drop a TextBox onto the form.
Sign up to vote on this title • Click the “View Code” button to view Useful Not useful the code of the form. Note that in the drop-down menu on the left, there are You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 5: Create a Text Box (continued)
Documents
Sheet Music
• Edit the “(Name)” property of the TextBox to “tbPointA” • Edit the “Text” property of the TextBox to be “0” (zero). This will set the TextBox so that it‟s default text that it contains is “0”.
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 5: Create a Text Box (continued)
Documents
Sheet Music
• Run the “Show_CreateLine_Form” Macro
Sign up to vote on this title
• Click on the form to trigger its Click event. Note that the message box You're Reading a Preview
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Sign In
Upload
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 6: Add More Form Objects
Documents
Sheet Music
• Drag and drop the objects pictured below onto the form. Edit their prop indicated. Label
Label
Label
Text
(Name) = lblPointA
(Name) = lblXcoord
(Name) = lblYcoord
Font = Tacoma, 12 pt, Bold
Caption = X-Coordinate
Caption = Y-Coordinate
Caption = Point A
(Name) = tbPo
Sign up to vote on this titleText = 0
Useful
Not useful
Text
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Books
Audiobooks
Magazines
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 7: Edit the “Click” Event of the Command Butto Documents Sheet Music
• Double-click the “Create Line” command button on the form.
• The code window will come up with various subroutines visible. The cursor should be blinking within the
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
0
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
9a. Insert the Code from the “Create_Sketch_01”
Documents
Sheet Music
Rather than redevelop code that creates a line in a sketch, we‟ll jus paste the code previously developed developed into the Click event of this form click the “Create_Sketch_01” “Create_Sketch_01” module to bring its code window up. the code in the code window (other than the “Sub CATMain()” CAT Main()” at the beginning and “End Sub” at the end” and hit Ctrl + C. Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
9b. Insert the Code from the “Create_Sketch_01”
Documents
Sheet Music
• Double-click Double-click on “frmCreateLine” on the project tree to bring up the form. • Double click on the “Create Line” button to bring up the form‟s code window
Sign up to vote on this title
Useful
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 10. Edit the Pasted CodeStep
Documents
Sheet Music
The goal is to edit the code that has been pasted so that when the “Create Line” clicked, a line get‟s created whose start point has the coordinates of “Point A” point has the coordinates of “Point B”
The arrows below show the correspondence between the fields of the form and t parameters of the methods that are called in the code. Sign up to vote on this title
Useful
„=============================================== „ Creating Sketch Geometry „===============================================
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
CATIA V5 Macro Programming
1
Download
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 10. Edit the Pasted CodeStep (cont.)
Documents
Sheet Music
The following replacements need to be made. Note that previously, nu values were “hard coded” in as parameters to the “CreatePoint” method we are replacing them with the properties of form objects, in this case t property of the various TextBox objects that are on the form. REPLACEMENT CODE
„============================================== „ Creating Sketch Geometry
„============================================== part1.InWorkObject = sketch1
Sign up toAs vote on this title Dim point2D1 Point2D
Set point2D1 Useful= factory2D1.CreatePoint(tbPoin Not useful tbPointAy.Text)
You're Reading a Preview
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
0
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 11. Save the VBA project and run the macro
Documents
• Highlight the VBA library on the project tree and save your chan Sheet Music
Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
0
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 12a. Create a sketch using the form
Documents
Sheet Music
• Click the “Create Line” button and you will see that a sketch appears containing a line whose coordinates match those that are in the form objects. However, the form remains open, and if you attempt to inte CATIA you are unable because the form has been shown in what is “modal” mode. It would be nice to change this so that after a sketch you could zoom in or rotate, expand the spec tree, etc. Sign up to vote on this title
Useful
You're Reading a Preview
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join
Search
Home
Saved
Upload
Sign In
Join
RELATED TITLES
0
285342729-VB-Scripting-for-CATIAV5-eBook.pdf
Uploaded by Tomas Lopez
Books
Audiobooks
Magazines
0
145 views
Save
Embed
Share
Print
Download
CATIA V5 Macro Programming
1
of 159
CATIA-V5--MacroProgramming-
VB Scripting for CATIA V5 eBook
Search document
News
Step 12b. Create a sketch using the form
Documents
Sheet Music
• Open the VBA editor and navigate to the “Show_CreateLine_Fo module and edit it as show below. Note that an argument “vbMo will be passed to the “Show” subroutine that is called on the form
Sub CATMain()
Sign up to vote on this title
Useful
You're Reading a Preview frmCreateLine.Show vbModeless
Not useful
Home
Saved
Books
Audiobooks
Magazines
News
Documents
Sheet Music
Upload
Sign In
Join