Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2024.
Loading...
Searching...
No Matches
SMultiline Class Reference

Provide polyline edition and creation methods. More...

Inheritance diagram for SMultiline:
SComp

Public Types

enum  MultilineRepresentationTypeEnum { MULTILINE_SEGMENTS = 0 , MULTILINE_VERTICES = 1 , MULTILINE_INSPECTION = 2 }
 The different representation types for multilines. More...
 
enum  OffsetSideEnum { OTHER_SIDE = 0 , SAME_SIDE = 1 }
 To know on which side the offset is computing depending of a define point. More...
 
enum  RepairAutoIntersectionPolicyEnum { SUPPRESS_SMALL_LOOPS_FIRST = 0 , SUPPRESS_LONG_LOOPS_FIRST = 1 , SUPPRESS_IN_VERTEX_ORDER = 2 }
 Enum the autointersection reparation policy. More...
 
enum  SmoothEnum { SMOOTH_TYPE1 = 0 , SMOOTH_TYPE2 = 1 , SMOOTH_BSPLINE = 2 }
 Enum the smoothing type. More...
 
- Public Types inherited from SComp
enum  VisibilityEnum { HIDDEN_ONLY = 0 , VISIBLE_ONLY = 1 , ANY_VISIBILITY = 2 }
 Visible criteria. More...
 

Public Member Functions

 AddArrows (boolean reverse=false)
 Add two arrows at the extremities of the SMultiline. More...
 
 AddArrows (number nbArrow, number position)
 Add some arrows along the SMultiline. More...
 
 Clear ()
 Clear to deallocate memory. More...
 
 Close ()
 Close a SMultiline. More...
 
Object ClosestPoint (SPoint point)
 Find the point in the current SMultiline that is the closest from an input point. More...
 
Object CloseWithCurvedJunction (number nbPoints=30, boolean makePlanarJunction=false)
 Close a SMultiline with a curved junction. More...
 
Object Compare (SMultiline measuredMulti, number distMax, SVector projectionDir=SVector(), number mappingObject=1, boolean ignoreEdge=false, boolean ptToPt=false, boolean inPlane=false)
 Calculate the distances between 2 SMultilines for further inspection purpose (color mapping). More...
 
Object GetAutoIntersections (number lenghtTol)
 Check whether a SMultiline contains autointersections. More...
 
SPoint GetCentroidLinear ()
 Compute the barycenter of the current line considering the line having a constant linear density all along the polyline. More...
 
Object GetColorGradient ()
 Get the color gradient of the SMultiline. More...
 
number GetDeviation (number index)
 Get deviation value of a point on the SMultiline. More...
 
Object GetDeviations ()
 Return all deviation values of the SMultiline. More...
 
number GetLength ()
 Compute the length of the current 3D SMultiline. More...
 
Object GetNormal ()
 Calculate the normal plane of the current SMultiline. More...
 
number GetNumber ()
 Get the number of vertices inside the SMultiline. More...
 
SPoint GetPoint (number index)
 Get the point coordinates at position "Index". More...
 
Object GetPointAtDistance (number distanceToOrigin, boolean interpolateOnSegments=true)
 Return the point at a given distance on the current SMultiline. More...
 
Object InsertFirst (SPoint pointToCopy, number absoluteAccuracy=0)
 Add a point at the beginning of the SMultiline. More...
 
Object InsertLast (SPoint pointToCopy, number absoluteAccuracy=0)
 Add a point at the end of the SMultiline. More...
 
Object IntersectionWithMesh (SPoly poly)
 Calculate intersections with 1 poly. More...
 
Object IntersectionWithOtherPlanarMulti (SMultiline multi)
 Calculate intersections between 2 planar multilines. More...
 
Object IntersectionWithPlane (SPlane plane)
 Calculate intersection with a plane. More...
 
boolean IsClosed ()
 Return if the SMultiline is closed or not. More...
 
boolean IsPlanar ()
 Return if the SMultiline is planar or not. More...
 
Object LoadColorGradient (string filePath)
 Load the color gradient from a file (*.rsi binary file). More...
 
Object MultilineArea (SVector projDir)
 Compute the area of a closed SMultiline projected with a direction. More...
 
Object Offset (SVector direction, number distOffset, OffsetSideEnum goodSide, SPoint sidePt)
 Compute the parallel contour of a SMultiline according to a direction. More...
 
Object Proj3D (SPoint point)
 Search the closest 3D projection of a SPoint on this SMultiline. The projection can occur on a segment or a vertex. More...
 
Object ProjDir (SPoint point, SVector projDir, number aperture)
 Search the closest projection along a direction on this SMultiline. The projection can occur on a segment or a vertex. More...
 
Object Reduce (number nbPoint, number maxDeviation=1.79769e+308, boolean optimizePosition=true)
 Reduce the current SMultiline to have a certain number of points while keeping the best points. More...
 
