ASD Utility Functions

This page discusses:

ComputeGlobalAxisOrientedBoundingBox

ComputeGlobalAxisOrientedBoundingBox() retrieves the 3D bounding box of the panel (standard orientation: SRS). The bounding box computation only considers the geometry (solid, surface, wire, vertex) that is in the show space. Axis systems, planes are ignored.

Signature

ComputeGlobalAxisOrientedBoundingBox(ProductOccurrence : Feature, X min : Real, X max : Real, Y min : Real, Y max : Real, Z min : Real, Z max : Real) : Boolean

Arguments

Name Input/Output Required? Type Comment
ProductOccurrence In Feature

Only Product Occurrence is supported.

X min Out Real

X coordinate of the Box minima.

X max Out Real

X coordinate of the Box maxima.

Y min Out Real

Y coordinate of the Box minima.

Y max Out Real

Y coordinate of the Box maxima.

Z min Out Real

Z coordinate of the Box minima.

Z max Out Real

Z coordinate of the Box maxima.

ReturnType

Boolean

Example

//computes the bounding box oriented along the global axis for the object
let iObject(ProductOccurrence)
let xmin(Real)
let xmax(Real)
let ymin(Real)
let ymax(Real)
let zmin(Real)
let zmax(Real)
ComputeGlobalAxisOrientedBoundingBox(iObject,xmin,xmax,ymin,ymax,zmin,zmax)

ComputeNearestSRSPlaneInfo

ComputeNearestSRSPlaneInfo() extracts a string name, category, and origin point of a SRS plane from coordinate and Looking Direction.

Signature

ComputeNearestSRSPlaneInfo(Mode(1:Frame, 2:Longitudinal, 3:Deck) : Integer, X : Real, Y : Real, Z : Real, SRS Short name : String, SRS Category : String, SRS Origin X : Real, SRS Origin Y : Real, SRS Origin Z : Real) : Boolean

Arguments

Name Input/Output Required? Type Comment
Mode(1:Frame, 2:Longitudinal, 3:Deck) In Integer

Defines the looking direction:

  1. Frame
  2. Longitudinal
  3. Deck

X In Real

X coordinate of input point.

Y In Real

Y coordinate of input point.

Z In Real

Z coordinate of input point.

SRS Short name Out String

The name of SRS plane.

SRS Category Out String

The category of SRS plane.

SRS Origin X Out Real

X coordinate of SRS plane origin.

SRS Origin Y Out Real

Y coordinate of SRS plane origin.

SRS Origin Z Out Real

Z coordinate of SRS plane origin.

ReturnType

Boolean

Example

//find the nearest SRS plane as a string from 3d point and direction
let Mode(Integer)
let Reference_X(Real)
let Reference_Y(Real)
let Reference_Z(Real)
let Origin_X(Real)
let Origin_Y(Real)
let Origin_Z(Real)
let SRS_Name(string)
let SRS_Category(string)

/*
direction 1: Frame
direction 2: Long
direction 3: Deck
*/

Reference_X=100
Reference_Y=100
Reference_Z=100
Mode=1
ComputeNearestSRSPlaneInfo(Mode,Reference_X,Reference_Y,Reference_Z,SRS_Name,SRS_Category,Origin_X,Origin_Y,Origin_Z)

ComputeNormalAtCenterOfLargestPanelFace

ComputeNormalAtCenterOfLargestPanelFace() computes a plane on the largest face on the Structure panel. The plane origin is the estimated center of the largest face.

Signature

ComputeNormalAtCenterOfLargestPanelFace(Structure Panel : Feature, PointX : Real, PointY : Real, PointZ : Real, NormalX : Real, NormalY : Real, NormalZ : Real) : Boolean

Arguments

Name Input/Output Required? Type Comment
Structure Panel In Feature

Structure Panel on which the plane is to be computed. Only Product Occurrence is supported.

PointX Out Real

X coordinate of the center point of the largest plane of the panel.

PointY Out Real

Y coordinate of the center point of the largest plane of the panel.

PointZ Out Real

Z coordinate of the center point of the largest plane of the panel.

NormalX Out Real

X coordinate of the plane normal direction.

NormalY Out Real

