Creating Parameters and Design Table With A Macro
Creating Parameters and Design Table With A Macro
Most of the things presented here, you will find in the tutorial “Catia V5 Parameters and Formulas Tutorial”
made by solid7 (http://2htts.com/CATBlog/index.php?catid=4&blogid=1 ), what you will see here is just
another way to do the same thing.
This tutorial is not intended to teach you how to create a macro to do a Design Table. If you will go to this link
http://www.eng-tips.com/faqs.cfm?fid=1115 you will find a lot of interesting things.
First of all we have to open a new CATPart. Be sure that you have followings settings in your Tools-Options
menu:
And
If you will create a CATScript, it will be easier for you to access the file (CATScript) through a button. You
can find how to add a macro as a Command following link bellow:
http://caav5.3ds.com/developers/auto/v5r14sp5/online/CAAScdInfUseCases/CAAInfAddi
Please read also this article to see how you can access CAAV5 website - A Great Programming Reference
Site In 3ds.com – link http://www.coe.org/newsnet/Jan06/tips.cfm
To be easy to follow the tutorial, we will create a simple rectangular box with random dimensions like in
picture below: I’ve included also a Prism.CATScript in the zip file in order to create the box.
width
height
lengthd
You will need a file named Box Table 2.txt which you have to place on the path C:\Temp\ .If you are working
under UNIX, you have to modify the paths in macros according with your operating system and also you
have to save the txt file where you declare the path in macro.
The CATScript and the text file can be founded in the zip file. Note that running this CATScript
(Param_DT.CATScript) will not create automatically links between parameters and dimensions/constrains
(you have to do it manually).
You have to modify this CATScript to create automatically these links if you want to do that.
After you will run the macro, in CATIA you will see next tree:
In the file Box Table 2.txt there are 5 columns: 3 for the dimensions – length, width and height of the box
(defined as length in the menu which is launch by Formula Button) and 2 columns for String definitions –
material and Part Number. Be careful how you write the material name to be exactly like in the Material
Library in CATIA.
Now, to assign parameters to our box, go in Sketcher and put all the constrains you need. Double click on a
constrain (lets say the width of the rectangle).
If you will push the More button you will see that the name of that constrain assigned automatically by CATIA
is Length.6 (its just an information which can be useful if you will try to modify the CATScript to link
automatically the parameters to Design Table).
To assign a parameter from our Design Table, we have to do right click on mouse and Edit Formula from the
contextual menu.
Note that in the box Value is now assigned a Formula. Click OK to finish the process.
Repeat the operations done for the Width of the rectangle. All the dimensions/constrains assigned to the
parameters will be adjusted automatically to the first configuration (line 1 in the txt file).
To apply material go to this icon and choose a material for your CATPart. Go again at Formula Button
. Highlight Material Parameter under the Pad. Repeat the assigning process choosing this time the
PartBody/Material.
In the new window select PartBody/Material as is shown in picture bellow and click Add Formula
For this, click again , choose New Parameter of Type to be String, highlight what is shown in next
picture (Part1/Part Number) and click Add Formula.
By double click on one of the Parameters, you will be able to modify the CATPart according with your Design
Table (file Box Table 2.txt). Just click on the Design Table icon and pick what you want.
Same thing can be done by double click on Configuration.
Now save your CATPart. Finally, your tree should look like this picture bellow.
To be able to create in a faster way all the formulas between your parameters and constrains it will be useful
to have also these settings in your options:
This will allow you to see constrains doing a simple right click on the mouse button, pointed to a specific
constrains which you want to add a formula:
Now you can add formula following the usual way. There is also another option which can be useful (see
picture below).
If you want, you may also have
The zip file containing this tutorial, the CATScripts files and the Design Table (in txt format)
can be founded at http://2htts.com/CATBlog/
If you want to do all of this automatically, you can open a new CATPart, run first the
Prism.CATScript (this will create a simple prism) and run Param_DT_Rels.CATScript
which will do all the job for you. This is just an example how you can automate such kind
of jobs.
Fernando - (ferdo)