Object RepairAutoIntersections (number lengthTol, number loopMaxLength=-1, RepairAutoIntersectionPolicyEnum policy=SMultiline.SUPPRESS_SMALL_LOOPS_FIRST)
 Repair the autointersections if there were by suppressing the smallest loop bounded by autointersection point. More...
 
 Reverse ()
 Reverse the current SMultiline. More...
 
Object RightAngle (number threshold)
 Modify the vertex of the SMultiline in order to get right angles on the SMultiline. More...
 
Object Save (string filePath, SMatrix coordinateSystemMatrix=SMatrix())
 Save the SMultiline into a file. More...
 
Object SaveColorGradient (string filePath)
 Save the color gradient into a file (*.rsi binary file). More...
 
 SetLineWidth (number width)
 Change the thickness of the SMultiline. More...
 
 SetMultilineRepresentation (MultilineRepresentationTypeEnum representation)
 Modify the representation of the SMultiline. More...
 
 ShowName (boolean showName)
 Control whether the name of the SMultiline is shown or not in the scene. More...
 
Object Smooth (number para1, number smoothIntens, SmoothEnum smoothingType, number maxiDeviation)
 Recalculate new vertices to smooth the current SMultiline. More...
 
 SMultiline ()
 Default constructor to create an empty new SMultiline. More...
 
 SMultiline (SMultiline other)
 Construct a SMultiline by copying the SMultiline Other. More...
 
Object SuppressSmallLines (number lengthTol)
 Define a SMultiline suppressing the lines which have a length smaller than a tolerance length. More...
 
string toString ()
 Get the type of the variable. More...
 
string ValuesToString ()
 Get a debug string representation of the SMultiline. More...
 
- Public Member Functions inherited from SComp
 AddToDoc ()
 Add the object to the document. More...
 
 ApplyTransformation (SMatrix matrix)
 Apply a geometric transformation to the current object by making a product with the given matrix. More...
 
Object GetBoundingBox (SMatrix ucs=null)
 Calculate the bounding box of the object. More...
 
Object GetColors ()
 Get the colors of the object. More...
 
string GetFolderName ()
 Get the name of the folder containing the object. More...
 
string GetName ()
 Return the object's name. More...
 
string GetPath ()
 Return the full path of a SComp in the tree. More...
 
 Invert ()
 Invert the normal of the object. More...
 
boolean IsInDoc ()
 Return if the object is in the document or not. More...
 
boolean IsVisible ()
 Get the visibility of the object. More...
 
 MoveToGroup (string groupPath, boolean moveInsideTopParent=true)
 Move the object to the document group represent by the given path. If some groups, in the path, don't exist, they will be created. More...
 
 RemoveFromDoc ()
 Remove the object from the document. More...
 
 SetClippable (boolean clipping)
 Set clippable or not. More...
 
 SetColors (number red, number green, number blue)
 Set the colors of the object. More...
 
 SetName (string objectName)
 Set the object's name. More...
 
 SetTransparency (number alpha)
 Set the transparency of the object. More...
 
 SetVisibility (boolean visible)
 Set the object to be visible, or not visible. More...
 
string toString ()
 Get the type of the variable. More...
 
 Translate (SVector vector)
 Make a translation of the current object with an SVector. More...
 

Static Public Member Functions

static Array< SMultilineAll (VisibilityEnum visCrit=SComp.ANY_VISIBILITY)
 Get all the SMultiline in the document. More...
 
static Object Chain (Array< SMultiline > tableLine, number maxiSegmentLength=0, number accuracy=0, boolean close=false)
 Chain all the SMultiline by creating new segments between nearest SMultiline extremities. Optionally try to close it. More...
 
static Object ComputeNeutralAxis (SComp tubularShape, SComp helpLine, boolean isCircle, number approxDiameter, number approxWidth, number approxLength, SVector direction, number calculationAccuracy, number smoothNeutralAxis, boolean reconstructPipe)
 Compute the neutral axis of a SCloud or SPoly or surfacic SShape. More...
 
static Object CurvedJunction (SMultiline firstMultiline, SMultiline secondMultiline, number nPoints=30, boolean makePlanarJunction=false, boolean chainWithInput=true)
 Create a curved junction between two SMultiline. More...
 
static Object Cut (SMultiline multiline, SPoint point)
 Cut the SMultiline by creating new segments between nearest SMultiline extremities. More...
 
static Object FromClick ()
 Launch an interaction to select a SMultiline in the scene. More...
 
static Object FromFile (string fileName)
 Import a set of polylines from a file and create the associated SMultiline objects. More...
 
static Array< SMultilineFromName (string name)
 Search all the SMultiline with the given name. More...
 
static Array< SMultilineFromSel ()
 Get all the selected SMultiline. More...
 
static Object MedianLine (Array< SMultiline > tableMulti, number nbPt=0)
 Compute the median line between several SMultiline. More...
 
