Monday, November 14, 2011

Learn how to write CATIA VB Script Macros


Are you interested in learning how to write CATScript macros for CATIA for free? Do you find yourself often thinking "There's a better way to do this, I just don't know how to do it"? If so, then writing a macro may be the solution. There are numerous reasons why you should learn how to write macros in CATIA, including saving time and reducing the possibility of human error by automating repetitive processes. When using CATScripts the possibilities are endless. You can export to Excel, Word, ppt, txt, etc. as well as having the ability to import or export to CATDrawing files.

I have created a series of powerpoint presentations covering a variety of topics, starting from fundamentals of programming in VB script to exporting images to powerpoint and Excel files and more. This first lesson available for download is Lesson 1: Fundamentals where you'll learn some basic programming concepts. The presentation is 25 slides long and includes several example codes to help you learn by following along.

Here are a few of the basics covered in the first lesson:

  • What is VB Script
  • Why use macros
  • How to create a macro
  • How to open and run macros
  • How to add a macro library
  • How to assign an icon for your macros
  • How to record a macro
  • Recording versus writing custom code
  • CATIA VB Script fundamentals
  • Subroutines and functions
  • The CATIA Object
  • Programming Concepts
  • Simple Viewer Commands
  • Definitions
  • How to create a pop-up message box
  • How to create a yes or no input box

Download the tutorial free of charge and be sure to subscribe to our RSS feed for updates on future tutorials. In lesson 2 we'll talk about creating parameters, saving files, changing workbenches, and exporting to image capture files.

Update: Join our free email newsletter to get a copy of the macro fundamental chapter.

Click here to download CATIA Macros:Lesson 1 Fundamentals.ppt presentation

Click here for Lesson 2 

Purchase our how to write macros book: VB Scripting for CATIA V5 

Check out our new site, scripting4v5.com.

4 comments:

  1. I encountered a problem while running the macros. what happened is:
    I opened catia and from macros option, i select start recording. In part design, i am drawing a block (cube). then i stop recording and opened that macro, the same block is coming. But, if i tried the same thing for a block with rectangular or circular pattern, it shows error in running that macro. the error shown is “Set hybridShapeLineExplicit1 = hybridShapes1.Item(“X Axis”)”. can you please help me in rectifying that error, it will be useful for my project.
    thank you.

    ReplyDelete
    Replies
    1. What's the full code?

      Delete
    2. sir, i am unable to give the full code here. can you please give me your mail-id. my id is nandhaasastra@gmail.com

      Delete

I'd love to hear from you!