All Frameworks Object Hierarchy This Framework Previous Next Indexes
IUnknown | +---IDispatch | +---CATBaseUnknown | +---CATBaseDispatch | +---Collection | +---Relations
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 CATIAOptimizations (Read Only) |
o Func CreateCheck( | CATBSTR | iName, |
CATBSTR | iComment, | |
CATBSTR | iCheckBody) As CATIACheck |
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( | CATBSTR | iName, |
CATBSTR | iComment, | |
boolean | iCopyMode, | |
CATBSTR | iSheetPath) As CATIADesignTable |
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( | CATBSTR | iName, |
CATBSTR | iComment, | |
CATIAParameter | iOutputParameter, | |
CATBSTR | iFormulaBody) As CATIAFormula |
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( | CATBSTR | iName, |
CATBSTR | iComment, | |
boolean | iCopyMode, | |
CATBSTR | iSheetPath) As CATIADesignTable |
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( | CATBSTR | iName, |
CATBSTR | iComment, | |
CATBSTR | iLawBody) As CATIALaw |
o Func CreateProgram( | CATBSTR | iName, |
CATBSTR | iComment, | |
CATBSTR | iProgramBody) As CATIAProgram |
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( | CATBSTR | iName) As CATIARelation |
o Func CreateSetOfEquations( | CATBSTR | iName, |
CATBSTR | iComment, | |
CATBSTR | iFormulaBody) As CATIASetOfEquation |
o Sub CreateSetOfRelations( | CATIABase | iParent) |
o Sub GenerateXMLReportForChecks( | CATBSTR | iName) |
o Func Item( | CATVariant | iIndex) As CATIARelation |
Dim lastRelation As Relation Set lastRelation = relations.Item(relations.Count)
o Sub Remove( | CATVariant | iIndex) |
relations.Remove("density")
o Func SubList( | CATIABase | iFeature, |
boolean | iRecursively) As CATIARelations |
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.