static Object MultilinesIntersections (Array< SMultiline > tableMulti, number desiredAccuracy)
 Compute the set of intersections between an arbitrary number of SMultilines. More...
 
static SMultiline New ()
 Default constructor to create an empty new SMultiline. More...
 
static SMultiline New (SMultiline other)
 Construct a SMultiline by copying the SMultiline Other. More...
 
- Static Public Member Functions inherited from SComp
static Array< SCompAll (VisibilityEnum visCrit=SComp.ANY_VISIBILITY)
 Get all the SComp in the document. More...
 
static Object FromClick ()
 Launch an interaction to select a SComp in the scene. More...
 
static Array< SCompFromName (string name)
 Search all the SComp with the given name. More...
 
static Array< SCompFromSel ()
 Get all the selected SComp. More...
 

Detailed Description

Provide polyline edition and creation methods.

Multiline are represented as an ordered list of points

Member Enumeration Documentation

◆ MultilineRepresentationTypeEnum

The different representation types for multilines.

Enumerator
MULTILINE_SEGMENTS 

Only segments are displayed.

MULTILINE_VERTICES 

Segments and vertices are displayed.

MULTILINE_INSPECTION 

Colors ares based on an inspection value on each point. Only available if the SMultiline contains inspection information.

◆ OffsetSideEnum

To know on which side the offset is computing depending of a define point.

Enumerator
OTHER_SIDE 

The side where point is not.

SAME_SIDE 

The side where point is.

◆ RepairAutoIntersectionPolicyEnum

Enum the autointersection reparation policy.

Enumerator
SUPPRESS_SMALL_LOOPS_FIRST 

The suppression is done by suppressing from the smallest to the longest auto-intersection loops.

SUPPRESS_LONG_LOOPS_FIRST 

The suppression is done by suppressing from the longest to the smallest auto-intersection loops.

SUPPRESS_IN_VERTEX_ORDER 

The suppression is done in the order we find them by browsing from the 1st to the last vertex.

◆ SmoothEnum

Enum the smoothing type.

Enumerator
SMOOTH_TYPE1 

Order 1 filter. Very smooth filter. The small radii are becoming greater. Smoothing an opened SMultiLine with a very high SmoothIntens will converge to a straight segment between first and last point. Smoothing a closed SMultiline with a very high SmoothIntens will converge to a point, which is the gravity center of the SMultiline.

SMOOTH_TYPE2 

Order 2 filter. More complex filter based on first derivative that allows to limit as much as possible increasing the radii. Smoothing an opened SMultiline with a very high SmoothIntens will NOT converge to a straight segment. Smoothing a closed SMultiLine with a very high SmoothIntens will NOT converge to a point.

SMOOTH_BSPLINE 

B-spline smoothing.

Constructor & Destructor Documentation

◆ SMultiline() [1/2]

SMultiline::SMultiline ( )

Default constructor to create an empty new SMultiline.

◆ SMultiline() [2/2]

SMultiline::SMultiline ( SMultiline  other)

Construct a SMultiline by copying the SMultiline Other.

Parameters
other(SMultiline) The other SMultiline to copy.

Member Function Documentation

◆ AddArrows() [1/2]

SMultiline::AddArrows ( boolean  reverse = false)

Add two arrows at the extremities of the SMultiline.

Parameters
reverse(boolean) To know if arrows are reversed or not.
  • false: means <===>
  • true: means >===<

◆ AddArrows() [2/2]

SMultiline::AddArrows ( number  nbArrow,
number  position 
)

Add some arrows along the SMultiline.

Parameters
nbArrow(number) Number of arrows to be drawn. Negative value means on each segment.
position(number) The place where arrow should be displayed inside [0 1].
  • 0: or less means at the start of the segment. 1 or greater means the end of the segment.

◆ All()

static Array< SMultiline > SMultiline::All ( VisibilityEnum  visCrit = SComp.ANY_VISIBILITY)
static

Get all the SMultiline in the document.

Parameters
visCrit(VisibilityEnum) Visible selection criteria
Returns
(Array<SMultiline>) Array of all the SMultiline contained in the document, that fulfill the visibility criteria

◆ Chain()

static Object SMultiline::Chain ( Array< SMultiline tableLine,
number  maxiSegmentLength = 0,
number  accuracy = 0,
boolean  close = false 
)
static

Chain all the SMultiline by creating new segments between nearest SMultiline extremities. Optionally try to close it.

Note
The original SMultiline are not modified, but a copy is done.
See also
SMultiline::CurvedJunction, SCloud::Chain
Parameters
tableLine(Array<SMultiline>) The SMultiline table to chain
maxiSegmentLength(number) The maximum size of new segments created to make junctions between polylines. If 0, no size limit.
accuracy(number) The comparison "equality" accuracy. If 0, the comparison value used is 1.e-5.
close(boolean) Try to close the polylines.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.MultiTbl(Array<SMultiline>) An SMultiline table with contours, else if the SMultilines are impossible to chain returns an empty Array

