Creating Parameters and Design Table with a Macro

13
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: Infrastructure - Adding a Macro as a Command in a Toolbar http://caav5.3ds.com/developers/auto/v5r14sp5/online/CAAScdInfUseCases/ CAAInfAddi

Transcript of Creating Parameters and Design Table with a Macro

Page 1: 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:

Infrastructure - Adding a Macro as a Command in a Toolbar

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

Another example how to use Parameters is in CAAGsiCreateStair.CATScript which is located in the CAAScdGsiUseCases module at the same web site.

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.

Page 2: Creating Parameters and Design Table with a Macro

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.

Let’s start to create our box. Go in Sketcher and draw a rectangle.

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).

lengthd

width

height

Page 3: Creating Parameters and Design Table with a Macro

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.

New window will pop-up.

Page 4: Creating Parameters and Design Table with a Macro

Go to Length (in Members of Parameters) and scroll down to the Width and double click on it. Now you should see this picture.

Click OK. New window will pop-up

Note that in the box Value is now assigned a Formula. Click OK to finish the process.

Same thing has to be done for the length of the rectangle.

Page 5: Creating Parameters and Design Table with a Macro

Exit from Sketcher when you finish and create a Pad with a random value for Length (I choose 200 for this example)

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

Choose material (double click) according to next picture.

Page 6: Creating Parameters and Design Table with a Macro

Click OK. A new parameter is added.

Now your tree should look like this.

Page 7: Creating Parameters and Design Table with a Macro

Now we have to assign the last parameter which will give us the name of the CATPart.

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.

As already shown, double click on config.

Click OK and once again OK to exit Formula Editor.

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.

Page 8: Creating Parameters and Design Table with a Macro

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:

Page 9: Creating Parameters and Design Table with a Macro

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).

Page 10: Creating Parameters and Design Table with a Macro

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.

Enjoy your CATIA and my Best Regards

Fernando - (ferdo)