If you do not wish to sign up for my free email course or purchase the VB Scripting for CATIA V5 book and all you want are some useful CATIA macros then you’re in luck! I’ve created a “Macro Pack” where you can conveniently download more than fifty of my macro codes all at once. I’ve listed each macro name, type (CATPart, CATProduct, CATDrawing, etc.), programming language (CATScript or VBA), and a brief description below. As you can see, I’ve divided each macro into a category to help you easily find the code you’re looking for.
BUY CATIA MACRO PACK NOW
SIMPLE EXAMPLES
Macro Name |
Type |
Languague |
Description |
Hello World |
Any |
CATScript |
Shows how to create your first "Hello World" macro |
Function Example |
Any |
CATScript |
Shows how to use a function |
Subroutine Example |
Any |
CATScript |
Shows how to use a subroutine |
Count and Item Example |
Any |
CATScript |
Counts the number of open documents |
Arrange Windows |
Any |
CATScript |
Shows different ways to arrange CATIA windows |
Do Until Loop |
Any |
CATScript |
Example of a Do Until Loop |
Do While Loop |
Any |
CATScript |
Example of a Do While Loop |
For Each Loop |
Any |
CATScript |
Examples of a For Each Loop |
For Next Loop |
Any |
CATScript |
Example of a For Next Loop |
Date and Time Parameter Example |
Any |
CATScript |
How to create a date and time parameter |
StartCommand Examples |
Any |
CATScript |
List of common usages of StartCommand in CATIA macros |
Hide All Planes |
Any |
CATScript |
Hides all planes |
VB SCRIPTING FOR CATIA V5: 4th Edition Exercises
Macro Name |
Type |
Languague |
Description |
4.3 Viewpoint to ISO View |
Any |
CATScript |
Switches the viewpoint to isometric view |
6.1 Delete a Geometrical Set |
CATPart |
CATScript |
How to delete a geometrical set |
8.5 Draw a Circle in Drafting Workbench |
CATDrawing |
CATScript |
Draw a 2D circle in the drafting workbench |
7.1 Delete All Deactive Features |
CATPart |
CATScript |
This CATScript macro deletes all deactive components (not including sketches) |
TOOLS OPTIONS
Macro Name |
Type |
Languague |
Description |
Change Units |
Any |
CATScript |
Changes the units from mm to inch or vice versa |
Level of Detail |
Any |
CATScript |
Changes the level of detail while rotating data |
UTILITIES
Macro Name |
Type |
Languague |
Description |
CATIA Version |
Any |
CATScript |
This macro displays the current CATIA version and service pack number |
Launch_Calculator |
Any |
CATScript |
Launches the calculator from CATIA V5 |
Compass Reset |
Any |
CATScript |
Resets the compass |
Expiry Date |
Any |
VBA |
This macro allows you to set an expiry date in which your code will not run after the set date |
Parent name |
Any |
CATScript |
Displays the parent name of a selected object |
Screen Capture |
Any |
CATScript |
This macro takes a screen shot with a white background and saves it in a folder |
What is this |
Any |
CATScript |
Returns the name and type of all selected objects |
Workbench ID |
Any |
CATScript |
Displays the workbench ID and command list |
Background to White |
Any |
CATScript |
Changes the background color to white |
Background to Purple |
Any |
CATScript |
Changes the background color to purple |
CommandList |
Any |
CATScript |
Opens the command list for the active workbench |
Search by Name |
Any |
CATScript |
Search for specified geometry by name and center graph |
DRAFTING
Macro Name |
Type |
Languague |
Description |
Dimension Precision |
CATDrawing |
CATScript |
Change all your drawing dimensions from current unit to millimeters |
Drawing Frame and Title Block |
CATDrawing |
CATScript |
Create a drawing frame and title block |
Drawing Front View |
CATDrawing |
CATScript |
Create a drawing with a front view of a CATPart |
DRW Sheet Names |
CATDrawing |
CATScript |
Rename drawing sheets based on the total number of sheets |
Move Views |
CATDrawing |
CATScript |
Moves a view within a drawing sheet |
Unlock Drawing Views |
CATDrawing |
CATScript |
This macro will lock or unlock all drawing views |
CATPART
Macro Name |
Type |
Languague |
Description |
Count Sketch Based Features |
CATPart |
CATScript |
Find all sketch based features |
Cycle Through Deactive Features |
CATPart |
CATScript |
Cycle through deactivated features |
Geometrical Set |
CATPart |
CATScript |
This macro creates a new geometrical set within a part file |
Object Update/Inactive check |
CATPart |
CATScript |
Check whether an object needs to be updated or is deactive |
Part Density |
CATPart |
CATScript |
Display the density of a part |
Join 2 Sweeps |
CATPart |
CATScript |
Joins two sweeps together |
Publish Body |
CATPart |
CATScript |
Publishes the PartBody |
Create Different Parameter Types |
CATPart |
CATScript |
Shows how to create parameters of different types |
Trapezoid |
CATPart |
CATScript |
Sketches a trapezoid shape with user input height and width on a plane selected by the user |
CATPRODUCT
Macro Name |
Type |
Languague |
Description |
Activation State |
CATProduct |
CATScript |
Returns the activation state (active or de-active) of a product |
Description |
CATProduct |
CATScript |
Returns component and reference product descriptions |
Export Spec Tree |
CATProduct |
CATScript |
Export the spec tree to either an xls or txt file |
Extract BOM |
CATProduct |
CATScript |
Extracts the BOM to a txt file |
Product to Design Mode |
CATProduct |
CATScript |
Check to see if the top level product document is in design mode |
ScrollDownTree |
CATProduct |
CATScript |
This macro will walk down the tree and display the part number for every component and if it is a part or product |
IMPORT AND EXPORT
Macro Name |
Type |
Languague |
Description |
Excel to CATIA example |
Excel |
VBA |
Creates a new product and parts in CATIA from an Excel sheet |
Email |
CATIA |
VBA |
Send an email from CATIA |
Launch Word |
Word |
VBA |
Creates and opens a new word document with the text “Welcome to your new document” |
Last updated: 10/24/2014
Purchase and Start Using the Macros Now
***MACRO PACK: EXPANDED EDITION***
The following macros are only available in the Expanded Edition of the Macro Pack sold with the All-in package of VB Scripting for CATIA V5.
Macro Name |
Type |
Languague |
Description |
Drawing Export No Details |
CATDrawing |
CATScript |
Export drawing sheets as TIF minus any detail sheets |
Two Part Comparison |
CATProduct |
CATScript |
Display changes between two parts (old version and new version of same part) |
Export Data to TXT via Stream |
Any |
CATScript |
Shows how to export data to a text file while a macro is running |
CATPart from CATProduct |
CATProduct |
CATScript |
Converts a CATProduct into a single CATPart file |
Center of Gravity |
CATProduct |
CATScript |
Finds the COG of a product |
Launch NC Workbench |
Any |
CATScript |
Launches the prismatic machining workbench |
Unhide annotations in a capture |
CATPart |
CATScript |
How to unhide annotations inside of a capture |
Publish Fastening Points |
CATPart |
CATScript |
How to publish multiple points inside of a CATPArt |
Click here to find out more about the All-in package that includes these additional macros.
Your satisfaction is important to us! Please contact us if any bugs/issues are found; fixes will be released ASAP. Screenshots, attachments, problem details, and any other information will help expedite a solution. If I add more macros in the future you will receive the update for no additional fee.
Disclaimer: Macros not guaranteed to work as is. Some codes may need slight tweaks to work for your specific application. A help file is included with the download. Should be compatible with Windows XP, Vista, 7, 32bit, 64bit & all CATIA releases. 60 day money back guarantee.
Related posts:
https://www.scripting4v5.com/ultimate-guide-to-catia-macros/
Im facing problem in scripting for selecting current linetype in drawings. The problem as below
dim linetype
linetype=clng(0)
visproperties1.getreallinetype linetype
msgbox “linetype=” &linetype
but here im getting output as linetype=0. please help me in this case
i need macros for camshaft profile in catia
I NEED MACROS TO CHANGE PART NUMBER, INSTANCE AND DESCRIPTION AT A TIME IN PRODUCT.
IS THERE ANY CHANCE TO SAVE PART FILE AUTOMATICALLY WITH PART NUMBER FOR EXISTING PART WITH THE HELP OF MACROS
Hello,
I have downloaded the macro for displaying number of parts in an assembly.
In code a function has been called named as TraverseProduct. It is mentioned over there traverseproduct code is included in your email newsletter. I have subscribed to email newsletter recently and have not recieved any mail with traverseproduct code.
So where should i look for it.
TraverseProduct is simply a recursive function to scroll down the spec tree. Here is it:
Sub TraverseProduct(oInProduct As Product)
Dim oInstances As Products
Set oInstances = oInProduct.Products
‘—–No instances found then this is CATPart
If oInstances.Count = 0 Then
Msgbox “This is a CATPart with part number ” & oInProduct.PartNumber
Exit Sub
End If
‘—–Found an instance therefore it is a CATProduct
Msgbox “This is a CATProduct with part number ” & oInProduct.ReferenceProduct.PartNumber
Dim k As Integer
For k = 1 To oInstances.Count
Dim oInst As Product
Set oInst = oInstances.Item(k)
‘apply design mode
oInstances.Item(k).ApplyWorkMode DESIGN_MODE
Call TraverseProduct(oInst)
Next
End Sub
Thanks a lot for sharing the codes
Hi,
I need a macro which generated clash report including clashing images in an excel ..
Hi,
I have recieved a macro for ScrollDownTree. In that macro procedure TraverseProduct is called.
I have the code for TraverseProduct. But TraverseProduct is created with 1 arguement, i.e. “Sub TraverseProduct(oInProduct As Product)”.
But in ScrollDownTree it is called with 2 arguments i.e. “Call TraverseProduct(oMyProduct, iLevel)”.
Is there any other version of TraverseProduct with 2 arguements?
Hello Emmett,
I would like to create multiple igs files adapting the following macro .
I tried to modify the variables save as dwg for igd files, but doesn´t work.
Could you tell me how can I fix this ?
Thanks and regards
Language=”VBSCRIPT”
Sub CATMain()
Dim oFSO
Set oFSO= CreateObject(“Scripting.FileSystemObject”)
PathToCATFiles = InputBox(“Enter path there CATDrawings-files exist” & vbCrLf, “File”, “”)
strComputer = “.”
Set objWMIService = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)
If Not oFSO.FolderExists(PathToCATFiles& “\PDF”) Then
oFSO.CreateFolder(PathToCATFiles& “\PDF”)
End If
If Not oFSO.FolderExists(PathToCATFiles& “\DWG”) Then
oFSO.CreateFolder(PathToCATFiles& “\DWG”)
End If
Set FileList = objWMIService.ExecQuery(“Associators of {Win32_Directory.Name='” & PathToCATFiles & “‘} Where ” & “ResultClass = CIM_DataFile”)
For Each objFile In FileList
If objFile.Extension = “CATDrawing” Then
On Error Resume next
Set documents = CATIA.Documents
Set drawingDocument = documents.Open(PathToCATFiles & “\” & objFile.FileName & “.” & objFile.Extension)
Set drawingDocument = CATIA.ActiveDocument
drawingDocument.ExportData PathToCATFiles & “\PDF\” & objFile.FileName & “.pdf”, “pdf”
drawingDocument.ExportData PathToCATFiles & “\DWG\” & objFile.FileName & “.dwg”, “dwg”
Set specsAndGeomWindow = CATIA.ActiveWindow
specsAndGeomWindow.Close
Set drawingDocument = CATIA.ActiveDocument
drawingDocument.Close
End If
Next
Wscript.Echo “DWG and PDF files created in subfolders to ” & PathToCATFiles
End Sub
hi, good morning,
i need basic information about macro and how to write the script, please help me
Hi. Signup for our free email course: https://www.scripting4v5.com/newsletter/
Hey where is the download option in this page to download the codes. I couldn’t find one. Please Help!!!
Hi Aron,
Looks like all my Buy Now buttons got deleted somehow. Here’s the link: https://gum.co/catiamacropack
Or check this out: http://vbpdf.website/
Emmett
hi,
i want a macro for auto dimensioning of my fixture parts. my juniors misses the dimensions while drafting. so plz let me know that is it possible to get macro which help me to automatic detailing of my fixture parts with tolerances.
I am working at customer location (Defence) .I am in need of macros to design validation (Quality inspections) CATIA V5 data.
The requirement is very simple,I wanna develop a macro that conducts user defined rule based inspection and generate a report.
Please Drop me a mail to above mentioned email ID for the further details.
I am ok to buy any of your product if you give guarantee that it serve my purpose.
Thank you
Hi,
How would I get to know what script is running for any tool in CATIA V5?
For ex. let say a “pad” is used for some sketch, now what script does it use for the same?
I need . Product tree sort
Product tree is sorting .
Can you help me
Is there a way to add a different layer to each body within a .catPART file?
As a pre cursor to STEP or IGES out without having to do each one manually ?
Thanks 🙂
Hi i want macro for creating grid line/car line in 2D.
thanks
Hello,
First off all congratulations for your work.
I need a macro for 2D, for example, I have in library some tables and I need to be imported automatically in 2D from that specific library.
Can you help me please?
Thanks…
Hi
We need a macro that could check the hole parameters like hole size,etc (also even if they are made with patterns). Also need to check hole to hole alignment.
All this can be done within a catpart or an assembly.
Need the results in excel file.
If you can help us, kindly let us know.
Hello
My name is lisa.
It’s a pleasure to see your course. I’ve recently been taking your email course. It has helped me a lot, thanks.
I saw this macro package download and it is very useful, how can I download it instead? Can you send it to my email, thank you very much. My English is not very good,But I would also like to read your course carefully.
Hello,
I am trying to update properties (Like Name and Description etc.) of product and parts in CATIA V6. I’ve done the same in V5 previously, but couldn’t do it in V6.
Any suggestions would be really helpful.
Thank you,
Dharmik
Hello,
I am trying to save dwg to pdf in the last sheet need to remove in pdf file.
Any suggestions would be really helpful.
merhaba,
ürün ağacındaki her bir parçaya _001,_002 gibi kod veren macroya ihtiyacım var.
teşekkürler…