◆ Clear()

SMultiline::Clear ( )

Clear to deallocate memory.

◆ Close()

SMultiline::Close ( )

Close a SMultiline.

◆ ClosestPoint()

Object SMultiline::ClosestPoint ( SPoint  point)

Find the point in the current SMultiline that is the closest from an input point.

See also
SMultiline.Proj3D(), SMultiline.ProjDir()
Parameters
point(SPoint) The point from which the closest has to be found
Return values
ret.ErrorCode(number) The error code.
  • 0 Success: A point is found.
  • 1: Failed to find a point.
ret.Index(number) The index number (0 <= index < Number) of the closest vertex from the initial point.
ret.SqDistance(number) The square distance found.

◆ CloseWithCurvedJunction()

Object SMultiline::CloseWithCurvedJunction ( number  nbPoints = 30,
boolean  makePlanarJunction = false 
)

Close a SMultiline with a curved junction.

Parameters
nbPoints(number) The number of points that should be created on the junction.
makePlanarJunction(boolean) Should the junction be planar?
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ Compare()

Object SMultiline::Compare ( SMultiline  measuredMulti,
number  distMax,
SVector  projectionDir = SVector(),
number  mappingObject = 1,
boolean  ignoreEdge = false,
boolean  ptToPt = false,
boolean  inPlane = false 
)

Calculate the distances between 2 SMultilines for further inspection purpose (color mapping).

Note
The distance is measured by projecting SMultiline measuredMulti on this.
This picture shows an example of inspection between two SMultiline. The color is used here to represent distance.
Parameters
measuredMulti(SMultiline) SMultiline considered as the measured object to project on this
distMax(number) Ignore point having a distance greater than this one.
projectionDir(SVector) The direction of the 2D comparison (requires both polylines in a same plane)
mappingObject(number) 1 means color mapping is done on 'this', else 2 the color mapping is done on measuredMulti.
ignoreEdge(boolean) What should be done with points on edges ?
  • false: Project all points.
  • true: Ignore points having their projection on edge.
ptToPt(boolean) WARNING: if true the two SMultilines MUST have the same point number. Project each point on it corresponding point.
inPlane(boolean) True if the inspection can be done in a plane, so the result can be signed
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Multi(SMultiline) The new SMultiline, which is the result of the comparison. Each point of the output SMultiline has an associated value, which is the distance found between the two vertices, or undefined if this distance could not be computed or is not relevant.
ret.ReportData(SReportData) The new SReportData, which contains the view set with the inspected component.

◆ ComputeNeutralAxis()

static Object SMultiline::ComputeNeutralAxis ( SComp  tubularShape,
SComp  helpLine,
boolean  isCircle,
number  approxDiameter,
number  approxWidth,
number  approxLength,
SVector  direction,
number  calculationAccuracy,
number  smoothNeutralAxis,
boolean  reconstructPipe 
)
static

Compute the neutral axis of a SCloud or SPoly or surfacic SShape.

License
This function requires the license AEC.
Parameters
tubularShape(SComp) The SCloud, SPoly or surfacic SShape on which the neutral axis is computed
helpLine(SComp) The help line (SMultiLine, linear SShape) used to create sections on object to compute neutral axis, If null, then it is automatically computed
isCircle(boolean) True : Circle, false : SquareSlot
approxDiameter(number) An estimation of the diameter of the circle. If <= 0.0 the diameter is automatically computed
approxWidth(number) Estimation of the width of the square slot. if <= 0.0 the width is automatically computed
approxLength(number) An estimation of the length of the square slot. If <= 0.0 the length is automatically computed
direction(SVector) An estimation of the direction of the length of the square slot. If null the direction is automatically computed
calculationAccuracy(number) The number of sections along the polyline between 10 - 500
smoothNeutralAxis(number) The smoothing value between 0 - 15
reconstructPipe(boolean) If true, the pipe will be reconstructed according to the computed neutral axis
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Multi(SMultiline) The smoothed neutral axis
ret.Comp(SComp) The reconstructed pipe

◆ CurvedJunction()

static Object SMultiline::CurvedJunction ( SMultiline  firstMultiline,
SMultiline  secondMultiline,
number  nPoints = 30,
boolean  makePlanarJunction = false,
boolean  chainWithInput = true 
)
static

Create a curved junction between two SMultiline.

Note
Which extremity of the polylines should be joined are automatically identified as the 2 points which are the closest from each other among the 4 possibilities.
See also
SMultiline::Chain
Parameters
firstMultiline(SMultiline) The first SMultiline to join
secondMultiline(SMultiline) The second SMultiline to join
nPoints(number) The number of points that should be created on the junction.
makePlanarJunction(boolean) Should the junction be planar?
chainWithInput(boolean) Should the result SMultiline be chained with the input SMultiline?
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Multi(SMultiline) The result SMultiline, else if an error occurred, returns an empty Array

◆ Cut()

