Monday, November 28, 2011

Learn how to write CATIA VB Script Macros: Lesson 2

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 was Lesson 1:Fundamentals where you'll learn some basic programming concepts. Lesson 2 has now been posted. We'll keep learning some fundamentals of programming but at the same time look at more example codes.

The following is a list of topics covered in CATIA Macros Lesson 2:

  • VB Script Syntax
  • Working with Collections: Count and Item number
  • How to use Save and Save As
  • GetWorkbench
  • How to use For Loops
  • Display the Density of a CATPart
  • Error Handling
  • Clear Method
  • Error Goto 0
  • Documents versus windows
  • How to create a parameter
  • How to switch to design mode
  • identifying a part versus a product

Download the tutorial free of charge and be sure to subscribe to our RSS feed for updates on future tutorials. In lesson 3 we'll be talking all about exporting, including capture the screen display as an image file in addition to exporting to Excel and PowerPoint.

Click here to download CATIA Macros:Lesson 2.ppt presentation

Learn how to write macros using our latest book: VB Scripting for CATIA V5 

Monday, November 21, 2011

CAD Viewers: Delcam Exchange

What type of files can Delcam Exchange open?
•DWG, DXF
•SOLID EDGE PAR (PART)
•CREO (PRT.#, AND
ASM.#
•CATIA
•PARASOLID, STEP, IGS
•STL
•NX (PRT)

Delcam Exchange Features and Limitations:
  • NO MEASUREMENT CAPABILITIES
  • ROTATE AND SIZE MODELS
  • SETTINGS MAY BE ADJUSTED FOR FILE IMPORT
  • SOME PROBLEMS WHEN IMPORTING CREO (PRO-E) ASSEMBLIES (MISSING PARTS)
  • HOWEVER, THE SOFTWARE SHOWS ERROR REPORT FOR TROUBLESHOOTING IMPORT.
  • VIEW MODELS AS SOLID (NOT WIREFORM)
  • BE CAREFUL NOT TO ORDER FILE TRANSLATION FROM WEB SITE ($$$). 
  • DELCAM POWERSHAPE:
  • THIS IS A VERSION OF E DRAWINGS.
  • ALLOWS SOME ON SCREEN MEASUREMENT.
  • REQUIRES REGISTRATION (FREE).
  • USE ‘IMPORT’ COMMAND (UNDER FILE) TO OPEN FILES
  • SAME INPUT AS DELCAM EXHCHANGE BUT HAS TROUBLE IMPORTING NATIVE MODELS
  • – WON’T OPEN PRO-E,
  • – PROBLEMS WITH SOME SOLID EDGE PAR FILES, ETC
  •  DelcamExchange (IGS,STEP, PART FILES)
    http://www.delcam.com/general/software/exchange.asp   

Wednesday, November 16, 2011

How does VB.net code interact with CATIA?

In order to understand how VB.net code talks to CATIA we need to answer two other questions:


First, what does dll stand for? In the world of computer software DLL stands for Dynamic Linked Libraries. These are compiled files that contain all of the functions that make CATIA V5 (or other software) perform an action. For example, when you select the “point” function in CATIA, the program calls a function inside one of the dll files that performs the action of creating a point in the V5 database. These files are both compiled and encrypted or “mangled”. This is a mechanism by which software companies can ensure that others cannot access the functions inside the dll’s. Therefore you cannot directly call the dll’s from outside applications. To allow outside applications to call these functions, extra programming needs to be done. This extra programming allows certain functions (not all of them) from the dll’s to be “exposed” to Windows and the COM object model – this is done via tlb files.


This brings us to our second question, what does tlb stand for? TLB stands for Type Library Files which are necessary for “exposing” functions to Windows. They act as maps which point to the mangled functions inside of the dll files that make CATIA V5 work. For example, DS may expose a function called Point(X,Y,Z) which takes 3 arguments (the x, y, and z values of the point). This function is defined and compiled in the type library, but it actually only points to the specific spot in one of the dll’s where the function exists to create a point. This means that for each major Release of V5, the type libraries must exactly match the dlls – therefore you need to make sure that you are using the correct versions of the type libraries when you do any automation. Any external programming IDE needs to have access to these type libraries in order.


Visual Studio, Visual Basic Express, or other applications MUST reference type library files that make the application “aware” of all of the CATIA functions that have been exposed. There are currently over 40 of these type libraries for CATIA – they are broken up by discipline (i.e. surface design, part design, etc.).  Only the type library for the discipline that you are going to use should be referenced. If you only need to automate surface design, then only “reference” the surface design type library in your programming project.


Also, please keep in mind that the type libraries are changed with each release of CATIA V5, so the correct type libraries MUST be used with the correct version of CATIA (ie, R19, R20, etc.). Not all CATIA V5 functions have been exposed in the type libraries.

Learn how to write CATIA Macros. 

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.

Wednesday, November 9, 2011

CAD Viewers: Solid Edge Viewer (SE)

Viewer for Solid Edge CAD Files
What type of files can Solid Edge Viewer read?
  • part, (.par)
  • Sheet metal (.psm)
  • assembly models (.asm)
  • Weldment assemblies (pwd)
  • Draft or drawing files (.dft)
  • Drawing files (.dwg, .dft)
  • 3D viewing and file sharing CAD models (JT)
  • Packaged collaboration files (pcf) for NX and SE
  • Metafile documents (Microsoft) CGM
  • JT files


Solid Edge Viewer Controls and Limitations

  • Rotate, size, or fit to window by selecting desired view control button from above the pressing left mouse button and dragging.
  • Printing of model picture or drawings are allowed
  • Cannot save files
  • Cannot measure drawings or models
  • Can hide or view individual components in an assembly model
  • Cannot view Parasolid, IGS, or Step files

Solid Edge 2D Drafting
  • Stand Alone Drafting Software
  • Similar to AutoCAD lite.
  • Complete 2d Drafting Capabilities.
  • Opens and saves documents as dft, dwg, dxf, 2D IGS
  • Save documents as dwg or dxf if they are to be distributed.
  • Can print drawings with included pdf printer. (SAVE AS pdf)
  • Tutorial are available

Solid Edge 2D Drafting Software
(with included 2D/3D Solid Edge Viewer )