General InformationThis opening ID is invoked whenever you edit the type or the dimensions of a segment profile using:
If the profile edition is validated, the design of the segment is updated in the 3D area. If not, a warning message appears and the design of the segment is not modified.
Input ObjectsInput objects must be of the following types:
Context Object Parameters
SampleThe following sample illustrates how to validate the modification of a segment profile. In this example, some specific criteria of the new profile are checked before the validation of the profile modification. The profile type of the segment is retrieved using the Segment.GetProfile() method. For more information, see Electrical 3D Part Design User's Guide: Reference Information: Knowledge Packages: Electrical Methods. /* CATRule signature (do not edit) : (ThisObject : #In Segment, Parameters
: #In RuleContext, Validation : #Out Boolean) : #Void */
let EleSegment(segment)
let strProfileType(string)
let strCorner(string)
let dArea(AREA)
let dim1(LENGTH)
let dim2(LENGTH)
let dim3(LENGTH)
let dim4(LENGTH)
let newProfile(ElecProfile)
let currentProfile(ElecProfile)
let CircleProfile(ElecCircularProfile)
let EllipseProfile(ElecEllipticalProfile)
let RectangleProfile(ElecRectangularProfile)
let TruncRectangleProfile(ElecTruncatedRectangularProfile)
let ModificationStatus(boolean)
// Check New Profile
set newProfile = Parameters.GetAttributeObject("New_Segment_profile")
set strProfileType = newProfile.Elec_ProfileType
set dArea = newProfile.Elec_ProfileArea
ModificationStatus = FALSE
if(strProfileType == "Ellipse")
{
set EllipseProfile = newProfile
dim1 = EllipseProfile.Elec_MajorAxis
if(dim1 >= 10mm)
ModificationStatus = TRUE
}
else if(strProfileType == "Circle")
{
set CircleProfile = newProfile
dim1 = CircleProfile.Elec_Diameter
if(dim1 >= 10mm)
ModificationStatus = TRUE
}
else if(strProfileType == "Rectangle")
{
set RectangleProfile = newProfile
dim1 = RectangleProfile.Elec_Width
dim2 = RectangleProfile.Elec_Height
if(dim1 >= 10mm)
ModificationStatus = TRUE
}
else if(strProfileType == "TruncatedRectangle")
{
set TruncRectangleProfile = newProfile
strCorner = TruncRectangleProfile.Elec_CornerPosition
if(strCorner == "BOTTOM_RIGHT")
ModificationStatus = TRUE
}
// Check current profile
if(ModificationStatus == TRUE)
{
set ModificationStatus = FALSE
set EleSegment = ThisObject
EleSegment.GetProfile(currentProfile)
set strProfileType = currentProfile.Elec_ProfileType
set dArea = currentProfile.Elec_ProfileArea
if(strProfileType == "Ellipse")
{
set EllipseProfile = currentProfile
dim1 = EllipseProfile.Elec_MajorAxis
if(dim1 >= 10mm)
ModificationStatus = TRUE
}
else if(strProfileType == "Circle")
{
set CircleProfile = currentProfile
dim1 = CircleProfile.Elec_Diameter
if(dim1 >= 10mm)
ModificationStatus = TRUE
}
else if(strProfileType == "Rectangle")
{
set RectangleProfile = currentProfile
dim1 = RectangleProfile.Elec_Width
dim2 = RectangleProfile.Elec_Height
if(dim1 >= 10mm)
ModificationStatus = TRUE
}
else if(strProfileType == "TruncatedRectangle")
{
ModificationStatus = TRUE
set TruncRectangleProfile = currentProfile
dim1 = TruncRectangleProfile.Elec_MajorHeight
dim2 = TruncRectangleProfile.Elec_MajorWidth
dim3 = TruncRectangleProfile.Elec_MinorHeight
dim4 = TruncRectangleProfile.Elec_MinorWidth
strCorner = TruncRectangleProfile.Elec_CornerPosition
if( (strCorner <> "TOP_LEFT") OR (dim1 <= 10mm) OR (dim2 <= 10mm) OR (dim3 == 0mm) OR (dim4 == 0mm) )
ModificationStatus = FALSE
}
}
if(ModificationStatus == TRUE)
{
Parameters.Severity = 0
Parameters.Message = "Modification Allowed"
Validation = true
}
else
{
Parameters.Severity = 2
Parameters.Message = "Modification Not Allowed"
Validation = true
}
| ||||||||||||||||||||||||||||