static Object SMultiline::Cut ( SMultiline  multiline,
SPoint  point 
)
static

Cut the SMultiline by creating new segments between nearest SMultiline extremities.

Parameters
multiline(SMultiline) The SMultiline to cut.
point(SPoint) The point where to cut.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.MultiTbl(Array<SMultiline>) A table with all resulting polylines.

◆ FromClick()

static Object SMultiline::FromClick ( )
static

Launch an interaction to select a SMultiline in the scene.

Warning
This function will pause the script, and wait for user interaction
Return values
ret.ErrorCode(number) The error code
  • 0: No error, the SMultiline is selected.
  • 1: Nothing is selected.
  • 2: The ESCape key has been pressed
ret.Multi(SMultiline) The selected SMultiline

◆ FromFile()

static Object SMultiline::FromFile ( string  fileName)
static

Import a set of polylines from a file and create the associated SMultiline objects.

Note
Authorized file extensions : .asc, .mli
Warning
When you write a '\' in string you need to double it '\\' or use '/' instead. Pay especially attention to this when writing file paths in your scripts.
var path = 'C:/Point.asc'; // valid syntax
var path = 'C:\\Point.asc'; // valid syntax
var path = 'C:\Point.asc'; // invalid syntax
Parameters
fileName(string) The file name path.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.MultiTbl(Array<SMultiline>) The loaded SMultiline array.

◆ FromName()

static Array< SMultiline > SMultiline::FromName ( string  name)
static

Search all the SMultiline with the given name.

Parameters
name(string) The name to find
Returns
(Array<SMultiline>) All the SMultiline with the given name

◆ FromSel()

static Array< SMultiline > SMultiline::FromSel ( )
static

Get all the selected SMultiline.

Returns
(Array<SMultiline>) All the selected SMultiline

◆ GetAutoIntersections()

Object SMultiline::GetAutoIntersections ( number  lenghtTol)

Check whether a SMultiline contains autointersections.

Parameters
lenghtTol(number) The tolerance to detect autointersections. An intersection is detected when the lines have their bounding boxes intersecting and their distances less than lengthTol
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PointTbl(Array<SPoint>) The list of points at autointersection.

◆ GetCentroidLinear()

SPoint SMultiline::GetCentroidLinear ( )

Compute the barycenter of the current line considering the line having a constant linear density all along the polyline.

Note
If the SMultiline has no point, the point returned is on the origin (0, 0, 0).
Returns
(SPoint) The barycenter of the current line.

◆ GetColorGradient()

Object SMultiline::GetColorGradient ( )

Get the color gradient of the SMultiline.

Return values
ret.ErrorCode(number) The error code.
  • 0: OK, no error
  • 1: No color gradient associated to this SMultiline
ret.Gradient(SColorGradient) The SColorGradient associated to the current SMultiline

◆ GetDeviation()

number SMultiline::GetDeviation ( number  index)

Get deviation value of a point on the SMultiline.

Parameters
index(number) index of the point for which the deviation value will be returned
Returns
(number) The deviation of the point. If no deviation is stored in the SMultiline, UndefinedValue is returned

◆ GetDeviations()

Object SMultiline::GetDeviations ( )

Return all deviation values of the SMultiline.

Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.ValueTbl(Array<number>) The deviation values

◆ GetLength()

number SMultiline::GetLength ( )

Compute the length of the current 3D SMultiline.

Note
If the SMultiline is closed, the function returns the perimeter of the SMultiline.
Returns
(number) The computed length.

◆ GetNormal()

Object SMultiline::GetNormal ( )

Calculate the normal plane of the current SMultiline.

Return values
ret.ErrorCode(number) The error code:
  • 0: OK, the SMultiline is a plane.
  • 1: The SMultiline is not planar but the best plane has been calculated.
  • 2: Nothing could be calculated.
ret.Vector(SVector) The normal of the SMultiline.
ret.Point(SPoint) A point on the plane.

◆ GetNumber()

number SMultiline::GetNumber ( )

Get the number of vertices inside the SMultiline.

Returns
(number) The number of vertices.

◆ GetPoint()

SPoint SMultiline::GetPoint ( number  index)

Get the point coordinates at position "Index".

Parameters
index(number) Position of the point in the SMultiline. 0<= index < Number
Returns
(SPoint) The SPoint at the given position.

◆ GetPointAtDistance()

Object SMultiline::GetPointAtDistance ( number  distanceToOrigin,
boolean  interpolateOnSegments = true 
)

Return the point at a given distance on the current SMultiline.

Parameters
distanceToOrigin(number) the distance from the origin of the SMultiline
interpolateOnSegments(boolean) Interpolate the tangent on segments. If false, the tangent of a segment will be its direction.
Return values
ret.ErrorCode(number) The error code:
  • 0: No error.
  • 1 Error: The input distance is greater than the current SMultiline length.
  • 2 Error: An error occurred during the computation.
