Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catia V5 change parameter values by a programmed VB Script

Status
Not open for further replies.

Michael279

Aerospace
Jan 4, 2013
6
NL
Dear All,

Currently I am using CATIA V5 R20 in which I would like to draw a scalable aircraft. I want to do that by linking the dimensions in sketches, pads, pockets, etc; to parameters which can be changed easily from the model tree.
The project group in which I am participating is writing a computer program which scales an Airbus A320, such that the scaled aircraft is able to meet a set of requirements different than the original A320 requirements. This computer program is written in Matlab.

Now my task is to automate the CATIA parts of the aircraft. Such that the values of the parameters in the CATIA parts are synchronized with the parameter values that are calculated by the MATLAB program.

I have studied the "VB Scripting for CATIA V5" book written by Emmett Ross. Furthermore I have looked into the CATIA automation documentation. In particular to the "Part Document Automation Objects" and the "Parameters Automation Objects". I did find how to create a new .CATPart file with a parameter in it, where I can specify the name and value of the parameter.
The code (written in MS VBA language) for that is below:
Sub CATMain()

Dim CATDocs As Documents
Set CATDocs = CATIA.Documents
Dim part1 As Document
Set part1 = CATDocs.Add("CATPart")
Dim rate As RealParam
Set rate = part1.Part.Parameters.CreateReal("Parameter1", 2.5)

End Sub



However I did not find how to change the value of an existing parameter yet. Which I do need for creating scalable CATParts.
Does anyone of you how to change the value of an existing parameter ?

By the way, you can only see the parameter when you have "Parameters" visible in the model tree. This can be done by:
Tools -> Options -> Infrastructure -> Part infrastructure -> Display in specification tree.

Thanks for your attention !
Best Regards,
Michael279
 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top