All Frameworks Object Hierarchy This Framework Indexes
A relation computes values. A relation can belong to one of the following types:
FormulaBody = (height*width*depth)*density
ProgramBody = if (mass>2kg) { depth=2mm length=10mm } else { depth=1mm length=5mm }
CheckBody = mass<10kg
The parameters should be defined previously.
The following example shows how to retrieve the collection of relations from a newly created part document:
Dim CATDocs As Documents
Set CATDocs = CATIA.Documents
Dim part As Document
Set part = CATDocs.Add("CATPart")
Dim relations As Relations
Set relations = part.Relations
| o Property Optimizations( | ) As (Read Only) |
| o Func CreateCheck( | iName, | |
| iComment, | ||
| iCheckBody) As |
Dim CATDocs As Documents
Set CATDocs = CATIA.Documents
Dim partdoc As Document
Set partdoc = CATDocs.Add("CATPart")
Dim part As Part
Set part = partdoc.Part
Dim massCheck As Check
Set massCheck = part.Relations.CreateCheck
("maximummass",
"Ensures that the mass is less than 10 kg",
"mass<10kg")
| o Func CreateDesignTable( | iName, | |
| iComment, | ||
| iCopyMode, | ||
| iSheetPath) As |
Dim CATDocs As Documents
Set CATDocs = CATIA.Documents
Dim partdoc As Document
Set partdoc = CATDocs.Add("CATPart")
Dim part As Part
Set part = partdoc.Part
Dim designtable As DesignTable
Set designtable = part.Relations.CreateDesignTable
("dt",
"Ensures that the mass is less than 10 kg",
TRUE,
"/u/users/client/data/sheet.txt")
| o Func CreateFormula( | iName, | |
| iComment, | ||
| iOutputParameter, | ||
| iFormulaBody) As |
Dim CATDocs As Documents
Set CATDocs = CATIA.Documents
Dim partdoc As Document
Set partdoc = CATDocs.Add("CATPart")
Dim part As Part
Set part = partdoc.Part
Dim massFormula As Formula
Set massFormula = part.Relations.CreateFormula
("computemass",
"Computes the cuboid mass",
mass,
"(height*width*depth)*density")
| o Func CreateHorizontalDesignTable( | iName, | |
| iComment, | ||
| iCopyMode, | ||
| iSheetPath) As |
Dim CATDocs As Documents
Set CATDocs = CATIA.Documents
Dim partdoc As Document
Set partdoc = CATDocs.Add("CATPart")
Dim part As Part
Set part = partdoc.Part
Dim designtable As DesignTable
Set designtable = part.Relations.CreateHorizontalDesignTable
("dt",
"Ensures that the mass is less than 10 kg",
TRUE,
"/u/users/client/data/horizontalsheet.txt")
| o Func CreateLaw( | iName, | |
| iComment, | ||
| iLawBody) As |
| o Func CreateProgram( | iName, | |
| iComment, | ||
| iProgramBody) As |
Dim CATDocs As Documents
Set CATDocs = CATIA.Documents
Dim partdoc As Document
Set partdoc = CATDocs.Add("CATPart")
Dim part As Part
Set part = partdoc.Part
Dim depthProgram As Program
Set depthProgram = part.Relations.CreateProgram
("selectdepth",
"Select depth with respect to mass",
"if (mass>2kg) { depth=2mm } else { depth=1 mm }")
| o Func CreateRuleBase( | iName) As |
| o Func CreateSetOfEquations( | iName, | |
| iComment, | ||
| iFormulaBody) As |
| o Sub CreateSetOfRelations( | iParent) |
| o Sub GenerateXMLReportForChecks( | iName) |
| o Func Item( | iIndex) As |
Dim lastRelation As Relation Set lastRelation = relations.Item(relations.Count)
| o Sub Remove( | iIndex) |
relations.Remove("density")
| o Func SubList( | iFeature, | |
| iRecursively) As |
Dim Relations1 As Relations Set Relations1 = CATIA.ActiveDocument.Part.Relations' gets the collection of relations in the part Dim Body0 As AnyObject Set Body0 = CATIA.ActiveDocument.Part.Bodies.Item ( "MechanicalTool.1" ) Dim Pad1 As AnyObject Set Pad1 = Body0.Shapes.Item ( "Pad.1" ) ' gets the pad Pad.1 Dim Relations2 As Relations Set Relations2 = Relations1.SubList(Pad1, TRUE) ' gets the collection of relations that are under the pad Pad.1
Copyright © 2003, Dassault Systèmes. All rights reserved.