pycatia.knowledge_interfaces.relations¶
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-11 12:40:47.360445
Warning
The notes denoted “CAA V5 Visual Basic Help” are to be used as reference only. They are there as a guide as to how the visual basic / catscript functions work and thus help debugging in pycatia.
- class pycatia.knowledge_interfaces.relations.Relations(com_object)¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
System.IUnknownSystem.IDispatchSystem.CATBaseUnknownSystem.CATBaseDispatchSystem.CollectionRelationsRepresents the collection of relations of the part or theproduct.A relation computes values. A relation can belong to one of the followingtypes:FormulaIt combines parameters to compute the value of one output parameter only.For example, the mass of a cuboid can be the output parameter of a formula,while the value is computed using the followingparameters:FormulaBody = (height*width*depth)*densityProgramIt combines conditions and actions on parameters to compute one or severaloutput parameter values. For example, the following is aprogram:ProgramBody = if (mass>2kg) { depth=2mm length=10mm } else { depth=1mm length=5mm }CheckIt only contains conditions on parameter values. For example, the followingis a check:CheckBody = mass<10kgThe parameters should be defined previously.The following example shows how to retrieve the collection of relations from anewly created part document:Dim CATDocs As DocumentsSet CATDocs = CATIA.DocumentsDim part As DocumentSet part = CATDocs.Add(“CATPart”)Dim relations As RelationsSet relations = part.RelationsSee also:Formula, Rule, Check, DesignTable- create_check(i_name: str, i_comment: str, i_check_body: str) Check ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func CreateCheck(CATBSTR iName,CATBSTR iComment,CATBSTR iCheckBody) As CheckCreates a check relation and adds it to the part’s collection ofrelations.Parameters:iNameThe check nameiCommentA description of the checkiCheckBodyThe check definitionReturns:The created checkExample:This example creates the maximummass check relation and adds it to thenewly created part:Dim CATDocs As DocumentsSet CATDocs = CATIA.DocumentsDim partdoc As DocumentSet partdoc = CATDocs.Add(“CATPart”)Dim part As PartSet part = partdoc.PartDim massCheck As CheckSet massCheck = part.Relations.CreateCheck(“maximummass”,“Ensures that the mass is less than 10kg”,“mass<10kg”)
- Parameters:
i_name (str) –
i_comment (str) –
i_check_body (str) –
- Return type:
- create_design_table(i_name: str, i_comment: str, i_copy_mode: bool, i_sheet_path: Path) DesignTable ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func CreateDesignTable(CATBSTR iName,CATBSTR iComment,boolean iCopyMode,CATBSTR iSheetPath) As DesignTableCreates a design table based on a file organized in an vertical way andadds it to the part’s collection of relations.Parameters:iNameThe design table nameiCommentA description of the design tableiCopyModeReturns:The created design tableExample:This example creates the dt design table and adds it to the newlycreated part:Dim CATDocs As DocumentsSet CATDocs = CATIA.DocumentsDim partdoc As DocumentSet partdoc = CATDocs.Add(“CATPart”)Dim part As PartSet part = partdoc.PartDim designtable As DesignTableSet designtable = part.Relations.CreateDesignTable(“dt”,“Ensures that the mass is less than 10kg”,TRUE,“/u/users/client/data/sheet.txt”)
- Parameters:
i_name (str) –
i_comment (str) –
i_copy_mode (bool) –
i_sheet_path (Path) –
- Return type:
- create_formula(i_name, i_comment, i_output_parameter, i_formula_body)¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func CreateFormula(CATBSTR iName,CATBSTR iComment,Parameter iOutputParameter,CATBSTR iFormulaBody) As FormulaCreates a formula relation and adds it to the part’s collection ofrelations.Parameters:iNameThe formula nameiCommentA description of the formulaiOutputParameterThe parameter which stores the result of the formulaiFormulaBodyThe formula definitionReturns:The created formulaExample:This example creates the computemass formula relation and adds it tothe newly created part:Dim CATDocs As DocumentsSet CATDocs = CATIA.DocumentsDim partdoc As DocumentSet partdoc = CATDocs.Add(“CATPart”)Dim part As PartSet part = partdoc.PartDim massFormula As FormulaSet massFormula = part.Relations.CreateFormula(“computemass”,“Computes the cuboid mass”,mass,“(height*width*depth)*density”)
- create_horizontal_design_table(i_name: str, i_comment: str, i_copy_mode: bool, i_sheet_path: str) DesignTable ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func CreateHorizontalDesignTable(CATBSTR iName,CATBSTR iComment,boolean iCopyMode,CATBSTR iSheetPath) As DesignTableCreates a design table based on a file organized in an horizontal way andadds it to the part’s collection of relations.Parameters:iNameThe design table nameiCommentA description of the design tableiCopyModeReturns:The created design tableExample:This example creates the dt design table and adds it to the newlycreated part:Dim CATDocs As DocumentsSet CATDocs = CATIA.DocumentsDim partdoc As DocumentSet partdoc = CATDocs.Add(“CATPart”)Dim part As PartSet part = partdoc.PartDim designtable As DesignTableSet designtable = part.Relations.CreateHorizontalDesignTable(“dt”,“Ensures that the mass is less than 10kg”,TRUE,“/u/users/client/data/horizontalsheet.txt”)
- Parameters:
i_name (str) –
i_comment (str) –
i_copy_mode (bool) –
i_sheet_path (str) –
- Return type:
- create_law(i_name: str, i_comment: str, i_law_body: str) Law ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func CreateLaw(CATBSTR iName,CATBSTR iComment,CATBSTR iLawBody) As LawCreates a law relation and adds it to the part’s collection ofrelations.Parameters:iNameThe law nameiCommentA description of the lawiLawBodyThe law definitionReturns:The created law
- Parameters:
i_name (str) –
i_comment (str) –
i_law_body (str) –
- Return type:
- create_program(i_name: str, i_comment: str, i_program_body: str) Rule ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func CreateProgram(CATBSTR iName,CATBSTR iComment,CATBSTR iProgramBody) As RuleCreates a program relation and adds it to the part’s collection ofrelations.Parameters:iNameThe program nameiCommentA description of the programiProgramBodyThe program definitionReturns:The created programExample:This example creates the selectdepth program relation and adds it tothe newly created part:Dim CATDocs As DocumentsSet CATDocs = CATIA.DocumentsDim partdoc As DocumentSet partdoc = CATDocs.Add(“CATPart”)Dim part As PartSet part = partdoc.PartDim depthProgram As ProgramSet depthProgram = part.Relations.CreateProgram(“selectdepth”,“Select depth with respect tomass”,“if (mass>2kg) { depth=2mm } else { depth=1 mm}”)
- Parameters:
i_name (str) –
i_comment (str) –
i_program_body (str) –
- Return type:
- create_rule_base(i_name: str) Relation ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func CreateRuleBase(CATBSTR iName) As RelationCreates a rulebase.Parameters:iNameThe name of the rulebase.Returns:The created rulebase.See also:ExpertRuleBase
- Parameters:
i_name (str) –
- Return type:
- create_set_of_equations(i_name: str, i_comment: str, i_formula_body: str) SetOfEquation ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func CreateSetOfEquations(CATBSTR iName,CATBSTR iComment,CATBSTR iFormulaBody) As SetOfEquationCreates a set of equations.Parameters:iNameThe name of the set of equation.iCommentThe comment of the set of equation.iFormulaBodyThe body of the set of equation “ a==b+4; c ≤ 90”.Returns:The created set of equations
- Parameters:
i_name (str) –
i_comment (str) –
i_formula_body (str) –
- Return type:
- create_set_of_relations(i_parent: AnyObject) None ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Sub CreateSetOfRelations(AnyObject iParent)Creates a set of relations and appends it to a parentobject.Parameters:iParentThe object to which the set is appended
- Parameters:
i_parent (AnyObject) –
- Return type:
None
- generate_xml_report_for_checks(i_name: str) None ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Sub GenerateXMLReportForChecks(CATBSTR iName)Generates an XML Report on all checks in the currentdocument.Parameters:iNameThe name of the XML file
- Parameters:
i_name (str) –
- Return type:
None
- item(i_index: cat_variant) Relation ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func Item(CATVariant iIndex) As RelationRetrieves a relation using its index or its name from the Relationscollection.Parameters:iIndexThe index or the name of the relation to retrieve from thecollection of relations. As a numerics, this index is the rank of the relationin the collection. The index of the first relation in the collection is 1, andthe index of the last relation is Count. As a string, it is the name youassigned to the relation using theAnyObject.Name property or when creating the relation.Returns:The retrieved relationExample:This example retrieves the last relation in the relationscollection.Dim lastRelation As RelationSet lastRelation = relations.Item(relations.Count)
- Parameters:
i_index (cat_variant) –
- Return type:
- property optimizations: Optimizations¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
- o Property Optimizations() As Optimizations (Read Only)Returns the optimization collection.It can be empty if no optimization is defined in thedocument.This property is available only when the Product Engineering Optimizerlicense is available.
- Return type:
- remove(i_index: cat_variant) None ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Sub Remove(CATVariant iIndex)Removes a relation from the Relations collection.Parameters:iIndexThe index or the name of the relation to remove from the collectionof relations. As a numerics, this index is the rank of the relation in thecollection. The index of the first relation in the collection is 1, and theindex of the last relation is Count. As a string, it is the name you assignedto the relation using theAnyObject.Name property or when creating the relation.Example:This example removes the relation named density from the relationscollection.relations.Remove(“density”)
- Parameters:
i_index (cat_variant) –
- Return type:
None
- sub_list(i_feature: AnyObject, i_recursively: bool) Relations ¶
Note
- CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
- o Func SubList(AnyObject iFeature,boolean iRecursively) As RelationsReturns a sub-collection of relations aggregated to anobject.Parameters:iFeatureThe object used to filter the the whole relation collection to getthe resulting sub-collection.iRecursivelyA flag to specify if children parameters are to be searched for inthe returned collectionReturns:The resulting sub-collectionExample:This example shows how to get a collection of relations that are undera PadDim Relations1 As RelationsSet Relations1 = CATIA.ActiveDocument.Part.Relations’ gets the collection of relations in thepartDim Body0 As AnyObjectSet Body0 = CATIA.ActiveDocument.Part.Bodies.Item ( “MechanicalTool.1” )Dim Pad1 As AnyObjectSet Pad1 = Body0.Shapes.Item ( “Pad.1” ) ‘ gets the pad Pad.1Dim Relations2 As RelationsSet Relations2 = Relations1.SubList(Pad1, TRUE) ‘ gets the collection of relations that areunder the pad Pad.1