ret.Point(SPoint) The point on the current SMultiline at the expected distance.
ret.Vector(SVector) The tangent of the SMultiline at the expected distance.

◆ InsertFirst()

Object SMultiline::InsertFirst ( SPoint  pointToCopy,
number  absoluteAccuracy = 0 
)

Add a point at the beginning of the SMultiline.

See also
InsertLast
Parameters
pointToCopy(SPoint) The point to add at the beginning of the SMultiline.
absoluteAccuracy(number) The comparison's 'equality' accuracy. Two points are considered as equal if their distance is lower than this value. If Accuracy=0, the comparison value is by 1.e-5.
Return values
ret.ErrorCode(number) The error code:
  • 0: The point has been inserted.
  • 1: The point already exists (not inserted).

◆ InsertLast()

Object SMultiline::InsertLast ( SPoint  pointToCopy,
number  absoluteAccuracy = 0 
)

Add a point at the end of the SMultiline.

See also
InsertFirst
Parameters
pointToCopy(SPoint) The point to add at the end of the SMultiline.
absoluteAccuracy(number) The comparison's 'equality' accuracy. Two points are considered as equal if their distance is lower than this value. If Accuracy=0, the comparison value is by 1.e-5.
Return values
ret.ErrorCode(number) The error code:
  • 0: The point has been inserted.
  • 1: The point already exists (not inserted).

◆ IntersectionWithMesh()

Object SMultiline::IntersectionWithMesh ( SPoly  poly)

Calculate intersections with 1 poly.

Parameters
poly(SPoly) The poly to calculate intersections with.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PointTbl(Array<SPoint>) An array containing the intersection points (SPoint).

◆ IntersectionWithOtherPlanarMulti()

Object SMultiline::IntersectionWithOtherPlanarMulti ( SMultiline  multi)

Calculate intersections between 2 planar multilines.

Parameters
multi(SMultiline) The multi to calculate intersections with.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PointTbl(Array<SPoint>) An array containing the intersection points (SPoint).

◆ IntersectionWithPlane()

Object SMultiline::IntersectionWithPlane ( SPlane  plane)

Calculate intersection with a plane.

Parameters
plane(SPlane) The plane to calculate intersections with.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PointTbl(Array<SPoint>) An array containing the intersection points (SPoint).

◆ IsClosed()

boolean SMultiline::IsClosed ( )

Return if the SMultiline is closed or not.

Returns
(boolean) True if the SMultiline is closed.

◆ IsPlanar()

boolean SMultiline::IsPlanar ( )

Return if the SMultiline is planar or not.

Returns
(boolean) True if the SMultiline is planar.

◆ LoadColorGradient()

Object SMultiline::LoadColorGradient ( string  filePath)

Load the color gradient from a file (*.rsi binary file).

Warning
When you write a '\' in string you need to double it '\\' or use '/' instead. Pay especially attention to this when writing file paths in your scripts.
var path = 'C:/Point.asc'; // valid syntax
var path = 'C:\\Point.asc'; // valid syntax
var path = 'C:\Point.asc'; // invalid syntax
Parameters
filePath(string) The complete file path to load from
Return values
ret.ErrorCode(number) The error code.
  • 0: OK, no error
  • 1: No color gradient associated to this SPoly
  • 2: An error occurred
ret.Gradient(SColorGradient) The color gradient associated to the current SMultiline

◆ MedianLine()

static Object SMultiline::MedianLine ( Array< SMultiline tableMulti,
number  nbPt = 0 
)
static

Compute the median line between several SMultiline.

Parameters
tableMulti(Array<SMultiline>) Table of SMultiline
nbPt(number) Number of point of the final median line (nbPt > 1).
Return values
ret.ErrorCode(number) The error code.
  • 0: No error, the median line is computed.
  • 1: An error occurred. One of the input line has less than 2 points, or length is inferior to AbsoluteAccuracyGet().
ret.Multi(SMultiline) The computed median line.

◆ MultilineArea()

Object SMultiline::MultilineArea ( SVector  projDir)

Compute the area of a closed SMultiline projected with a direction.

See also
GetNormal, GetBoundingBox, GetLength, GetCentroidLinear
Parameters
projDir(SVector) The projection direction.
Return values
ret.ErrorCode(number) The error code:
  • 0: Success.
  • 1: Multiline is empty.
  • 2: Multiline not closed.
  • 3: Projection direction is invalid.
  • 4: An error occurred.
ret.Surface(number) The area of the SMultiline.
ret.Value(number) The direction of the multiline.
  • < 0: The SMultiline turns clockwise.
  • 0: The SMultiline turns counterclockwise and clockwise in an equivalent way.
  • > 0: The SMultiline turns counterclockwise.

◆ MultilinesIntersections()

static Object SMultiline::MultilinesIntersections ( Array< SMultiline tableMulti,
number  desiredAccuracy 
)
static

Compute the set of intersections between an arbitrary number of SMultilines.

