DistanceWireProductThe DistanceWireProduct user function can be used in Knowledge Expert. SyntaxDistanceWireProduct (Wire1: Wire, Object: Product):LengthReturns the minimum length between a conductor and a product in session. The product must contain at least one 3D shape. Example 1The DistanceWireProduct user function can be used with the f(x) command to display the distance between a wire and a component in the session. This formula:DistanceWireProduct(EB.1\Wire.1 ,GB1.1\Muffler.1 )returns the following value: 171.964mm Example 2The DistanceWireProduct user function can be used in Knowledge Expert to find all the wires in the session that have a minimum distance to defined components smaller than a critical value chosen by the user. The components can be defined as heat-resistant. Properties have been added to the product (load the ElectricalMeasure package) and to the conductors (set theSeparation Codeto NOT_HEAT_RESISTANT). DistanceWireProduct(EB.1\Wire.1 ,GB1.1\Muffler.1 )returns the following value: 171.964mm A check is defined as follows: /*Check created by xxx 11/27/2007*/ (Object > HasAttribute('Zone') ) and (Object > GetAttributeString('Zone')== 'HOT' and mywire\Elec_Sep_Cod == 'NOT_HEAT_RESISTANT') => ( DistanceWireProduct (mywire,Object)> 130.00mm) Updating the session displays a status light on the check.
A report is generated showing the check result: some wires verify
the condition, other not.
Example 3The DistanceWireProduct user function can be used in Knowledge Advisor to define a rule that displays a warning message if a minimum distance between a conductor and an object is smaller than a critical value chosen by the user.if( DistanceWireProduct (EB.1\Wire.22 ,GB1.1\Muffler.1 )<Critical_Distance and Muffler\Properties\Zone == "HOT" and 'EB1\Wire.22\Separation Code' == "NOT_HEAT_RESISTANT" Message(" > WARNING: # is not heat-resistant and the minimum distance with # is smaller than the critical distance #. ",'Wire.22\Part Number' , 'Muffler\PartNumber' ,Critical_Distance) Running this rule displays the following message: Rule.2: Information WARNING: Wire.22 is not heat-resistant and the minimum distance with Muffler is smaller than the critical distance 303.648mm. Example 4Still in Knowledge Advisor, an action can be defined using the DistanceWireProduct user function, to know the distance between a conductor and an object selected in the specification tree:Inputs: a: Wire, b: Product Message("The distance between the wire '#' and the product '#' is #.", a.Name,b.Name, DistanceWireProduct(a,b) )Run the action using the Action.1 contextual menu: select a conductor and a product in the specification tree then validate. This message displays: Action.1: Information The distance between the wire 'Wire.1' and the product 'Muffler.1' is 171.964mm. Elec_DistanceCommonThe Elec_DistanceCommon user function can be used in Knowledge Expert. SyntaxElec_DistanceCommon ((Wire1: Wire, Wire2: Wire):LengthReturns the common length of the two conductors given as input arguments. The type of Wire1 and Wire2 is ElecWire. Example 1The Elec_DistanceCommon user function can be used in Knowledge Expert to find all the couples of conductors in the session that have a common length greater than a given value./*Rule created by xxx 11/27/2007*/ if(a>b) and Elec_DistanceCommon (a,b)> 400mm) Message("# and # have a common length. It is equal to ",a.Name,b.Name,round(Elec_DistanceCommon(a,b)*1000),"mm.") Example 2In Knowledge Advisor, it can be used to define a rule giving the common length of two specific conductors sharing properties./*Rule created by xxx 11/27/2007*/ if(Elec_DistanceCommon('Wire Harness1.1\Wire-check','Wire Harness1.1\Wire-minus3')>400mm) Message("The specified wires, ",'Wire_Harness1\Wire-check1\Reference_designator'," and ",'PN-AMP-3403B.2\Part_Number',",whose separation code is set to Wet, have a common length greater than 400mm: namely " ,(Elec_DistanceCommon('Wire Harness1.1\Wire-check1','Wire Harness1.1\Wire-minus3')))Applying the rule displays the following message if the condition is met: The specified wires, Wire-check1 and PN-AMP-3403B.2, whose separation code is set to Wet, have a common length greater than 400 mm: namely 407.069mm Example 3Still in Knowledge Advisor, to verify that two conductors selected in the specification tree have a common length, the following action can be defined:/**/ Message("The common length between # and # is equal to " ,a.Name,b.Name, Elec_DistanceCommon(a,b),".")then select two conductors in the specification tree and click OK to validate. The following message displays: The common length between Wire-minus2 and Wire-check1 is equal to 332.17mm. ElectricalConnectThe ElectricalConnect user function can be used in Knowledge Expert. This function exposed on Device instance, used to connect two device instances. SyntaxElectricalConnect ((PLMProductInstanceDS DeviceInstance, String ConnectionPointName, PLMProductInstanceDS DeviceInstanceToConnectTo, String ToConnectionPointName)): BooleanExampleDev1: PLMProductInstanceDS Dev2: PLMProductInstanceDS Let Dev1Name(STRING) Let Dev2Name(STRING) Let bConnected(Boolean) Dev1Name = Dev1.PLM_ExternalID Dev2Name = Dev2.PLM_ExternalID bConnected = ElectricalConnect (Dev1,"BackshellCnctPt.1",Dev2,"BackshellCnctPt.1") if(bConnected == true) { Message("Connected") } ElectricalDisconnectListAllOuterLayerObjectsThe ListAllOuterLayerObjects user function can be used in Knowledge Expert. SyntaxListAllOuterLayerObjects(ElecBundleSegmentExtremity:Feature,Offset:Real,ListOfAllCoveringProducts(Protections/Supports):out List): BooleanReturns an ordered list of protective coverings and supports that cover the segment at the point of interest. The point of interest is defined by specifying from which end of the segment and entering an offset in mm. ExampleA check (in KWE advanced language) to determine the protective coverings and supports at 150 mm from end 1 (Extremity 1) of the segment is written as follows:mysegment:Segment let ListCovering(List) let ListCovered(List) let return(Boolean) let NbCovering(INTEGER) let NbCovered(INTEGER) let Offset(Real) let CoveringObject(String) let CoveredObject(String) let i(INTEGER) let Offset(Real) let Extremity1(BundleSegmentExtremity) let Extremity2(BundleSegmentExtremity) Message("OBJECT = #",mysegment > Name()) mysegment.Elec_BundleSegmentExtremities(Extremity1,Extremity2) Message("#### TEST ListAllOuterLayerObjects ####") Offset = 150 return = ListAllOuterLayerObjects(Extremity1,Offset,ListCovering) NbCovering = ListCovering_>Size() Message("Number of covering objects = "",NbCovering) i = 1 for i while i<=NbCovering { CoveringObject = ListCovering > GetItem(i) Message("Covering Object: #",CoveringObject) } ListDirectlyCoveredObjectsThe ListDirectlyCoveredObjects user function can be used in Knowledge Expert. SyntaxListDirectlyCoveredObjects((Protection/Support):Feature, ListOfCoveredProducts(BundleSegments/Protections/Supports): out List): BooleanReturns the list of segments, protective coverings and/or supports directly under the component (protective covering or support) you want to analyze. If the component you want to analyze is not a protective covering or a support, the list returned will be empty. Example![]()
A check (in KWE advanced language) to determine the list of segments, protective coverings and supports under corrugated tube C is written as follows: myprotection:Protection let ListCovered(List) let return(Boolean) let NbCovered(INTEGER) let Offset(Real) let CoveredObject(String) let i(INTEGER) return = ListDirectlyCoveredObjects(mysegment, ListCovered) NbCovered = ListCovered > Size() Message("Component analyzed: #",myprotection > Name()) Message("Number of objects covered = #",NbCovered) i = 1 for i while i<=NbCovered{ CoveredObject = ListCovered > GetItem(i) Message("Covered Object: #",CoveriedObject) }Running this check returns:
ListDirectlyOuterLayerObjectsThe ListDirectlyOuterLayerObjects user function can be used in Knowledge Expert. SyntaxListDirectlyCoveredObjects((BundleSegment/Protection/Support):Feature, ListOfCoveringProducts(Protections/Supports): out List): BooleanReturns the list of outer layers of protective coverings and/or supports directly over the component (segment, protective covering or support) you want to analyze. If the component you want to analyze is not a segment, protective covering or a support, the list returned will be empty. Example![]()
A check (in KWE advanced language) to determine the list of outer layers that directly cover the segment in the example is written as follows: mysegment:Segment let ListOuterLayer(List) let return(Boolean) let NbOuterLayer(INTEGER) let Offset(Real) let OuterLayerObject(String) let i(INTEGER) return = ListDirectlyOuterLayerObjects(mysegment, ListOuterLayer) NbOuterLayer = ListOuterLayer > Size() Message("Component analyzed: #",mysegment > Name()) Message("Number of outer layers = #",NbOuterLayer) i = 1 for i while i<=NbOuterLayer{ OuterLayerObject = ListOuterLayer > GetItem(i) Message("Outer Layer: #",OuterLayerObject) }Running this check returns:
ListElectricalConnectedObjectsThe ListElectricalConnectedObjects user function can be used in Knowledge Expert. This function exposed on Device instances, used to get the List of connected objects with the device instance. SyntaxListElectricalConnectedObjects (in DeviceInstance: VPMInstance,in ConnectionPointName: String, out ListConnectedDevice: List, // list of connected devices out List ConnectedConnectionPoint: List, // list of names of connected connection points out ListConnectionActivity: List // New Argument, list of activities (boolean) of connections ):Boolean New argumentsDeviceInstance - Input parent device instance ConnectionPointName - Name of connection point to be analyzed ListConnectedDevice - List of all devices connected to input device through input connection point ListConnectedConnectionPoint - List of names of all connection points connected to input connection point ListConnectionActivity - List of activity of connections in which input connection point is an element All the output list will be one to one synchronized Function Return (Boolean) - True if the analysis is successful, False otherwise. ExampleCommon example for ListElectricalConnectionPointsNames and ListElectricalConnectedObjects. See below. ListElectricalConnectionPointsNamesThe ListElectricalConnectionPointsNames user function can be used in Knowledge Expert. This function is exposed on Device instances, used to get the List of connection point names and list of connection types in the device instance. SyntaxListElectricalConnectionPointsNames (PLMProductInstanceDS DeviceInstance, out List ListOfNames, out List ListOfTypes):BooleanExampleCommon example for ListElectricalConnectionPointsNames and ListElectricalConnectedObjects. Dev1: PLMProductInstanceDS let ListCxn(LIST) let ListCxnType(LIST) let ListConnectedDev(LIST) let ListConnectedCxnPtNames(LIST) let ListCxnActivity(LIST) let Size (Integer) let i(Integer) let iCxn(Integer) let sizeCxn(Integer) let Boolean(Boolean) let NewLine(STRING) let CxnName(STRING) let CxnType(STRING) let sMessage(STRING) let ConnectedDev(FEATURE) let ConnectedCxn(STRING) NewLine = "" sMessage = "" Boolean = ListElectricalConnectionPointsNames (Dev1, ListCxn, ListCxnType) if(Boolean == true) { sMessage = sMessage + " " + Dev1.PLM_ExternalID + NewLine Size = ListCxn->Size() if(Size == ListCxnType->Size()) { sMessage = sMessage + "Number of connection Points = " + ToString(Size) + NewLine i = 1 for i while i<= Size { CxnName = ListCxn->GetItem(i) CxnType = ListCxnType->GetItem(i) Boolean = ListElectricalConnectedObjects (Dev1,CxnName, ListConnectedDev, ListConnectedCxnPtNames, ListCxnActivity) if(true == Boolean) { sizeCxn = ListConnectedDev->Size() if( (sizeCxn == ListConnectedCxnPtNames->Size()) AND (sizeCxn == ListCxnActivity->Size()) ) { sMessage = sMessage + ToString(i) + ": " + CxnName + " (" + CxnType + ") Connected to - " + ConnectedDev.Name + " -> " + ConnectedCxn + NewLine iCxn = 1 for iCxn while iCxn <= sizeCxn { set ConnectedDev = ListConnectedDev->GetItem(iCxn) if(NULL <> ConnectedDev) { set ConnectedCxn = ListConnectedCxnPtNames->GetItem(iCxn) bCxnActivity = ListCxnActivity->GetItem(iCxn) if(true == bCxnActivity) sCxnActivity = "true" else sCxnActivity = "false" sMessage = sMessage + NewLine + ToString(iCxn) + ConnectedDev.Name + " -> " + ConnectedCxn + "Activity" + sCxnActivity + NewLine } } sMessage = sMessage + NewLine } } else sMessage = sMessage + ToString(i) + ": " + CxnName + " (" + CxnType + ") Not Connected" + NewLine } } Message("#",sMessage) } ListElectricalWiresThe ListElectricalConnectionPointsNames user function can be used in Knowledge Expert. This function is exposed on Device instances, used to get the List of conductors connected to the device and list of connection point names with which wire is connected with the device instance. ListUsedSupportsThe ListUsedSupports user function can be used in Knowledge Expert. SyntaxListUsedSupports(Segment: Segment, Supports: out List): Boolean Package: ElectricalFunctions)Returns the list of supports through which a segment or electrical branch geometry is routed. ExampleThe example shows an electrical branch geometry containing two segments, each routed through seven supports.![]() A rule (in KWE advanced language) to determine the number and names of the supports through which each segment is routed is written as follows: bns : Segment let SupportList(List) let return(Boolean) let i(INTEGER) let UsedSupport(String) let NbUsedSupports(INTEGER) return = ListUsedSupports(bns, SupportList) Message("Segment: #",bns > Name()) NbUsedSupports = SupportList > Size() Message("No. Used Supports = #",NbUsedSupports) i = 1 for i while i<=NbUsedSupports{ UsedSupport = SupportList > GetItem(i) Message("Used Support: #",UsedSupport ) }Solving this rule returns:
ListUsedSupportWithAbscissaThe ListUsedSupportWithAbscissa user function can be used in Knowledge Expert. SyntaxListUsedSupportWithAbscissa (iBundleSegment: Bundle Segment, oSupportList: List, oEntryPointAbscissa: List, oExitPointAbscissa; List): BooleanReturns the list of supports in the order in which they are located along the center curve of the segment from the first end of the specified segment. Two other lists are output: entry point coordinates and exit point coordinates for each support. SyntaxListUsedSupportWithAbscissa (iBranchableBundle: Branchable Bundle Segment, oSupportList: List, oEntryPointAbscissa: List, oExitPointAbscissa; List): BooleanReturns the list of supports in the order in which they are located along the center curve of the branch from the first end of the specified segment. Two other lists are output: entry point coordinates and exit point coordinates for each support. ExampleAn expert rule (created using Knowledge Expert) to determine the list of all the supports located along all segments in the document that also outputs support entry and exit point coordinates:bs:Branch let SptList(List) let inList(List) let outList(List) let ret(Boolean) let i(INTEGER) ret = ListUsedSupportsWithAbscissa (bs, SptList, outList, inList) Message("BS=",bs > Name()) i=1 for i while i<=(SptList > Size()){ Message("Abs In #, Abs Out #",outList > GetItem(i), inList > GetItem(i)) } |