Y coordinate of the plane normal direction.

NormalZ Out Real

Z coordinate of the plane normal direction.

ReturnType

Boolean

Example

// Input for the function should be a Product occurrence
let StructPanel(ProductOccurrence)
let Pointx(Real)
let Pointy(Real)
let Pointz(Real)
let Normalx(Real)
let Normaly(Real)
let Normalz(Real)
Let funRetVal(Boolean)

funRetVal = ComputeNormalAtCenterOfLargestPanelFace(StructPanel,Pointx,Pointy,Pointz,Normalx,Normaly,Normalz)
if (funRetVal == false)
{
Trace (2, \"Unable to compute the plane #\", StructPanel.Name)
} 

FormatDimensionToString

Format a Dimension as a String with a specified user unit, number of decimals, and other optional arguments.

Signature

FormatDimensionToString(Dimension : Magnitude, Unit : String, Number Of Decimals : Integer, Remove Trailing Zeroes : Boolean, Show Unit : Boolean, Decimal Separator : String) : String

Arguments

Name Input/Output Required? Type Comment
Dimension In Magnitude

A dimension of any magnitude (Length, Angle, ...), or a Real

Unit In String

Any existing unit symbol ('mm', 'm', 'in', and 'kg'.).

For units without symbols, there are special names: 'feet-inch-fraction/16', 'feet-inch-fraction/64' and 'feet-inch-decimal'

Number Of Decimals In Integer

Number of decimals to display. Input value is rounded to the nearest value if required.

Remove Trailing Zeroes In Boolean

Indicates if trailing zeros must be displayed (TRUE) or not (FALSE)

TRUE by default

Show Unit In Boolean

Indicates if the unit symbol must be displayed (TRUE) or not (FALSE)

FALSE by default

Decimal Separator In String

Indicates the decimal separator to use (for example, ',' or '.')

Separator is system locale dependent by default

ReturnType

String

Example

Message("12.35mm to millimeters, 0 decimals: ", FormatDimensionToString(12.35mm,"mm",0) ) // 12 
Message("12.35mm to millimeters, 1 decimal: ", FormatDimensionToString(12.35mm,"mm",1) ) // 12.4 
Message("100mm to inches, without decimals: ", FormatDimensionToString(100mm,"in",0) ) // 4 
Message("100mm to inches, 2 decimals: ", FormatDimensionToString(100mm,"in",2) ) // 3.94 
Message("123.5mm to Feet,Int,Fraction/16: ", FormatDimensionToString(123.5mm\"feet-inch-fraction/16",0) ) // 4" 7/8 
Message("123.5mm to Feet,Int,Decimal: ", FormatDimensionToString(123.5mm,"feet-inch-decimal",0) ) // 4.862" 
Message("12350g to kilograms, 3 decimals: ", FormatDimensionToString(12350g,"kg",3) ) // 12.350 
Message("12350g to kilograms, 3 decimals, strip trailing zeroes, show units: ", FormatDimensionToString(12350g,"kg",3, TRUE, TRUE) ) // 12.35kg
Message("0.886 to ratio, 2 decimal, show units, force ',' separator : ", FormatDimensionToString(0.886,"%",2,FALSE,TRUE,",") ) // 88,60%

FormatDimensionToString

You can specify Dimension string, format, and unit.

Signature

FormatDimensionToString(Dimension : Magnitude, Unit : String, Number Of Decimals : Integer, Remove Trailing Zeroes : Boolean, Show Unit : Boolean) : String

Arguments

Name Input/Output Required? Type Comment
Dimension In Magnitude -
Unit In String -
Number Of Decimals In Integer -
Remove Trailing Zeroes In Boolean -
Show Unit In Boolean -

ReturnType

String

FormatDimensionToString

Signature

FormatDimensionToString(Dimension : Magnitude, Unit : String, Number Of Decimals : Integer, Remove Trailing Zeroes : Boolean) : String

Arguments

Name Input/Output Required? Type Comment
Dimension In Magnitude -
Unit In String -
Number Of Decimals In Integer -
Remove Trailing Zeroes In Boolean -

ReturnType

String

FormatDimensionToString

Signature

FormatDimensionToString(Dimension : Magnitude, Unit : String, Number Of Decimals : Integer) : String

Arguments

Name Input/Output Required? Type Comment
Dimension In Magnitude -
Unit In String -
Number Of Decimals In Integer -

ReturnType

String

Get3DShapeLayer

Signature

Get3DShapeLayer(Feature : Feature) : Integer

Arguments

Name Input/Output Required? Type Comment
Feature In Feature -

ReturnType

Integer

GetAttachedStiffeners

Method to get the list of attached stiffeners for a given structural plate.

Signature

GetAttachedStiffeners(Plate Feature : Feature, Stiffener List : List) : Boolean

Arguments

Name Input/Output Required? Type Comment
Plate Feature In Feature

Indicates the structural plate feature: SddPlate or SfdPanel

Stiffener List Out List

List of stiffeners attached to the given plate

ReturnType

Boolean

Example

Let stiffenerList(List)
Let result(Boolean)
result=false
result = GetAttachedStiffeners(iArg, stiffenerList)
if (result == false)
{
    Trace (2, "Unable to retrive stiffeners for #", iArg.Name)
}
else
{
    Trace(2, "Number of stiffeners attached to the plate # is #, iArg.Name, stiffenerList.Size())
}                                                       

GetCBOMProductOccurrence

Method to get the CBOM product occurrence from a resulting product occurrence of an MBOM process.

Note: This function loads the corresponding CBOM product in the current session, if it is not already loaded.

Signature

GetCBOMProductOccurrence(ProductOccurrence : ProductOccurrence, ProductOccurrence : ProductOccurrence) : Boolean

Arguments

Name Input/Output Required? Type Comment
ProductOccurrence In ProductOccurrence

Indicates the object representing an MBOM (resulting product) occurrence: ProductOccurrence

ProductOccurrence Out ProductOccurrence

Indicates the object representing the CBOM product occurrence: ProductOccurrence

ReturnType

Boolean

Example

Let prdOcc(ProductOccurrence)
Let result(Boolean)
result=false
result = GetCBOMProductOccurrence(iPrdOcc, prdOcc)
if (result == false)
{
    Trace (2, "Unable to retrieve CBOM product occurrence for #", iPrdOcc.Name) 
}
else if (NULL <> prdOcc)
{
    Trace(2, "CBOM product occurrence Name: #", prdOcc.Name)
}

GetManufacturingAssembly

Method to get the Manufacturing assembly from a resulting product occurrence of an MBOM process.

Note: This function loads the process data in the current session, if it is not already loaded.

Signature

GetManufacturingAssembly(ProductOccurrence : ProductOccurrence, FProcessOccurrence : FProcessOccurrence) : Boolean

Arguments

Name Input/Output Required? Type Comment
ProductOccurrence In ProductOccurrence

Indicates the object representing an MBOM (resulting product) occurrence: ProductOccurrence

FProcessOccurrence Out FProcessOccurrence

Indicates the object representing the Manufacturing assembly: FProcessOccurrence

ReturnType

Boolean

Example

Let processOcc(FProcessOccurrence)
Let result(Boolean)
result=false
result = GetManufacturingAssembly(iPrdOcc, processOcc)
if (result == false)
{
    Trace (2, "Unable to retrieve Manufacturing Assembly for #", iPrdOcc.Name) 
}
else if (NULL <> processOcc)
{
    Trace(2, "Manufacturing Assembly Name: #", processOcc.Name)
}                                                       

GetNearestSRSPlane

Signature

GetNearestSRSPlane(Plane origin X : Real, Plane origin Y : Real, Plane origin Z : Real, Direction (1:F, 2:L, 3:D) : Integer) : String

Arguments

Name Input/Output Required? Type Comment
Plane origin X In Real -
Plane origin Y In Real -
Plane origin Z In Real -
Direction (1:F, 2:L, 3:D) In Integer -

ReturnType

String

GetNearestSkeletonSurface

Signature

GetNearestSkeletonSurface(Point origin X : Real, Point origin Y : Real, Point origin Z : Real, Direction (1:X, 2:Y, 3:Z) : Integer, Path : String, Surface Name : String, Distance From Surface : Real) : Boolean

Arguments

Name Input/Output Required? Type Comment
Point origin X In Real -
Point origin Y In Real -
Point origin Z In Real -
Direction (1:X, 2:Y, 3:Z) In Integer Direction seen from root, to use to find the nearest surface.
Path In String Path from the root element to navigate to the published surfaces.
Surface Name Out String

The publication name of the surface found.

Blank if none is found.

Distance From Surface Out Real

Distance from the input point to the nearest surface

The sign +/- indicates the position of the surface relative to the direction of search.

Note:

When the Search direction value is specified to 11, 12, or 13, the distance is always positive.

Likewise 21, 22, or 23 indicate a negative distance.

IsSurfaceFoud Out Boolean

TRUE = Surface was found.

FALSE = No surface was found in the specified direction.

The direction argument is handled by indicators. Each indicator represents a search direction to use in to find the nearest surface.

ReturnType

Boolean

Example

/*
@ShortDescription:  This goal of this rule is to retrieve the nearest surface in a direction chosen by the user.
@Parameters: None
*/

/* Input data : VPMReference */

let IsSurfaceFound(Boolean)
let iReference_X(Real)
let iReference_Y(Real)
let iReference_Z(Real)
let iDirection(Integer)
let iPath(String)

let oSurfaceName(String)
let oDistance(Real)

// Coordinate input point 
iReference_X=0
iReference_Y=0
iReference_Z=1000

// Direction to use to find the surface. 12 represents +Y
// 1 = + or - X,2 = + or - Y, 3 = + or - Z, 11 = +X, 13 = +Z, 21 = -X, 22 = -Y, 23 = -Z 
iDirection=12

// The path in which the surfaces are crea
iPath = "ROOT-DSNS-FRV7417-YN00323-NEW-GRS|GRS|SKELETON|DECKS"

IsSurfaceFound = GetNearestSkeletonSurface(iReference_X, iReference_Y, iReference_Z, iDirection, iPath, oSurfaceName, oDistance)

Notify(" SurfaceFound value ",IsSurfaceFound)

GetPipBendAtIndex

Function to get bend node points at end of curvature.

Signature

GetPipBendAtIndex(Pipe Occurrence : ProductOccurrence, Pipe Node Index : Integer, Bend Diameter : Real, Bend Angle : ANGLE, Pipe Dimaeter : Integer, Origin X : LENGTH, Origin Y : LENGTH, Origin Z : LENGTH, Start X : LENGTH, Start Y : LENGTH, Start Z : LENGTH, End X : LENGTH, End Y : LENGTH, End Z : LENGTH) : Boolean

Arguments

Name Input/Output Required? Type Comment
Pipe Occurrence In ProductOccurrence -
Pipe Node Index In Integer -
Bend Diameter Out Real -
Bend Angle Out ANGLE -
Pipe Dimaeter Out Integer -
Origin X Out LENGTH -
Origin Y Out LENGTH -
Origin Z Out LENGTH -
Start X Out LENGTH -
Start Y Out LENGTH -
Start Z Out LENGTH -
End X Out LENGTH -
End Y Out LENGTH -
End Z Out LENGTH -

ReturnType

Boolean

GetPipeBendInfo

Retrieves pipe bend information like bend diameter, bend angle, and number of nodes for given product occurrence of rigid pipe.

Signature

GetPipeBendInfo(Pipe Occurrence : ProductOccurrence, Bend Diameter : LENGTH, Bend Angle : ANGLE, Node Number : Integer) : Boolean

Arguments

Name Input/Output Required? Type Comment
Pipe Occurrence In ProductOccurrence -
Bend Diameter Out LENGTH -
Bend Angle Out ANGLE -
Node Number Out Integer -

ReturnType

Boolean

Example

let prdOccurence(ProductOccurrence)
set prdOccurence = Input
if (prdOccurence<> NULL)
{
	Let numNodes(Integer)
	GetPipeNodes(prdOccurence,numNodes)
}

GetPipeNodeAtIndex

Retrieves the X, Y, and Z coordinates of the piping node based on an index/number retrieved by the GetPipBendAtIndex function.

Signature

GetPipeNodeAtIndex(Pipe Occurrence : ProductOccurrence, Pipe Node Index : Integer, X : LENGTH, Y : LENGTH, Z : LENGTH) : Boolean

Arguments

Name Input/Output Required? Type Comment
Pipe Occurrence In ProductOccurrence -
Pipe Node Index In Integer -
X Out LENGTH -
Y Out LENGTH -
Z Out LENGTH -

ReturnType

Boolean

Example

let x(Length)
let y(Length)
let z(Length)
let i(Integer)	
		
for i = 1 while i < numNodes +1
GetPipeNodeAtIndex(prdOccurence,i,x,y,z)

GetPipeNodes

Signature

GetPipeNodes(Pipe Occurrence : ProductOccurrence, Size of piping nodes : Integer) : Boolean

Arguments

Name Input/Output Required? Type Comment
Pipe Occurrence In ProductOccurrence -
Size of piping nodes Out Integer -

ReturnType

Boolean

GetPlateMinimumDimensions

Method to get the minimum length and width of a planar structural plate.

Signature

GetPlateMinimumDimensions(Feature : Feature, Plate Length : LENGTH, Plate Width : LENGTH) : Boolean

Arguments

Name Input/Output Required? Type Comment
Feature In Feature

Indicates the structural plate feature: SddPlate or SfdPanel

Plate Length Out LENGTH

Indicates of the minimum length of the given structural plate

Plate Width Out LENGTH

Indicates of the minimum width of the given structural plate

ReturnType

Boolean

Example

Let plateLength, plateWidth(LENGTH)
Let result(Boolean)
plateLength=0mm
plateWidth=0mm
result=false
result = GetPlateMinimumDimensions(iPlateFeature, plateLength, plateWidth)
if (result == false)
{
    Trace (2, "Unable to compute minimum dimension for #", iPlateFeature.Name)
}
else
{
    Trace(2, "Plate length: #", plateLength)
    Trace(2, "Plate width: #", plateWidth)
}                                                       

GetSRSPlaneOrientation

Signature

GetSRSPlaneOrientation(SRS Plane : RFGGridFace) : Boolean

Arguments

Name Input/Output Required? Type Comment
SRS Plane In RFGGridFace -

ReturnType

Boolean

GetViewProjectedPoint

Project 3D point into 2D point based on a view vector.

Signature

GetViewProjectedPoint(Drafting of ASDView : Feature, Origin X : LENGTH, Origin Y : LENGTH, Origin Z : LENGTH, Projected X : LENGTH, Projected Y : LENGTH) : Boolean

Arguments

Name Input/Output Required? Type Comment
Drafting of ASDView In Feature -
Origin X In LENGTH -
Origin Y In LENGTH -
Origin Z In LENGTH -
Projected X In LENGTH -
Projected Y Out LENGTH -

ReturnType

Boolean

Example

// from 3D to 2D point 
let oPtx(LENGTH)
let oPty(LENGTH)	

GetViewProjectedPoint(InputView,x,y,z,oPtx,oPty)

GetViewProjectionPlane

View projection plane for use in Multi-Discipline Drafting and Drafting view, retrieves a used vector of a view.

Signature

GetViewProjectionPlane(Drafting of ASDView : Feature, View Vector X : Real, View Vector Y : Real, View Vector Z : Real) : Boolean

Arguments

Name Input/Output Required? Type Comment
Drafting of ASDView In Feature -
View Vector X Out Real -
View Vector Y Out Real -
View Vector Z Out Real -

ReturnType

Boolean

IsOccurrenceRoot

Method to verify if the provided product occurrence is the root and has no parent.

Signature

IsOccurrenceRoot(ProductOccurrence : ProductOccurrence) : Boolean

Arguments

Name Input/Output Required? Type Comment
ProductOccurrence In ProductOccurrence Indicates the input argument type: ProductOccurrence

ReturnType

Boolean

Example

Let currentOcc (ProductOccurrence)
Let i (Integer)
set currentOcc = iPrdOcc
for i while IsOccurrenceRoot(currentOcc) == false
{
    Trace (2, "Current Occurrence: #",currentOcc.Name)
    set currentOcc = currentOcc.Owner
}
Trace(4, "# is the root Occurrence", currentOcc.Name)