Parameters
tableMulti(Array<SMultiline>) Collection of SMultiline between which the intersections are computed.
desiredAccuracy(number) Distance under which two segments are considered intersecting.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.IntersectionTbl(Array<SPoint>) Table of SPoints containing the intersection points.

◆ New() [1/2]

static SMultiline SMultiline::New ( )
static

Default constructor to create an empty new SMultiline.

Returns
(SMultiline) The new SMultiline.

◆ New() [2/2]

static SMultiline SMultiline::New ( SMultiline  other)
static

Construct a SMultiline by copying the SMultiline Other.

Parameters
other(SMultiline) The other SMultiline to copy.
Returns
(SMultiline) The new SMultiline.

◆ Offset()

Object SMultiline::Offset ( SVector  direction,
number  distOffset,
OffsetSideEnum  goodSide,
SPoint  sidePt 
)

Compute the parallel contour of a SMultiline according to a direction.

Note
If the offset value is small, two solutions may exist: one solution on each side of the SMultiline. You can choose which solution must be kept using SidePt and GoodSide. If the contour is closed, one solution is inside and the other one is outside. However if the offset value is to large, the inside solution may not exist. In this case the outside solution is always returned independently of the parameters SidePt and GoodSide.
Parameters
direction(SVector) The offset is computed in the plane normal to this vector. This means that each point of the SMultiline is moved in a direction normal to this vector. If 0, the plane is assumed to be the best plane of the current SMultiline.
distOffset(number) The offset distance
goodSide(OffsetSideEnum) To know on which side the offset is computing depending of a define point.
sidePt(SPoint) A point to know the side of the offset.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Multi(SMultiline) The resulting offset contour.

◆ Proj3D()

Object SMultiline::Proj3D ( SPoint  point)

Search the closest 3D projection of a SPoint on this SMultiline. The projection can occur on a segment or a vertex.

See also
SMultiline.ClosestPoint(), SMultiline.ProjDir()
Parameters
point(SPoint) The point to project.
Return values
ret.ErrorCode(number) The error code.
  • 0 Success: A point is found
  • 1: Failed to find a point
ret.Index(number) The index number (0 <= index < Number) of the closest segment or point. If projection occurs on a segment, the point found is between point index and index+1.
ret.Point(SPoint) Return here the projected point found.

◆ ProjDir()

Object SMultiline::ProjDir ( SPoint  point,
SVector  projDir,
number  aperture 
)

Search the closest projection along a direction on this SMultiline. The projection can occur on a segment or a vertex.

See also
SMultiline.ClosestPoint(), SMultiline.Proj3D()
Parameters
point(SPoint) The point to project.
projDir(SVector) The projection direction
aperture(number) The aperture distance. Significant only if computation occurs in a plane. Points are valid only if they are inside a cylinder of axis defined by point and projDir and a radius equal by this value.
Return values
ret.ErrorCode(number) The error code.
  • 0 Success: A point is found
  • 1: Failed to find a point
ret.Index(number) The index number (0 <= index < Number) of the closest segment or point. If projection occurs on a segment, the point found is between point index and index+1. If Aperture is not zero, -1 can be returned if no point is valid.
ret.Point(SPoint) Return here the projected point found.

◆ Reduce()

Object SMultiline::Reduce ( number  nbPoint,
number  maxDeviation = 1.79769e+308,
boolean  optimizePosition = true 
)

Reduce the current SMultiline to have a certain number of points while keeping the best points.

Parameters
nbPoint(number) Number of points to get after reducing if input is 0, only the max deviation criterion is taken into account
maxDeviation(number) The maximum deviation allowed. If very high, there is no chance that this criterion is taken into account when reducing (default behavior)
optimizePosition(boolean) If true, optimization of points positions. Else reduce the line using existing points.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ RepairAutoIntersections()

Object SMultiline::RepairAutoIntersections ( number  lengthTol,
number  loopMaxLength = -1,
RepairAutoIntersectionPolicyEnum  policy = SMultiline.SUPPRESS_SMALL_LOOPS_FIRST 
)

Repair the autointersections if there were by suppressing the smallest loop bounded by autointersection point.

Parameters
lengthTol(number) The tolerance to detect autointersections. An intersection is detected when the lines have their bounding boxes intersecting and their distances less than lengthTol
loopMaxLength(number) The maximal length of the loop which can be suppressed (-1 means 1/4 of the perimeter of the multiline)
policy(RepairAutoIntersectionPolicyEnum) Policy used to suppress the loops between autointersections.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Value(number) The number of suppressed loops used to suppress them.
ret.Multi(SMultiline) The repaired SMultiline.

◆ Reverse()

SMultiline::Reverse ( )

Reverse the current SMultiline.

◆ RightAngle()

Object SMultiline::RightAngle ( number  threshold)

Modify the vertex of the SMultiline in order to get right angles on the SMultiline.

Note
A threshold < 45 degrees is required
Parameters
threshold(number) Threshold in degrees under which an angle is modified
Return values
ret.ErrorCode(number) The error code.
  • -1: Input SMultine is invalid.
  • 0: OK, all angles in the threshold are made to 90 degrees.
  • 1: An error occurred.

◆ Save()

Object SMultiline::Save ( string  filePath,
SMatrix  coordinateSystemMatrix = SMatrix() 
)

Save the SMultiline into a file.

Note
Supported extensions :
* asc : Ascii XYZ format
Warning
When you write a '\' in string you need to double it '\\' or use '/' instead. Pay especially attention to this when writing file paths in your scripts.
var path = 'C:/Point.asc'; // valid syntax
var path = 'C:\\Point.asc'; // valid syntax
var path = 'C:\Point.asc'; // invalid syntax
Deprecated:
IGES format is deprecated in this function. Use SShape.New(SMultiline multiline, SmoothingMethod method) instead.
Parameters
filePath(string) The complete file path to save into
coordinateSystemMatrix(SMatrix) The matrix to define a UCS used for the export (or identity to use the WCS)
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ SaveColorGradient()

Object SMultiline::SaveColorGradient ( string  filePath)

Save the color gradient into a file (*.rsi binary file).

Warning
When you write a '\' in string you need to double it '\\' or use '/' instead. Pay especially attention to this when writing file paths in your scripts.
var path = 'C:/Point.asc'; // valid syntax
var path = 'C:\\Point.asc'; // valid syntax
var path = 'C:\Point.asc'; // invalid syntax
Parameters
filePath(string) The complete file path to save into
Return values
ret.ErrorCode(number) The error code.
  • 0: OK, no error
  • 1: No color gradient associated to this SMultiline
  • 2: An error occurred

◆ SetLineWidth()

SMultiline::SetLineWidth ( number  width)

Change the thickness of the SMultiline.

Note
The value must be upper than 0, else absolute value is used.
Parameters
width(number) The width to set.

◆ SetMultilineRepresentation()

SMultiline::SetMultilineRepresentation ( MultilineRepresentationTypeEnum  representation)

Modify the representation of the SMultiline.

Parameters
representation(MultilineRepresentationTypeEnum) The different representation types for SMultiline.

◆ ShowName()

SMultiline::ShowName ( boolean  showName)

Control whether the name of the SMultiline is shown or not in the scene.

Parameters
showName(boolean) The new visibility state of the SMultiline

◆ Smooth()

Object SMultiline::Smooth ( number  para1,
number  smoothIntens,
SmoothEnum  smoothingType,
number  maxiDeviation 
)

Recalculate new vertices to smooth the current SMultiline.

Parameters
para1(number) This parameter has two meaning depending on the value of SmoothingType:
  • If iSmoothingType = SMOOTH_TYPE1 or SMOOTH_TYPE2 This parameter is tunning whether the smoothing is local or global. The value should be between 0 and 1. We advice you to take always 1. * If iSmoothingType = SMOOTH_BSPLINE This parameter is the number of points that the line should have after B-spline re-sampling. If less that 2, taking the same number as input SMultiline.
smoothIntens(number) The smoothing intensity. Should be between 1 and 20.
smoothingType(SmoothEnum) Filter type
  • SMultiline.SMOOTH_TYPE1: Order 1 filter. Very smooth filter. The small radii are becoming greater. Smoothing an opened SMultiLine with a very high SmoothIntens will converge to a straight segment between first and last point. Smoothing a closed SMultiline with a very high SmoothIntens will converge to a point, which is the gravity center of the SMultiline.
  • SMultiline.SMOOTH_TYPE2: Order 2 filter. More complex filter based on first derivative that allows to limit as much as possible increasing the radii. Smoothing an opened SMultiline with a very high SmoothIntens will NOT converge to a straight segment. Smoothing a closed SMultiLine with a very high SmoothIntens will NOT converge to a point.
  • SMultiline.SMOOTH_BSPLINE: B-spline smoothing.
maxiDeviation(number) Maximum deviation if smoothing type SMOOTH_TYPE1 or SMOOTH_TYPE2 is selected. If not null, the distance between the vertices before and after smoothing must not exceed this value (after all the smoothing loops). If SmoothingType=SMOOTH_BSPLINE, this parameter is not used.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ SuppressSmallLines()

Object SMultiline::SuppressSmallLines ( number  lengthTol)

Define a SMultiline suppressing the lines which have a length smaller than a tolerance length.

Parameters
lengthTol(number) The tolerance length defines the maximum length a segment can have to be suppressed.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Value(number) The number of suppressed segments.
ret.Multi(SMultiline) The repaired SMultiline.

◆ toString()

string SMultiline::toString ( )

Get the type of the variable.

Returns
(string) The type name

◆ ValuesToString()

string SMultiline::ValuesToString ( )

Get a debug string representation of the SMultiline.

Returns
(string) A debug string representing the SMultiline