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

Provide triangular mesh edition and creation methods. More...

Inheritance diagram for SPoly:
SComp

Public Types

enum  BordersEnum { NO_CHANGE = 0 , REFINE = 1 , EXTEND_REFINE = 2 }
 What should be done with free borders? More...
 
enum  CylinderEnum {
  CYL_FORCE_NOTHING = 0 , CYL_FORCE_RADIUS = 1 , CYL_INIT_RADIUS = 2 , CYL_FORCE_CENTER = 4 ,
  CYL_INIT_CENTER = 8 , CYL_FORCE_DIRECTION = 16 , CYL_INIT_DIRECTION = 32
}
 Which parameter(s) are forced and do not need to be computed? More...
 
enum  DeviationOptionEnum { KEEP_EQUI = 1 , BEST_POS = 2 , ON_BORDERS = 4 }
 The reduction options. More...
 
enum  EExportVertexColor { EXPORT_FBX_NO_COLOR = 0 , EXPORT_FBX_INSPECTION = 1 , EXPORT_FBX_REAL_COLOR = 2 , EXPORT_FBX_COLOR_PER_TRIANGLE = 3 }
 The color information to export. More...
 
enum  FusionOptionEnum { SIMPLE = 0 , REMESH = 1 , FILL_HOLES = 2 , CLOSE = 3 }
 Option for the fusion. More...
 
enum  HoleOptionEnum { NO_CLOSED = 0 , INSIDE_CLOSED = 1 , ALL_CLOSED = 2 }
 How holes should be treated? More...
 
enum  LineEnum { LINE_FORCE_NOTHING = 0 , LINE_FORCE_POINT = 1 , LINE_FORCE_DIRECTION = 2 }
 Enum to know which parameter(s) are forced and do not need to be computed. More...
 
enum  OffsetEnum { NORMAL_OFFSET = 0 , NO_AUTO_INTERSECTION = 8 }
 How auto-intersection are managed? More...
 
enum  PolyRepresentationTypeEnum {
  POLY_SMOOTH = 0 , POLY_FLAT = 1 , POLY_WIRE = 2 , POLY_SMOOTH_WIRE = 3 ,
  POLY_FLAT_WIRE = 4 , POLY_SMOOTH_REALTIME = 5 , POLY_TEXTURE = 6 , POLY_COLORED = 7 ,
  POLY_INSPECTION = 8 , POLY_FLAT_TEXTURE_COLOR = 10 , POLY_TEXTURE_ASYNC = 11
}
 The different representation types for SPoly. More...
 
enum  RotateEnum { ROTATE_AUTO = 0 , ROTATE_CENTROID = 1 , ROTATE_INTERSECTION = 2 , ROTATE_USER_DEFINE = 3 }
 How the extrusion rotate point is computed? More...
 
enum  ScannerType {
  BLK2GO = 0 , BLKARC = 1 , BLK2FLY = 2 , BLK360 = 3 ,
  TRKSeries = 4 , UAV = 5 , RTC360 = 6 , PSeries = 7
}
 Set the scanner type used for the scan. More...
 
enum  SegmentationFeaturesEnum {
  SEGMENTATION_PLANE = 1 , SEGMENTATION_SPHERE = 2 , SEGMENTATION_CONE = 4 , SEGMENTATION_CYLINDER = 8 ,
  SEGMENTATION_All = 255
}
 Which features must be extracted? More...
 
enum  SeparateTriBoxEnum { SEPARATETRIBOX_STRICLTY_INSIDE = 1 , SEPARATETRIBOX_ONLY_CROSSING = 2 , SEPARATETRIBOX_CROSSING_AND_INSIDE = 3 }
 Option for triangle selection. More...
 
enum  SeparateTriBoxSelectEnum { SEPARATETRIBOX_KEEP_INSIDE_TRI = 1 , SEPARATETRIBOX_KEEP_OUTSIDE_TRI = 2 , SEPARATETRIBOX_KEEP_BOTH = 3 }
 The option to know which part has to be kept. More...
 
enum  SmoothEnum { POLY_SMOOTH_KEEP_DETAILS = 1 , POLY_SMOOTH_LIMIT_DIST_BY_PROJ = 2 , POLY_SMOOTH_COMPLEX_SURF = 4 , POLY_SMOOTH_SMOOTH_BORDERS = 8 }
 The options for SPoly.Smooth() More...
 
enum  SphereEnum { SPHERE_FORCE_NOTHING = 0 , SPHERE_FORCE_RADIUS = 1 , SPHERE_FORCE_CENTER = 2 }
 Enum to know which parameter(s) are forced and do not need to be computed. More...
 
enum  StitchOverlapEnum { STITCHOVERLAP_MAKE_SEWING_ZONE_INVISIBLE = 1 , STITCHOVERLAP_REORGANIZE_SEWING_ZONE = 2 , STITCHOVERLAP_MODIFY_OVERLAP_IN_MIDDLE_ZONE = 4 , STITCHOVERLAP_ONLY_CONSISTENT_NORMALES = 8 }
 Stitching options. More...
 
- Public Types inherited from SComp
enum  VisibilityEnum { HIDDEN_ONLY = 0 , VISIBLE_ONLY = 1 , ANY_VISIBILITY = 2 }
 Visible criteria. More...
 

Public Member Functions

Object BooleanAdd (SPoly poly)
 Make a boolean addition with the current SPoly. More...
 
Object BooleanCommon (SPoly poly)
 Get the boolean common part between two closed volumes (the current object and a given SPoly). More...
 
Object BooleanCutIn (SPoly poly)
 Cut the current SPoly against the parameter SPoly and keep the part of the current SPoly that is inside the parameter SPoly. More...
 
Object BooleanCutOut (SPoly poly)
 Cut the current SPoly against the parameter SPoly and keep the part of the current SPoly that is outside the parameter SPoly. More...
 
Object BooleanOperation (SPoly poly, boolean isCutPoly=false)
 Make a boolean operation between two SPoly. More...
 
Object BooleanSub (SPoly poly)
 Make a boolean subtraction with the current object. More...
 
 Clear ()
 Deallocate memory of the object. More...
 
Object Compare (SCloud measCloud, number distMax, number mappingObject=1, boolean isIgnoreEdge=false, SVector direction=null, number maxCosAngle=-2, boolean isCheckForThinParts=false)
 Compute the distances between 2 components for further inspection purpose (color mapping) More...
 
Object Compare (SPoly measPoly, number distMax, number mappingObject=1, boolean isIgnoreEdge=false, SVector direction=null, number maxCosAngle=0, boolean isCheckForThinParts=false)
 Compute the distances between 2 SPoly for further inspection purpose (color mapping) More...
 
Object ConstraintMesh3D (SCloud cloudOfPoints, Array< SMultiline > setOfMultilines, number tolerance, number zoneType)
 Make a 3D meshing on a mesh (this), an array of SMultiline and a point cloud; both are optional but at least one is necessary to add points on the mesh! More...
 
Object Cubature (SPoly secondPoly, SVector projDir=SVector())
 Compute volumes between 2 surfaces to make cubature of embankments and excavations. This function makes the volume computation according to the projection direction projDir. If the projection direction is null, the function will try to evaluate this direction. 2 volumes are computed: volume over Poly0 and under Poly1 (side 1), volume under Poly0 and over Poly1 (side 2) More...
 
Object Explode ()
 Explode a compound SPoly into several parts. More...
 
Object ExplodeColor ()
 Explode a compound mesh into several parts according to the color of the triangles. More...
 
Object ExplodeWithInspectionSteps ()
 Split the mesh according to the inspection steps. More...
 
Object ExtractCylinder (Array< SPoint > seedPoint, number tolerance, CylinderEnum force=SPoly.CYL_FORCE_NOTHING, SPoint center=null, SVector directionVector=SVector(), number radius=0)
 Extract the cylindrical region on the current SPoly starting from seed points. More...
 
Object ExtractFeatureLines (number smoothingIntensity=0)
 Extract all the feature lines on the SPoly. More...
 
Object ExtractLine (SPoint seedPoint, number tolerance, LineEnum force=SPoly.LINE_FORCE_NOTHING, SPoint passingPoint=SPoint(), SVector directionVector=SVector())
 Extract the line on the current polyhedron, starting from seed point(s). More...
 
Object ExtractPlane (SPoint seedPoint, number tolerance)
 Extract the planar region on the current SPoly starting from a seed point. More...
 
Object ExtractSphere (Array< SPoint > seedPoint, number tolerance, SphereEnum force=SPoly.SPHERE_FORCE_NOTHING, SPoint center=null, number radius=0)
 Extract the spherical region on the current SPoly starting from seed points. More...
 
Object FillContours (Array< SMultiline > contourTable, number tension=0.732, number wallThickness=-1, boolean isForceNonSmoothShape=false)
 3D Hole filling. Create triangles on the edges of the holes to fill the concave parts. More...
 
Object FillHoles (Array< SPoint > pointTable, number tension=0, number wallThickness=-1)
 3D Hole filling. Create triangles on the edges of the holes to fill the concave parts. The contours to be treated are selected with a point on the contour. More...
 
Object FillHolesDirection (SVector direction, Array< SPoint > pointTable, number tension=0)
 Fill the holes that have at least one point listed in the table of points. More...
 
Object GetColorGradient ()
 Get the color gradient of the SPoly. More...
 
Object GetContours ()
 Extract free contour(s) from the current SPoly. More...
 
Object GetHighestPoint (SVector direction)
 Get the highest point according to the given direction. More...
 
Object GetInertiaMatrix (boolean doStopIfClosed=true)
 Compute the solid's inertia matrix. More...
 
Object GetLowestPoint (SVector direction)
 Get the lowest point according to the given direction. More...
 
number GetNbPieces ()
 Return the number of independent pieces inside the SPoly. More...
 
Object GetSilhouette (SVector viewDirection, number draftAngle, number minClosedLine, number minUnclosedLine, number resultType)
 Compute the silhouette or external contour of a SPoly according to a direction and possibly a draft angle. More...
 
Object GetSurface ()
 Retrieve the SPoly's surface. More...
 
Object GetTriangleSize ()
 Retrieve the triangle size of current SPoly. More...
 
number GetTrianglesNumber ()
 Get the number of triangles of the SPoly. More...
 
Object GetVolume (boolean isOnlyIfClosed=true)
 Retrieve the SPoly's volume. More...
 
Object InterInfLine (SPoint point, SVector vect)
 Compute the intersection with an infinite line. More...
 
Object Intersect (SPoly poly, number option)
 Make an intersection between two objects (the current object and a given parameter). More...
 
Object LoadColorGradient (string filePath)
 Load the color gradient from a file (*.rsi binary file). More...
 
Object LocalizeValues (Array< number > thresholdList)
 Extract the points or the lines at threshold values of an inspected mesh. More...
 
Object MeshSegmentation (number angleThreshold=15, number mergeMaxDistance=0, number minRegionArea=0, number classificationMaxDistance=0, SegmentationFeaturesEnum featuresOption=SPoly.SEGMENTATION_All)
 Segment a mesh in several regions matching with geometric features (SPlane, SSphere, SCylinder and SCone). The algorithm relies on region growing mechanism and works in two steps:
1 - Create small regions from triangles sharing almost the same normals (according to angleThreshold).
2 - Merge similar regions sharing geometric properties. More...
 
Object Offset (boolean isDirect, number distCoef, OffsetEnum option=SPoly.NORMAL_OFFSET)
 Compute and return a new parallel SPoly. More...
 
Object Proj3D (SMultiline multilineToProject, boolean addIntermediatePt=true)
 Compute the 3D projection of a SMultiline on a SPoly. More...
 
Object Proj3D (SPoint point)
 Compute the 3D projection of a SPoint on a SPoly.
This function always returns the nearest point. More...
 
Object ProjDir (SMultiline multilineToProject, SVector direction, boolean addIntermediatePt=true, boolean isSignedProjection=false)
 Compute the projection of a SMultiline on a SPoly with a direction. More...
 
Object ProjDir (SPoint point, SVector direction, boolean isSignedProjection=false)
 Compute the projection of a SPoint on a SPoly with a direction.
The point to project is considered as the origin of the direction. More...
 
Object Reduce (number targetNbVertex, number minAngle)
 Reduce a mesh according to the angle between facets to minimize the visual degradation. More...
 
Object ReduceDeviation (number deviationError, DeviationOptionEnum criteria, boolean isSharpEdgeKept=false, number deviationOnSharpEdges=0, number sharpEdgeAngleValue=0, number maxEdgeLength=0, number deviationOnBorders=0)
 Reduce the SPoly by deleting some vertices and triangles according to a deviation error. More...
 
Object RemeshRefineDev (number deviation, number sizeMin, number maxiTriNumber, BordersEnum borderOption, number distanceWrongPoints, number reorganize, SCloud cloud=null, number maxCosAngle=-1)
 Refine an existing SPoly with deviation error and optionally better fitting on a SCloud. More...
 
Object RemeshSharpEdge (Array< SMultiline > lines, SPoint referencePoint)
 Modify locally the existing mesh to recreate sharp edge(s) More...
 
Object RemoveSpikes (number loopNumber=1, number propag=-1, number intensity=1, boolean isRecomputeBorder=true)
 Suppress or correct absurd points (i.e. spikes) of the current SPoly. More...
 
Object RemoveTrianglesOnHoles (SCloud cloud, number holeSize, number maxDistToCloud=-1, number maxAngle=-1)
 Remove triangles which are considered to be over a hole of a certain diameter regarding 'cloud'. More...
 
Object Save (string filePath, boolean isTextExport=false, SMatrix coordinateSystemMatrix=SMatrix())
 Save the mesh into a file. More...
 
Object SaveColorGradient (string filePath)
 Save the color gradient into a file (*.rsi binary file). More...
 
Object SectionCylindric (SPoint firstPointOnAxis, SPoint secondPointOnAxis, SPoint pointOnTheFirstCylinder, number numberOfCylinders, number distancebetweenCylinders)
 Compute the intersection of a SPoly with parallel cylinders. More...
 
Object SectionOnMulti (SMultiline multiLine, Array< number > listDist, number maxDist, number optBitMask=0)
 Compute the sections of a SPoly (for example a tube or a tunnel) along a SMultiline (normal to the SMultiline). We take points on the neutral axis which are regularly distributed according to a curvilinear distance. More...
 
Object SectionOnMultiReg (SMultiline multiLine, number dist, number maxDist, number optBitMask=0)
 Compute the sections of a SPoly (for example a tube or a tunnel) along a SMultiline (normal to the SMultiline). We take a list of curvilinear distances. More...
 
Object SectionPlane (SVector planeNormal, SPoint ptFirstPlane, number nbPlanes, number distance)
 Compute the intersection between a SPoly and a parallel plane. More...
 
Object SectionRadial (SPoint firstPointOnAxis, SPoint secondPointOnAxis, SPoint ptFirstPlane, number nbSections, number maxAngleInRadian)
 Compute the intersection of a SPoly by radial planes. More...
 
Object SeparateTriangleBox (SPoint lowerPoint, SPoint upperPoint, SeparateTriBoxEnum selType, SeparateTriBoxSelectEnum whichPartToKeep)
 Separate triangles of a SPoly according to a box. Depending of whichPartToKeep, the current SPoly is updated and Array.Poly can be fill also (case of SEPARATETRIBOX_KEEP_BOTH). More...
 
Object SeparateTriangleInPrism (SMultiline profil, number distance, SeparateTriBoxEnum selType, SeparateTriBoxSelectEnum whichPartToKeep)
 Separate triangles of a SPoly according to a prism. Depending of iWhichPartToKeep, the current SPoly is updated and Array.Poly can be fill also (case of SEPARATETRIBOX_KEEP_BOTH). The prism is created by a given planar profile and is extruded on both sides using given distance/2. More...
 
Object SeparateTriangleSize (number smallestSize, number biggestSize)
 Separate a SPoly into parts according to the triangle size. More...
 
Object SeparateTriangleWithActivatedClippingPlanes (Array< SClippingPlane > clippingPlanes, SeparateTriBoxEnum selType)
 Separate triangles of a mesh according to clipping planes. Depending of iWhichPartToKeep, the current SPoly is updated and Array.Poly can be fill also (case of SEPARATETRIBOX_KEEP_BOTH). More...
 
Object SetBorders (Array< SMultiline > multiTbl, number remeshDistance)
 Create a new SPoly by updating the input one in order to make it fit the input border. More...
 
 SetPolyRepresentation (PolyRepresentationTypeEnum representation)
 Set the representation of the SPoly. More...
 
Object Smooth (number loopNumber, SmoothEnum option, number maxiDeviation, boolean isReorganise, number minAngleReorg, number refineDistProj=-1, number refineVrtxAngle=-1, number angleSharpEdge=-1, number nbTriMax=-1)
 Smooth the surface of the current SPoly. More...
 
Object SmoothBorders (Array< SPoint > pointTable, number maxEdgeLength=0)
 3D smoothing of borders. The function creates triangles on the edges of the holes to create smooth borders. The borders to be treated are selected with a point on the borders. More...
 
 SPoly ()
 Default constructor to create an empty new SPoly. More...
 
 SPoly (SPoly other)
 Constructs a SPoly by copying the SPoly other. More...
 
Object StitchOverlap (SPoly meshToStitch, number tolDist, StitchOverlapEnum options)
 Stitch a SPoly (meshToStitch) with the current SPoly. More...
 
Object SubdivideTriangles (number maxEdgeLength, boolean ignoreFreeEdges=false, number limitCos=0, boolean preserveGeometry=false)
 Subdivide triangles when at least one of its edges is longer than the maximum allowed edge length. More...
 
Object Tolerance3DMesh (SCloud cloud, number deviation, number distanceWrongPoints, number sizeTriMax, boolean isReorganize, number extension, boolean isNoiseReduct)
 Upgrade the current SPoly by using its topology. More...
 
string toString ()
 Get the type of the variable. More...
 
string ValuesToString ()
 Get a debug string representation of the poly. More...
 
Object VolumeFromElevation (Array< number > elevations, SVector projDir=SVector())
 Compute the volume of the SPoly above and below the given elevation. More...
 
Object WriteOnMesh (string textToWrite, SVector textNormal, SVector textHorizontalNormal, SPoint textPosition, number textDepth, number planeDepth, number scale, string font="Arial", boolean isBold=false, boolean isItalic=false, number writingStyle=1)
 Write a text on a mesh. The mesh will be engraved. 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 ()
 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< SPolyAll (VisibilityEnum visCrit=SComp.ANY_VISIBILITY)
 Get all the SPoly in the document. More...
 
static Object ColorAlongDir (Array< SPoly > polys, SVector directionVect, SPoint origin=null)
 Color the SPoly along a direction with a gradient. More...
 
static Object ConstraintMesh2D (SCloud cloudOfPoints, Array< SMultiline > setOfMultilines, SVector meshDir, number tolerance, number zoneType)
 Make a 2D1/2 meshing on an array of SMultiline and a point cloud; both are optional but at least one is necessary! More...
 
static Object CreateCompound (Array< SPoly > tablePoly, boolean optOrient=false)
 Make a compound SPoly from a table of SPoly. More...
 
static Object Direct3DMesh (SCloud cloudToMesh, number deviationError, number minAverageDist, HoleOptionEnum optionHole, number sizeTriHole, boolean isScanDirIgnored=false)
 Make a direct 3D mesh of a SCloud according to different strategies (regular, deviation, etc.). More...
 
static Object DirectionMesh (SCloud cloudOfPoints, SVector meshingDirection, number tolerance, boolean isFindContour=false)
 Mesh a cloud of points according to a certain tolerance and direction (2D1/2 meshing) More...
 
static Object Extrusion (SMultiline profile, SMultiline path, boolean turnWithPath=true, boolean perpendicularToPath=true, SMultiline secondPath=null, RotateEnum option=SPoly.ROTATE_AUTO, SPoint rotatePt=null)
 Create a mesh from a path and a profile, the profile is extracted along the path. More...
 
static Object FromClick ()
 Launch an interaction to select a SPoly in the scene. More...
 
static Object FromFile (string fileName)
 Import a mesh, and create a new SPoly from a file. More...
 
static Array< SPolyFromName (string name)
 Search all the SPoly with the given name. More...
 
static Array< SPolyFromSel ()
 Get all the selected SPoly. More...
 
static Object Fusion (Array< SPoly > polyTable, FusionOptionEnum option, number accuracyPoint=1e-05, number accuracyBorders=0.001)
 Sew common edges of a SPoly list, or rebuild topology of existing SPoly. More...
 
static Object JoinContour (Array< SMultiline > multiLines, Array< SPoly > polyhedrons, number tangency1=0, number tangency2=0, number tension=0.732, boolean reorganize=false, number nbPoint=0)
 Create a meshed surface from two contours or mesh holes, which optionally preserves tangency continuity. More...
 
static Object LinearExtrusion (number length, SVector direction, boolean closeExtremities, Array< SComp > comps)
 Compute poly(s) corresponding to the extrusion of profile(s) (SMultiline, linear SFeature, linear SShape object) along a direction, with a given length. More...
 
static Object MergeCommonBorders (Array< SPoly > polyTable, FusionOptionEnum option, number accuracyPoint=1e-05, number accuracyBorders=0.001)
 Sew common edges of a SPoly list, or rebuild topology of existing SPoly. More...
 
static SPoly New ()
 Default constructor to create an empty new SPoly. More...
 
static SPoly New (SPoly other)
 Constructs a SPoly by copying the SPoly other. More...
 
static Object PipeTubeAlongPath (number radius, boolean closeExtremities, Array< SComp > comps)
 Compute SPoly corresponding to the extrusion of a circle with a given radius along a given path. More...
 
static Object ProfileAlongPath (SComp profile, SComp path, boolean makePerpendicular, boolean turnWthCurve, boolean usePathToLeanOn, boolean startAtProfilePosition, boolean closeExtremities, SComp pathToLeanOn)
 Compute the SPoly corresponding to the extrusion of a given profile along a given path. More...
 
static Object ProfileAlongPath (SComp profile, SComp path, boolean turnWthPath, SPoint profileBasePoint, SComp leanPath, SPoint profileLeanPoint, boolean closeExtremities)
 Compute the SPoly corresponding to the extrusion of a given profile along a given path. More...
 
static number SaveFBX (string filePath, Array< SPoly > meshesToExport, boolean isExportTexture=false, EExportVertexColor exportVertexColor=SPoly.EXPORT_FBX_NO_COLOR, SMatrix coordinateSystemMatrix=SMatrix())
 Save the SPoly(s) into a FBX file. More...
 
static Object ScanToMesh (SCloud cloud, number boxSize, number averagePointDistance, number minTriangleSize, number texturePixelSize=0.01, boolean ignoreScanDir=false)
 Compute a SPoly from a scanned data by specifying meshing parameters. More...
 
static Object ScanToMesh (SCloud cloud, ScannerType scannerType, boolean textureFromCloud, boolean ignoreScanDir=false)
 Compute a SPoly from a scanned data by specifying the scanner type. More...
 
static Object ScanToMesh (SCwCloud cloud, number boxSize, number averagePointDistance, number minTriangleSize, number texturePixelSize=0.01, boolean ignoreScanDir=false)
 Compute a SPoly from a scanned data by specifying meshing parameters. More...
 
static Object ScanToMesh (SCwCloud cloud, ScannerType scannerType, boolean textureFromCloud, boolean ignoreScanDir=false)
 Compute a SPoly from a scanned data by specifying the scanner type. More...
 
static Object SphericalMesh (Array< SCloud > cloudOfPoints, SPoint scanPos, number regularSampling, number deviationErr, number maxiNbTriangle, number alphaShapeThreshold, number maxSizeThreshold, number minSizeThreshold, number deleteSmall)
 Make a spherical 3D mesh from SCloud(s) 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 triangular mesh edition and creation methods.

Member Enumeration Documentation

◆ BordersEnum

What should be done with free borders?

Enumerator
NO_CHANGE 

Don't change free edges (borders)

REFINE 

Refine free edges.

EXTEND_REFINE 

Extend (if some cloud points are outside free borders) and refine free edges. The extension value is 'distanceWrongPoints', if not zero or the average triangle size of the current SPoly.

◆ CylinderEnum

Which parameter(s) are forced and do not need to be computed?

Enumerator
CYL_FORCE_NOTHING 

Nothing is forced.

CYL_FORCE_RADIUS 

The radius is forced.

CYL_INIT_RADIUS 

The radius is initialized (near from its good value)

CYL_FORCE_CENTER 

The center is forced (an axis passing through Center should be found)

CYL_INIT_CENTER 

The center is initialized (near from its good position)

CYL_FORCE_DIRECTION 

The direction is forced (directionVector exactly)

CYL_INIT_DIRECTION 

The direction is approximately (directionVector nearly)

◆ DeviationOptionEnum

The reduction options.

Enumerator
KEEP_EQUI 

Re-mesh locally to preserve equilateral triangles if it is possible.

BEST_POS 

Allow to move the point to another position in order to keep the mesh aspect (create new vertices).

ON_BORDERS 

Allow to also reduce the free borders (will reduce free borders size and can result in filling some small holes).

◆ EExportVertexColor

The color information to export.

Enumerator
EXPORT_FBX_NO_COLOR 

No color to export.

EXPORT_FBX_INSPECTION 

Export inspection color.

EXPORT_FBX_REAL_COLOR 

Export real color.

EXPORT_FBX_COLOR_PER_TRIANGLE 

Export color per triangle.

◆ FusionOptionEnum

Option for the fusion.

Enumerator
SIMPLE 

Simple fusion without any modification.

REMESH 

If parallel free contour are found try to re-mesh locally to merge them.

FILL_HOLES 

Try to fill all the holes except the biggest one (free border).

CLOSE 

Try to close the SPoly.

◆ HoleOptionEnum

How holes should be treated?

Enumerator
NO_CLOSED 

Try to detect all the holes.

INSIDE_CLOSED 

Detect the outside border and fill the inside holes (only one free border). There is no warranty that the result will exactly correspond to you wish. See remark that follows.

ALL_CLOSED 

Try to close the SPoly (watertight mesh). As the word "try" suggests, there is no warranty that the mesh will be closed if you use this option. When you select this option, the software will only fill the holes that can be filled without creating an absurd shape. In particular, if the software finds some very sharp angles or surface auto-intersection or reversed normals the function will refuse to close and the mesh will remain open. If you want to increase the probability to obtain a closed mesh, you should use SPoly.FillHoles(), which provides an option to fill the holes "unconditionally".

◆ LineEnum

Enum to know which parameter(s) are forced and do not need to be computed.

Enumerator
LINE_FORCE_NOTHING 

Nothing is forced.

LINE_FORCE_POINT 

Average point is forced (a line passing by this point should be found)

LINE_FORCE_DIRECTION 

Line direction is forced (a line with this direction should be found)

◆ OffsetEnum

How auto-intersection are managed?

Enumerator
NORMAL_OFFSET 

The raw offset, auto-intersection are not removed.

NO_AUTO_INTERSECTION 

If one, auto-intersection are removed in the zones where the offset value is greater than the local radius.

◆ PolyRepresentationTypeEnum

The different representation types for SPoly.

Enumerator
POLY_SMOOTH 

Flat shading and compatible with real time edition.

POLY_FLAT 

Segments and vertices are displayed.

POLY_WIRE 

Wireframe.

POLY_SMOOTH_WIRE 

Smooth shading et wireframe together.

POLY_FLAT_WIRE 

Flat shading and wireframe together.

POLY_SMOOTH_REALTIME 

Smooth shading and compatible with real time edition.

POLY_TEXTURE 

Textured points / Vertex.

POLY_COLORED 

Colored points / Vertex.

POLY_INSPECTION 

Compute a color based on a value on each vertex.

POLY_FLAT_TEXTURE_COLOR 

Representation with one color per texture.

POLY_TEXTURE_ASYNC 

Representation for texture asynchronous.

◆ RotateEnum

How the extrusion rotate point is computed?

Enumerator
ROTATE_AUTO 

Function will defined automatically the good rotate point.

ROTATE_CENTROID 

Use centroid of the profile.

ROTATE_INTERSECTION 

Use intersection of the profile with path.

ROTATE_USER_DEFINE 

You must defined your rotate point.

◆ ScannerType

Set the scanner type used for the scan.

Enumerator
BLK2GO 

Data from BLK2GO.

BLKARC 

Data from BLKARC.

BLK2FLY 

Data from BLK2FLY.

BLK360 

Data from BLK360.

TRKSeries 

Data from TRKSeries.

UAV 

Data from UAV.

RTC360 

Data from RTC360.

PSeries 

Data from PSeries.

◆ SegmentationFeaturesEnum

Which features must be extracted?

Enumerator
SEGMENTATION_PLANE 

Extract planes in the mesh segmentation.

SEGMENTATION_SPHERE 

Extract spheres in the mesh segmentation.

SEGMENTATION_CONE 

Extract cones in the mesh segmentation.

SEGMENTATION_CYLINDER 

Extract cylinders in the mesh segmentation.

SEGMENTATION_All 

Extract all available features in the mesh segmentation.

◆ SeparateTriBoxEnum

Option for triangle selection.

Enumerator
SEPARATETRIBOX_STRICLTY_INSIDE 

Select triangles that are strictly inside the box.

SEPARATETRIBOX_ONLY_CROSSING 

Select triangles that are only crossing the box.

SEPARATETRIBOX_CROSSING_AND_INSIDE 

Select triangles that are crossing the box or inside.

◆ SeparateTriBoxSelectEnum

The option to know which part has to be kept.

Enumerator
SEPARATETRIBOX_KEEP_INSIDE_TRI 

Update the current SPoly and keep only triangles inside the box (or only triangles crossing the box).

SEPARATETRIBOX_KEEP_OUTSIDE_TRI 

Update the current SPoly and Keep only unselected triangles.

SEPARATETRIBOX_KEEP_BOTH 

Keep both parts, the current SPoly will be made with unselected triangles, the selected triangles will be put inside the output.

◆ SmoothEnum

The options for SPoly.Smooth()

Enumerator
POLY_SMOOTH_KEEP_DETAILS 

Do we try to limit increasing the radii and reducing the mesh volume and surface? The most efficient smoothing, noise reduction and response time is obtained if you disable this feature.

POLY_SMOOTH_LIMIT_DIST_BY_PROJ 

Determine whether we should limit the distance of the new vertex location against the projection on the original surface (1) or against the original vertex location (0).

POLY_SMOOTH_COMPLEX_SURF 

Do we consider original mesh triangles as complex surfaces (1) to compute the distance of the new vertex location or do we consider original mesh triangles as flat surfaces (0)

POLY_SMOOTH_SMOOTH_BORDERS 

Determine if free borders can move (1) or if free borders must stay immobile (0) to make fusion after with another mesh.

◆ SphereEnum

Enum to know which parameter(s) are forced and do not need to be computed.

Enumerator
SPHERE_FORCE_NOTHING 

Nothing is forced.

SPHERE_FORCE_RADIUS 

The radius is forced.

SPHERE_FORCE_CENTER 

The center is forced.

◆ StitchOverlapEnum

Stitching options.

Enumerator
STITCHOVERLAP_MAKE_SEWING_ZONE_INVISIBLE 

Modify the sewing zone so that it should not be visible.

STITCHOVERLAP_REORGANIZE_SEWING_ZONE 

Reorganize the sewing zone.

STITCHOVERLAP_MODIFY_OVERLAP_IN_MIDDLE_ZONE 

Modify the output overlapping surface so that it becomes in the middle of the two input surfaces.

STITCHOVERLAP_ONLY_CONSISTENT_NORMALES 

Process only overlapping areas having triangle normals oriented in the same way. Do not change triangle orientation during the stitching.

Constructor & Destructor Documentation

◆ SPoly() [1/2]

SPoly::SPoly ( )

Default constructor to create an empty new SPoly.

◆ SPoly() [2/2]

SPoly::SPoly ( SPoly  other)

Constructs a SPoly by copying the SPoly other.

Parameters
other(SPoly) The other SPoly to copy.

Member Function Documentation

◆ All()

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

Get all the SPoly in the document.

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

◆ BooleanAdd()

Object SPoly::BooleanAdd ( SPoly  poly)

Make a boolean addition with the current SPoly.

Warning
The two SPoly must be closed
See also
SPoly.BooleanOperation()
Parameters
poly(SPoly) The second SPoly
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) The boolean operation's result.

◆ BooleanCommon()

Object SPoly::BooleanCommon ( SPoly  poly)

Get the boolean common part between two closed volumes (the current object and a given SPoly).

Warning
The two SPoly must be closed
See also
SPoly.BooleanOperation()
Parameters
poly(SPoly) The second SPoly
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) The boolean operation's result.

◆ BooleanCutIn()

Object SPoly::BooleanCutIn ( SPoly  poly)

Cut the current SPoly against the parameter SPoly and keep the part of the current SPoly that is inside the parameter SPoly.

Warning
The two SPoly must be closed
See also
SPoly.BooleanOperation()
Parameters
poly(SPoly) The second SPoly
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) The boolean operation's result.

◆ BooleanCutOut()

Object SPoly::BooleanCutOut ( SPoly  poly)

Cut the current SPoly against the parameter SPoly and keep the part of the current SPoly that is outside the parameter SPoly.

Warning
The two SPoly must be closed
See also
SPoly.BooleanOperation()
Parameters
poly(SPoly) The second SPoly
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) The boolean operation's result.

◆ BooleanOperation()

Object SPoly::BooleanOperation ( SPoly  poly,
boolean  isCutPoly = false 
)

Make a boolean operation between two SPoly.

Note
This function is designed to make all boolean operation. The part of the object that is kept depends on the normal orientation. This function can work both with closed volumes or opened surface. However if an opened surface is entered, an incomplete result may occur depending on free border locations. If closed volumes are entered, this function can make either an addition or a subtraction or a common, depending on the normal orientation.
See also
SPoly.Intersect().
Parameters
poly(SPoly) The second SPoly
isCutPoly(boolean) if true, make a cut of this against SPoly (No facet of SPoly is output in result).
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) The boolean operation's result.

◆ BooleanSub()

Object SPoly::BooleanSub ( SPoly  poly)

Make a boolean subtraction with the current object.

Warning
The two SPoly must be closed
See also
SPoly.BooleanOperation()
Parameters
poly(SPoly) The second SPoly
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) The boolean operation's result.

◆ Clear()

SPoly::Clear ( )

Deallocate memory of the object.

◆ ColorAlongDir()

static Object SPoly::ColorAlongDir ( Array< SPoly polys,
SVector  directionVect,
SPoint  origin = null 
)
static

Color the SPoly along a direction with a gradient.

Note
The color used to display the mesh is spread on all meshes
Parameters
polys(Array<SPoly>) The table of SPoly to color
directionVect(SVector) The direction used for coloring
origin(SPoint) The origin (the SPoint at which the value should be zero)
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) The resulting colored SPoly.This table contains the same number of SPoly as the input table

◆ Compare() [1/2]

Object SPoly::Compare ( SCloud  measCloud,
number  distMax,
number  mappingObject = 1,
boolean  isIgnoreEdge = false,
SVector  direction = null,
number  maxCosAngle = -2,
boolean  isCheckForThinParts = false 
)

Compute the distances between 2 components for further inspection purpose (color mapping)

Note
The distance is measured by projecting component measCloud on 'this'. 'This' is considered as the reference object while measCloud is considered as the measure to project on 'this'.
The floating value returned on each vertex are >0 if measured points are "over" this (that is: in the way of the normal), otherwise <0 if measured points are under the surface.
Parameters
measCloud(SCloud) SCloud considered as the measured object to project on this
distMax(number) Ignore point having a distance greater than distMax.
mappingObject(number) Choose the object to color.
  • 1: The color mapping is done on 'this'
  • 2: the color mapping is done on measCloud.
isIgnoreEdge(boolean) What should be done with points on edges?
  • false: Project all points
  • true: Ignore points having their projection on edge.
direction(SVector) The direction of the inspection. Use null to do a 3D inspection.
maxCosAngle(number) The max cos value for the angle between the triangle and the scanning direction if the cloud contains scanning direction, this parameter can be used to reject points whose scanning direction is not valid according to this threshold.
  • < -1: The scanning direction will never invalidate a point
  • 0: The scanning direction and the triangle must be oriented in the same way
isCheckForThinParts(boolean) Does the cloud contains thin parts scanned from both sides? This option is only valid if the cloud contains scanning direction and maxCosAngle>-2
  • true: It is necessary to find a triangle with a valid orientation
  • false: The closest triangle is the good one.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Cloud(SCloud) The new SCloud, which is the result of the comparison, if mappingObject is set to 2.
ret.Poly(SPoly) The new SPoly, which is the result of the comparison, if mappingObject is set to 1.
ret.ReportData(SReportData) The new SReportData, which contains the view set with the inspected component.

◆ Compare() [2/2]

Object SPoly::Compare ( SPoly  measPoly,
number  distMax,
number  mappingObject = 1,
boolean  isIgnoreEdge = false,
SVector  direction = null,
number  maxCosAngle = 0,
boolean  isCheckForThinParts = false 
)

Compute the distances between 2 SPoly for further inspection purpose (color mapping)

Note
The distance is measured by projecting component measPoly on 'this'. 'This' is considered as the reference object while measPoly is considered as the measure to project on 'this'.
The floating value returned on each vertex are >0 if measured points are "over" this (that is: in the way of the normal), otherwise <0 if measured points are under the surface.
Parameters
measPoly(SPoly) The SPoly considered as the measured object to project on this
distMax(number) Ignore point having a distance greater than this one.
mappingObject(number) Choose the object to color.
  • 1: The color mapping is done on 'this'
  • 2: the color mapping is done on measPoly.
isIgnoreEdge(boolean) What should be done with points on edges?
  • false: Project all points
  • true: Ignore points having their projection on edge.
direction(SVector) The direction of the inspection. Use null to do a 3D inspection.
maxCosAngle(number) The max cos value for the angle between the triangle normal of each mesh. This parameter can be used to reject triangles whose angle between normals is not valid according to this threshold.
  • < -1: The angle between normals will never invalidate a triangle
  • 0: The normals must be oriented in the same way
isCheckForThinParts(boolean) Does the mesh contains thin parts? This option is only valid if maxCosAngle>-2
  • true: It is necessary to find a triangle with a valid orientation
  • false: The closest triangle is the good one.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The new SPoly, which is the result of the comparison.
ret.ReportData(SReportData) The new SReportData, which contains the view set with the inspected component.

◆ ConstraintMesh2D()

static Object SPoly::ConstraintMesh2D ( SCloud  cloudOfPoints,
Array< SMultiline setOfMultilines,
SVector  meshDir,
number  tolerance,
number  zoneType 
)
static

Make a 2D1/2 meshing on an array of SMultiline and a point cloud; both are optional but at least one is necessary!

Note
The function chooses the most relevant points in the cloud according to the accuracy (tolerance) it must reach. Only those points are meshed. If a set of contours is entered, the contour points are meshed with a zero tolerance (i.e. all the contour points are kept) and the resulting free borders of the mesh(es) are the contours.
See also
SPoly.ConstraintMesh3D()
Parameters
cloudOfPoints(SCloud) The cloud of points to mesh or 0
setOfMultilines(Array<SMultiline>) Set of contours to merge and mesh with the cloud or an empty table if no contour to insert in the constrain meshing.
meshDir(SVector) This vector defines the meshing direction for which all the points, triangles and contours are visible.
tolerance(number) The tolerance to respect ; deviation error (for the points of the cloud only).
zoneType(number) Defines which type of result must be output.
  • 0: One SPoly is output. The outer contour (if it exists) is considered as the external free border and the inner contours are considered as holes. If outside contour and holes are correctly detected, the triangles outside the external contour or inside the holes (if they exist) are deleted.
  • 1: All the pieces separated by a closed contours are kept.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) A table of SPoly with one or many SPoly according to the input option.

◆ ConstraintMesh3D()

Object SPoly::ConstraintMesh3D ( SCloud  cloudOfPoints,
Array< SMultiline setOfMultilines,
number  tolerance,
number  zoneType 
)

Make a 3D meshing on a mesh (this), an array of SMultiline and a point cloud; both are optional but at least one is necessary to add points on the mesh!

Note
The function chooses the most relevant points in the cloud according to the accuracy (tolerance) it must reach. Only those points are meshed. If a set of contours is entered, the contour points are meshed with a zero tolerance (i.e. all the contour points are kept) and the resulting free borders of the mesh(es) are the contours.
both the point cloud and the polylines should be projected onto the mesh to obtain good results
See also
SPoly.ConstraintMesh2D()
Parameters
cloudOfPoints(SCloud) The cloud of points to mesh or null
setOfMultilines(Array<SMultiline>) Set of contours to merge and mesh with the cloud or an empty table if no contour to insert in the constrain meshing.
tolerance(number) The tolerance to respect ; deviation error (for the points of the cloud only).
zoneType(number) Defines which type of result must be output.
  • 0: One SPoly is output. The outer contour (if it exists) is considered as the external free border and the inner contours are considered as holes. If outside contour and holes are correctly detected, the triangles outside the external contour or inside the holes (if they exist) are deleted.
  • 1: All the pieces separated by a closed contours are kept.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) A table of SPoly with one or many SPoly according to the input option.

◆ CreateCompound()

static Object SPoly::CreateCompound ( Array< SPoly tablePoly,
boolean  optOrient = false 
)
static

Make a compound SPoly from a table of SPoly.

Note
No control is done. No sewing or fusion operation is done previously. Then, the resulting SPoly can contain several pieces. To retrieve independent SPoly, use SPoly.Explode().
Parameters
tablePoly(Array<SPoly>) The table of SPoly to proceed.
optOrient(boolean) Should we have the same normal orientation for all parts?
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The compound SPoly.

◆ Cubature()

Object SPoly::Cubature ( SPoly  secondPoly,
SVector  projDir = SVector() 
)

Compute volumes between 2 surfaces to make cubature of embankments and excavations. This function makes the volume computation according to the projection direction projDir. If the projection direction is null, the function will try to evaluate this direction. 2 volumes are computed: volume over Poly0 and under Poly1 (side 1), volume under Poly0 and over Poly1 (side 2)

Parameters
secondPoly(SPoly) The second SPoly
projDir(SVector) The projection direction or null if none
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.ValueTbl(Array<number>) [0] Volume over current mesh and under secondPoly (side 1)
[1] Volume under current mesh and over secondPoly (side 2)

◆ Direct3DMesh()

static Object SPoly::Direct3DMesh ( SCloud  cloudToMesh,
number  deviationError,
number  minAverageDist,
HoleOptionEnum  optionHole,
number  sizeTriHole,
boolean  isScanDirIgnored = false 
)
static

Make a direct 3D mesh of a SCloud according to different strategies (regular, deviation, etc.).

Note
The function chooses the most relevant points in the cloud according to the deviation error it must reach. The result returned can be used as is or as a "topology", in order to use the functions SPoly.Tolerance3DMesh() and (or) SPoly.RemeshRefineDev().
See also
SPoly.ScanToMesh()
Parameters
cloudToMesh(SCloud) The SCloud to mesh
deviationError(number) The deviation error ( tolerance ) to respect.
minAverageDist(number) The noise reduction strategy
  • =0: No noise reduction. In this case, the only filter is deviationError. deviationError=0 means meshing all the points.
  • >0: Minimum average distance between points. The function project a "grid" of this size on the shape to mesh and takes ONLY the best points in each grid element. Then, the subset represented by these points is meshed with the deviation error. The point meshed are the points returned by SCloud.ReduceBest()
  • <0: Greatest level of detail. The function tries first to choose the best points as if miniAverageDist>0 AND deviationError=0. Then, if the tolerance is not reached, the other points (suspected to be noisy) can also be chosen.
optionHole(HoleOptionEnum) How holes should be treated?
  • SPoly.NO_CLOSED: Try to detect all the holes
  • SPoly.INSIDE_CLOSED: Detect the outside border and fill the inside holes (only one free border). There is no warranty that the result will exactly correspond to you wish. See remark that follows.
  • SPoly.ALL_CLOSED: Try to close the SPoly (watertight mesh). As the word "try" suggests, there is no warranty that the mesh will be closed if you use this option. When you select this option, the software will only fill the holes that can be filled without creating an absurd shape. In particular, if the software finds some very sharp angles or surface auto-intersection or reversed normals the function will refuse to close and the mesh will remain open. If you want to increase the probability to obtain a closed mesh, you should use SPoly.FillHoles(), which provides an option to fill the holes "unconditionally".
sizeTriHole(number) The maximum length of triangles to fill holes. (-1 if no limit.)
isScanDirIgnored(boolean) Ignore scan directions when meshing
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The SPoly or a compound SPoly (in the case where the cloud is made of several parts).Especially check 'sizeTriHole': if this value is too small, no SPoly will be created

◆ DirectionMesh()

static Object SPoly::DirectionMesh ( SCloud  cloudOfPoints,
SVector  meshingDirection,
number  tolerance,
boolean  isFindContour = false 
)
static

Mesh a cloud of points according to a certain tolerance and direction (2D1/2 meshing)

Note
All the points of the SCloud and contour must be visible from the meshingDirection. The function chooses the most relevant points in the cloud according to the accuracy (tolerance) it must reach. Only those points are meshed.
The result returned can be used as is or used as a "topology", i.e. by using the function SPoly.Tolerance3DMesh().
See also
SPoly.Tolerance3DMesh(), SPoly.RemeshRefineDev(), SPoly.Direct3DMesh()
Parameters
cloudOfPoints(SCloud) The SCloud to mesh
meshingDirection(SVector) The direction for which all the points are visible. It is the 2D meshing direction.
tolerance(number) The tolerance to respect.
isFindContour(boolean) If true, find the best contour according to the point density.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The computed SPoly.

◆ Explode()

Object SPoly::Explode ( )

Explode a compound SPoly into several parts.

Note
If the current SPoly is made of several disconnected pieces the current mesh is exploded.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) A table with all exploded SPoly (sorted by size).

◆ ExplodeColor()

Object SPoly::ExplodeColor ( )

Explode a compound mesh into several parts according to the color of the triangles.

Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) A table with all exploded SPoly (sorted by size).

◆ ExplodeWithInspectionSteps()

Object SPoly::ExplodeWithInspectionSteps ( )

Split the mesh according to the inspection steps.

Return values
ret.ErrorCode(number) The error code:
  • 0: No error, no cluster deleted.
  • 1: Impossible to explode because the mesh contains no inspection steps.
  • 2: An exception occurred.
ret.PolyTbl(Array<SPoly>) The resulting list of components.

◆ ExtractCylinder()

Object SPoly::ExtractCylinder ( Array< SPoint seedPoint,
number  tolerance,
CylinderEnum  force = SPoly.CYL_FORCE_NOTHING,
SPoint  center = null,
SVector  directionVector = SVector(),
number  radius = 0 
)

Extract the cylindrical region on the current SPoly starting from seed points.

Parameters
seedPoint(Array<SPoint>) All seed points around which the cylindrical region should be extracted.
tolerance(number) The tolerance used for extraction. Extracts only the region that is inside the tolerance. That is to say: only the vertices whose distance with the ideal cylinder is less than this threshold.
force(CylinderEnum) Enum to know which parameter(s) is forced or initialized (initializing the computation provides a faster computation).
center(SPoint) The first point of the center line.
directionVector(SVector) The normed normal vector of the cylinder.
radius(number) The radius of the cylinder to force
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Cylinder(SCylinder) The resulting best SCylinder
ret.StdDeviation(number) The standard deviation

◆ ExtractFeatureLines()

Object SPoly::ExtractFeatureLines ( number  smoothingIntensity = 0)

Extract all the feature lines on the SPoly.

Parameters
smoothingIntensity(number) Between 0 and 1, this parameter allows to limit smoothing intensity (0 = no smoothing)
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.SetMultiTbl(Array<SSetMultiline>) A table of SSetMultiline containing successively the convex (item 0) and concave lines (item 1).

◆ ExtractLine()

Object SPoly::ExtractLine ( SPoint  seedPoint,
number  tolerance,
LineEnum  force = SPoly.LINE_FORCE_NOTHING,
SPoint  passingPoint = SPoint(),
SVector  directionVector = SVector() 
)

Extract the line on the current polyhedron, starting from seed point(s).

Parameters
seedPoint(SPoint) Seed point around which the line should be extracted.
tolerance(number) Extract only the region that is inside the tolerance, that is: only the vertices whose distance with the ideal line is less than this threshold.
force(LineEnum) Enum to know which parameter(s) are forced and do not need to be computed.
passingPoint(SPoint) A passing point of the line
directionVector(SVector) The normed direction of the line.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Line(SLine) The resulting extracted SLine.
ret.StdDeviation(number) The standard deviation.
ret.DistWorstPt(number) The distance of the worst point to the best line found.

◆ ExtractPlane()

Object SPoly::ExtractPlane ( SPoint  seedPoint,
number  tolerance 
)

Extract the planar region on the current SPoly starting from a seed point.

Parameters
seedPoint(SPoint) The seed point around which the planar region should be extracted.
tolerance(number) The tolerance used for extraction. Extract only the region that is inside the tolerance. That is to say: only the vertices whose distance with the ideal plane is less than this threshold.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Plane(SPlane) The resulting extracted SPlane
ret.StdDeviation(number) The standard deviation

◆ ExtractSphere()

Object SPoly::ExtractSphere ( Array< SPoint seedPoint,
number  tolerance,
SphereEnum  force = SPoly.SPHERE_FORCE_NOTHING,
SPoint  center = null,
number  radius = 0 
)

Extract the spherical region on the current SPoly starting from seed points.

Parameters
seedPoint(Array<SPoint>) Seed points around which the spherical region should be extracted.
tolerance(number) The tolerance used for extraction. Extract only the region that is inside the tolerance. That is to say: only the vertices whose distance with the ideal sphere is less than this threshold.
force(SphereEnum) Option to know which parameter(s) is forced
center(SPoint) The center of the sphere to force
radius(number) Radius of the sphere to force
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Sphere(SSphere) The resulting best SSphere
ret.StdDeviation(number) The standard deviation

◆ Extrusion()

static Object SPoly::Extrusion ( SMultiline  profile,
SMultiline  path,
boolean  turnWithPath = true,
boolean  perpendicularToPath = true,
SMultiline  secondPath = null,
RotateEnum  option = SPoly.ROTATE_AUTO,
SPoint  rotatePt = null 
)
static

Create a mesh from a path and a profile, the profile is extracted along the path.

Deprecated:
This function is deprecated. Use ProfileAlongPath() instead.
Parameters
profile(SMultiline) The SMutliline that defines the profile. It can be closed or not.
path(SMultiline) The SMutliline that defines the path to follow.
turnWithPath(boolean) If true, the profile turns with the path
perpendicularToPath(boolean) If true, the profile will be computed perpendicular to the path
secondPath(SMultiline) The second path to follow, profile orientation will be attracted by this second path This option is not compatible with "turnWithPath = false"
option(RotateEnum) How the extrusion rotate point is computed?
rotatePt(SPoint) The profile rotate point (if option set to ROTATE_USER_DEFINE). Take a look on the picture below
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The extruded SPoly.

◆ FillContours()

Object SPoly::FillContours ( Array< SMultiline contourTable,
number  tension = 0.732,
number  wallThickness = -1,
boolean  isForceNonSmoothShape = false 
)

3D Hole filling. Create triangles on the edges of the holes to fill the concave parts.

Note
If the holes are small enough, the holes are completely filled.
Parameters
contourTable(Array<SMultiline>) The table of contours to process
tension(number) The tension of the surface to generate
  • 0: Do not add new vertices. Make surface as flat as possible.
  • 0.001: Add new points. Make surface as flat as possible without continuity with the borders
  • <0.732: A concave part will be generated in the middle of the surface
  • >0.732: A convex part is generated in the middle of the surface
  • 1: Portion of sphere if the angle between departure and arrival direction is <= PI. By default curvature filling should be done with this value.
  • <2: If angle between departure and arrival direction is > PI the surface is getting a sphere as well
  • 2: Nearly a portion of sphere for whichever the angle is.
  • >2: The surface is getting acute and sharp.
wallThickness(number) The wall thickness to allow better filling of horseshoe holes going on two sides of a wall; -1 if no wall thickness.
isForceNonSmoothShape(boolean) Fill unconditionally even if the shape is not smooth and there is a risk to create an absurd shape
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.MultiTbl(Array<SMultiline>) A table of contours not filled (empty if no error).

◆ FillHoles()

Object SPoly::FillHoles ( Array< SPoint pointTable,
number  tension = 0,
number  wallThickness = -1 
)

3D Hole filling. Create triangles on the edges of the holes to fill the concave parts. The contours to be treated are selected with a point on the contour.

Note
If the holes are small enough, the holes are completely filled. If the holes are too big the effect is to smooth the edges.
Warning
Given seed points must be on contour vertices.
See also
SPoly.FillHolesDirection() for 2D1/2 filling
Parameters
pointTable(Array<SPoint>) A table of points to identify each contour to process
tension(number) The tension of the surface to generate
  • 0: Do not add new vertices. Make surface as flat as possible.
  • 0.001: Add new points. Make surface as flat as possible without continuity with the borders
  • <0.732: A concave part will be generated in the middle of the surface
  • >0.732: A convex part is generated in the middle of the surface
  • 1: Portion of sphere if the angle between departure and arrival direction is <= PI. By default curvature filling should be done with this value.
  • <2: If angle between departure and arrival direction is > PI the surface is getting a sphere as well
  • 2: Nearly a portion of sphere for whichever the angle is.
  • >2: The surface is getting acute and sharp.
wallThickness(number) The wall thickness to allow better filling of horseshoe holes going on two sides of a wall; -1 if no wall thickness.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ FillHolesDirection()

Object SPoly::FillHolesDirection ( SVector  direction,
Array< SPoint pointTable,
number  tension = 0 
)

Fill the holes that have at least one point listed in the table of points.

Note
These functions implement 2D1/2 filling, and then, the complete contour must be visible from the direction without auto-intersection. Otherwise the call will fail.
See also
SPoly.FillHoles() for 3D filling
Parameters
direction(SVector) Direction defining the view of the hole. If null, the direction will be approximated.
pointTable(Array<SPoint>) A table of points to identify one of the points of each hole to fill. If empty, all the holes are treated.
tension(number) Tension of the surface to generate in the case of complete hole filling
  • <0: Reverse the curvature in the middle of the hole
  • 0: Do not add new vertices. Make surface as flat as possible.
  • 0.001: Add new points. Make surface as flat as possible without continuity with the borders
  • <0.732: A concave part will be generated in the middle of the surface
  • >0.732: A convex part is generated in the middle of the surface
  • 1: Portion of sphere if the angle between departure and arrival direction is <= PI. By default curvature filling should be done with this value.
  • <2: If angle between departure and arrival direction is > PI the surface is getting a sphere as well
  • 2: Nearly a portion of sphere for whichever the angle is.
  • >2: The surface is getting acute and sharp.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ FromClick()

static Object SPoly::FromClick ( )
static

Launch an interaction to select a SPoly 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 SPoly is selected.
  • 1: Nothing is selected.
  • 2: The ESCape key has been pressed
ret.Poly(SPoly) The selected SPoly

◆ FromFile()

static Object SPoly::FromFile ( string  fileName)
static

Import a mesh, and create a new SPoly from a file.

Note
File extension authorized: .stl, .off, .msh, .ply, .obj, .poly, .pbi, .msd, .glb, .gltf
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.PolyTbl(Array<SPoly>) The loaded SPoly array

◆ FromName()

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

Search all the SPoly with the given name.

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

◆ FromSel()

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

Get all the selected SPoly.

Returns
(Array<SPoly>) All the selected SPoly

◆ Fusion()

static Object SPoly::Fusion ( Array< SPoly polyTable,
FusionOptionEnum  option,
number  accuracyPoint = 1e-05,
number  accuracyBorders = 0.001 
)
static

Sew common edges of a SPoly list, or rebuild topology of existing SPoly.

Note
This function can also be called to recreate the topology of a unique SPoly.
This function is designed to detect and merge SPoly having common borders. If no common free edges exist, or if the free borders are not detected as "common" because the tolerance value is too low, you will get several independent pieces inside the result table. If your goal is to obtain one single mesh from 2 overlapping meshes, you should Stitch instead.
See also
SPoly.Explode(), SPoly.MergeCommonBorders()
Parameters
polyTable(Array<SPoly>) The SPoly table to fusion.
option(FusionOptionEnum) Option for the fusion.
accuracyPoint(number) Accuracy between vertices (distance under which two points are considered identical); Most often 1.E-5
accuracyBorders(number) Accuracy between parallel borders (distance under which two free borders are sewed)
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) The resulting fused SPoly table.

◆ GetColorGradient()

Object SPoly::GetColorGradient ( )

Get the color gradient of the SPoly.

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

◆ GetContours()

Object SPoly::GetContours ( )

Extract free contour(s) from the current SPoly.

Returns a table of SMultilines containing all the free edges of a SPoly.

Return values
ret.ErrorCode(number) The error code
  • 0: No error.
  • 1: An error occurred.
  • 2: The mesh doesn't have any free contour.
ret.MultiTbl(Array<SMultiline>) A table of Multiline sorted by size (number of points) biggest first; smallest end.Or an empty table if there is no hole and (or) free contour (closed surface).

◆ GetHighestPoint()

Object SPoly::GetHighestPoint ( SVector  direction)

Get the highest point according to the given direction.

Parameters
direction(SVector) The direction in which the highest point must be found.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Point(SPoint) The highest SPoint found.

◆ GetInertiaMatrix()

Object SPoly::GetInertiaMatrix ( boolean  doStopIfClosed = true)

Compute the solid's inertia matrix.

Note
If you multiply a point by the resulting matrix, you get a point in the local coordinate system of the solid. The centroid point becomes (0, 0, 0) in this new coordinate system.
See also
SPoly.GetVolume(), SPoly.GetSurface()
Parameters
doStopIfClosed(boolean) Should we stop volume calculation if the surface is not closed? Caution, if false, an approximate result is returned, which may be totally wrong in the case of "big" holes.
Return values
ret.Matrix(SMatrix) The solid's inertia SMatrix
ret.Volume(number) The solid's volume
ret.Point(SPoint) The volume's centroid (center of mass or barycenter). We suppose that we have a uniform mass distribution throughout the volume.

◆ GetLowestPoint()

Object SPoly::GetLowestPoint ( SVector  direction)

Get the lowest point according to the given direction.

Parameters
direction(SVector) The direction in which the lowest point must be found.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Point(SPoint) The lowest SPoint found.

◆ GetNbPieces()

number SPoly::GetNbPieces ( )

Return the number of independent pieces inside the SPoly.

Returns
(number) The number of independent pieces.

◆ GetSilhouette()

Object SPoly::GetSilhouette ( SVector  viewDirection,
number  draftAngle,
number  minClosedLine,
number  minUnclosedLine,
number  resultType 
)

Compute the silhouette or external contour of a SPoly according to a direction and possibly a draft angle.

Parameters
viewDirection(SVector) The view direction.
draftAngle(number) The draft angle in radian. If zero, the contour seen is output.
minClosedLine(number) Delete closed lines whose number of segment is less than this value.
minUnclosedLine(number) Delete unclosed lines whose number of segment is less than this value.
resultType(number) Choose the result type.
  • 0: Projected 2D result. Only available if draftAngle is null
  • 1: Recompute 3D result to have the external contour without auto-intersection in the view direction.
  • 2: Exact 3D result
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.MultiTbl(Array<SMultiline>) A table of SMultiline with the silhouette, external contour of the SPoly.

◆ GetSurface()

Object SPoly::GetSurface ( )

Retrieve the SPoly's surface.

See also
SPoly.GetVolume(), SPoly.GetInertiaMatrix()
Return values
ret.Surface(number) The SPoly's surface
ret.Point(SPoint) The volume's centroid (center of mass or barycenter). We suppose that we have a uniform mass distribution throughout the volume.

◆ GetTriangleSize()

Object SPoly::GetTriangleSize ( )

Retrieve the triangle size of current SPoly.

Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Minimum(number) The minimum triangle size.
ret.Maximum(number) The maximum triangle size.

◆ GetTrianglesNumber()

number SPoly::GetTrianglesNumber ( )

Get the number of triangles of the SPoly.

Returns
(number) The number of triangles.

◆ GetVolume()

Object SPoly::GetVolume ( boolean  isOnlyIfClosed = true)

Retrieve the SPoly's volume.

See also
SPoly.GetSurface(), SPoly.GetInertiaMatrix(), SPoly.Cubature()
Parameters
isOnlyIfClosed(boolean) Should we stop volume calculation if the surface is not closed? Caution: if false, an approximate volume is returned, which may be totally wrong in the case of 'big' holes
Return values
ret.Volume(number) The SPoly's volume:
  • >0: The normal is oriented outside
  • =0: The SPoly is not closed (if isOnlyIfClosed is true)
  • <0: The normal is oriented inside.
ret.Point(SPoint) The volume's centroid (center of mass or barycenter). We suppose that we have a uniform mass distribution throughout the volume.

◆ InterInfLine()

Object SPoly::InterInfLine ( SPoint  point,
SVector  vect 
)

Compute the intersection with an infinite line.

See also
SPoly.Proj3D(), SPoly.ProjDir()
Parameters
point(SPoint) A point on the infinite line
vect(SVector) The normalized vector of the infinite line direction
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PointTbl(Array<SPoint>) The table in which will be stored the created SPoint

◆ Intersect()

Object SPoly::Intersect ( SPoly  poly,
number  option 
)

Make an intersection between two objects (the current object and a given parameter).

Note
If you use this function repetitively with one immobile object and one mobile object (an object on which you use SPoly.Translate()), the execution will be faster if you enter the immobile object as parameter and keep the mobile object as current one because you will save the time for optimized structure creation on mobile object at each loop.
See also
SPoly::BooleanOperation()
Parameters
poly(SPoly) The second SPoly.
option(number) Do we include tangent contacts?
  • 0: No
  • 1: Yes
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.MultiTbl(Array<SMultiline>) A table with all intersection SMultilines.

◆ JoinContour()

static Object SPoly::JoinContour ( Array< SMultiline multiLines,
Array< SPoly polyhedrons,
number  tangency1 = 0,
number  tangency2 = 0,
number  tension = 0.732,
boolean  reorganize = false,
number  nbPoint = 0 
)
static

Create a meshed surface from two contours or mesh holes, which optionally preserves tangency continuity.

Parameters
multiLines(Array<SMultiline>) The two SMultilines defining the 2 contours to join.
polyhedrons(Array<SPoly>) The two SPoly which can be used to preserve tangency The length of this table can be 0 if no tangency with a SPoly must be set. The length of this table can be 1 if only the first SMultiline should preserve tangency with this SPoly. The length of this table can be 2 if both SMultiline should preserve tangency
tangency1(number) Tangency option for the first multiline - NOT USED IF THE POLYHEDRON IS DEFINED (length of polyhedrons>=1)
  • 0: No tangency continuity
  • 1: Tangent to the best plane of multiLines[0] INSIDE (ONLY AVAILABLE WITH CLOSED POLYLINES).
  • 2: Tangent to the best plane of multiLines[0] OUTSIDE (ONLY AVAILABLE WITH CLOSED POLYLINES).
  • 3: Tangent perpendicular to the best plane of multiLines[0].
tangency2(number) Tangency option for the second multiline - NOT USED IF THE POLYHEDRON IS DEFINED (length of polyhedrons==2)
  • 0: No tangency continuity
  • 1: Tangent to the best plane of multiLines[1] INSIDE (ONLY AVAILABLE WITH CLOSED POLYLINES).
  • 2: Tangent to the best plane of multiLines[1] OUTSIDE (ONLY AVAILABLE WITH CLOSED POLYLINES).
  • 3: Tangent perpendicular to the best plane of multiLines[1].
tension(number) The tension of the junction to generate. This parameter must be greater than zero. A good value is between 0.732 and 1. The more this value is high, the more the junction become acute and sharp.
reorganize(boolean) Should the mesh be reorganized to follow the local curvature?
nbPoint(number) The number of points in the direction perpendicular to contours or holes.
  • <4: The number of points is automatically computed
  • >=4: Take a fixed number of points.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The resulting SPoly

◆ LinearExtrusion()

static Object SPoly::LinearExtrusion ( number  length,
SVector  direction,
boolean  closeExtremities,
Array< SComp comps 
)
static

Compute poly(s) corresponding to the extrusion of profile(s) (SMultiline, linear SFeature, linear SShape object) along a direction, with a given length.

Parameters
length(number) The length of the extrusion.
direction(SVector) The direction of the extrusion.
closeExtremities(boolean) True if extremities of the extruded SComp have to be closed.
comps(Array<SComp>) All the profiles to extrude.
Return values
ret.ErrorCode(number) The generated error code:
  • 0: No error.
  • 1: An error occurred.
  • 2: Invalid input parameters (either the direction or length are invalid, or none of the components in comps can be used as a valid profile).
ret.CompTbl(Array<SComp>) Extruded SComp.

◆ LoadColorGradient()

Object SPoly::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: No error
  • 1: No color gradient associated to this SPoly
  • 2: An error occurred
ret.Gradient(SColorGradient) The color gradient associated to the current SPoly

◆ LocalizeValues()

Object SPoly::LocalizeValues ( Array< number >  thresholdList)

Extract the points or the lines at threshold values of an inspected mesh.

var polyTbl = SPoly.FromSel();
var poly = polyTbl[0];
var gradient = poly.GetColorGradient().Gradient;
var min = gradient.GetRange().Min;
var max = gradient.GetRange().Max;
//var ret = poly.LocalizeValues([min,max]);
var ret = poly.LocalizeValues([0.1,0.3]);
if( ret.ErrorCode != 0)
throw new Error('Failed to get extremum values');
ret.Results.forEach(function(curResult)
{
curResult.Comp.AddToDoc();
curResult.Label.AddToDoc();
print('Threshold='+curResult.Threshold);
print('Surface='+curResult.Surface);
}
);
Provide triangular mesh edition and creation methods.
Definition: Reshaper.h:6411
static Array< SPoly > FromSel()
Get all the selected SPoly.
Parameters
thresholdList(Array<number>) The list of thresholds to extract
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: The mesh is not inspected
  • 2: An error occurred
ret.Results(Array<Object>) A table of result. Each result is a structure with the following members:

◆ MergeCommonBorders()

static Object SPoly::MergeCommonBorders ( Array< SPoly polyTable,
FusionOptionEnum  option,
number  accuracyPoint = 1e-05,
number  accuracyBorders = 0.001 
)
static

Sew common edges of a SPoly list, or rebuild topology of existing SPoly.

Note
This function can also be called to recreate the topology of a unique SPoly.
This function is designed to detect and merge SPoly having common borders. If no common free edges exist, or if the free borders are not detected as "common" because the tolerance value is too low, you will get several independent pieces inside the result table. If your goal is to obtain one single mesh from 2 overlapping meshes, you should Stitch instead.
See also
SPoly.Explode(), SPoly.Fusion()
Parameters
polyTable(Array<SPoly>) The SPoly table to fusion.
option(FusionOptionEnum) Option for the fusion.
accuracyPoint(number) Accuracy between vertices (distance under which two points are considered identical); Most often 1.E-5
accuracyBorders(number) Accuracy between parallel borders (distance under which two free borders are sewed)
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolyTbl(Array<SPoly>) The resulting fused SPoly table.

◆ MeshSegmentation()

Object SPoly::MeshSegmentation ( number  angleThreshold = 15,
number  mergeMaxDistance = 0,
number  minRegionArea = 0,
number  classificationMaxDistance = 0,
SegmentationFeaturesEnum  featuresOption = SPoly.SEGMENTATION_All 
)

Segment a mesh in several regions matching with geometric features (SPlane, SSphere, SCylinder and SCone). The algorithm relies on region growing mechanism and works in two steps:
1 - Create small regions from triangles sharing almost the same normals (according to angleThreshold).
2 - Merge similar regions sharing geometric properties.

Parameters
angleThreshold(number) The angle threshold in degree used during the region creation step
mergeMaxDistance(number) The maximum distance threshold used during the merging step. If this parameter is non-positive, the value will correspond to 5% of the largest object dimension.
minRegionArea(number) The minimum area of regions to keep in the output. If 0, nothing will be removed.
classificationMaxDistance(number) The maximum distance authorized to fit feature during classification. If negative, no classification will be performed.
featuresOption(SegmentationFeaturesEnum) Option to tell which features must be extracted.
Return values
ret.ErrorCode(number) The error code:
  • 0: No error
  • 1: An error occurred while running the segmentation.
  • 2: An error occurred while splitting the mesh into segmented parts.
  • 3: An exception occurred.
  • 4: Invalid featuresOption parameter.
ret.PlaneTbl(Array<SPlane>) An array of all the SPlane detected in the Poly
ret.SphereTbl(Array<SSphere>) An array of all the SSphere detected in the Poly
ret.CylinderTbl(Array<SCylinder>) An array of all the SCylinder detected in the Poly
ret.ConeTbl(Array<SCone>) An array of all the SCone detected in the Poly
ret.PlanePolyTbl(Array<SPoly>) An array of all the independent SPoly detected as planes in the SPoly (same length as PlaneTbl)
ret.SpherePolyTbl(Array<SPoly>) An array of all the independent SPoly detected spheres as in the SPoly (same length as SphereTbl)
ret.CylinderPolyTbl(Array<SPoly>) An array of all the independent SPoly detected as cylinders in the SPoly (same length as CylinderTbl)
ret.ConePolyTbl(Array<SPoly>) An array of all the independent SPoly detected as cones in the SPoly (same length as ConeTbl)
ret.UndefinedPolyTbl(Array<SPoly>) An array of all the independent SPoly that are not detected as an independent geometrical shape

◆ New() [1/2]

static SPoly SPoly::New ( )
static

Default constructor to create an empty new SPoly.

Returns
(SPoly) The new SPoly.

◆ New() [2/2]

static SPoly SPoly::New ( SPoly  other)
static

Constructs a SPoly by copying the SPoly other.

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

◆ Offset()

Object SPoly::Offset ( boolean  isDirect,
number  distCoef,
OffsetEnum  option = SPoly.NORMAL_OFFSET 
)

Compute and return a new parallel SPoly.

Note
This function can be used to make a constant parallel SPoly. For example to add a thickness to a mesh of a part.
Parameters
isDirect(boolean) Should we offset in the direction of the normal?
distCoef(number) The distance or coefficient to apply
option(OffsetEnum) How to manage auto-intersections?
CAUTION: This option is designed to treat continuous shapes (C1 surfaces). The treatment of surfaces with many sharp edges will not work correctly.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The new parallel (or deformed) SPoly.

◆ PipeTubeAlongPath()

static Object SPoly::PipeTubeAlongPath ( number  radius,
boolean  closeExtremities,
Array< SComp comps 
)
static

Compute SPoly corresponding to the extrusion of a circle with a given radius along a given path.

Parameters
radius(number) The radius of the circle to extrude.
closeExtremities(boolean) True if extremities of the extruded SPoly have to be closed.
comps(Array<SComp>) All the paths to follow.
Return values
ret.ErrorCode(number) The error code
  • 0: No error.
  • 1: An error occurred.
  • 2: Invalid input parameters (either the radius is invalid, or none of the components in comps can be used as a valid extrusion path).
ret.CompTbl(Array<SComp>) The extruded SPoly.

◆ ProfileAlongPath() [1/2]

static Object SPoly::ProfileAlongPath ( SComp  profile,
SComp  path,
boolean  makePerpendicular,
boolean  turnWthCurve,
boolean  usePathToLeanOn,
boolean  startAtProfilePosition,
boolean  closeExtremities,
SComp  pathToLeanOn 
)
static

Compute the SPoly corresponding to the extrusion of a given profile along a given path.

Deprecated:
This function is deprecated. Use the other ProfileAlongPath() instead.
Parameters
profile(SComp) The profile to extrude
path(SComp) The extrusion path
makePerpendicular(boolean) true if the profile to extrude has to be perpendicular to the first vector of the path
turnWthCurve(boolean) true if the shape has to be oriented according to the curve all along the path
usePathToLeanOn(boolean) true if a 2nd path -pathToLeanOn- has to be used to determine the profile orientation
startAtProfilePosition(boolean) true if the extrusion has to begin at profile and not at path position
closeExtremities(boolean) true if extremities of the extruded SPoly have to be closed
pathToLeanOn(SComp) The path to lean on, used only if iUsePathToLeanOn is true
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: Bad profile or path type
  • 2: Bad pathToLeanOn type
  • 3: Computation error
ret.Comp(SComp) The extruded SPoly

◆ ProfileAlongPath() [2/2]

static Object SPoly::ProfileAlongPath ( SComp  profile,
SComp  path,
boolean  turnWthPath,
SPoint  profileBasePoint,
SComp  leanPath,
SPoint  profileLeanPoint,
boolean  closeExtremities 
)
static

Compute the SPoly corresponding to the extrusion of a given profile along a given path.

Parameters
profile(SComp) The profile to extrude
path(SComp) The extrusion path
turnWthPath(boolean) true if the shape has to be oriented according to the curve all along the path
profileBasePoint(SPoint) Point on the profile that will follow the path
leanPath(SComp) The path to lean on
profileLeanPoint(SPoint) Point of the profile that will be attracted by the lean path
closeExtremities(boolean) true if the extremities of the extruded SPoly have to be closed
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: Bad profile type
  • 2: Bad path type
  • 3: Bad lean path type
  • 4: Computation error
ret.Poly(SPoly) The extruded SPoly

◆ Proj3D() [1/2]

Object SPoly::Proj3D ( SMultiline  multilineToProject,
boolean  addIntermediatePt = true 
)

Compute the 3D projection of a SMultiline on a SPoly.

See also
SPoly.ProjDir()
Parameters
multilineToProject(SMultiline) The SMultiline to project.
addIntermediatePt(boolean) Should we add intermediate points? If true, intermediate points are added every time the line crosses a triangle edge.
Return values
ret.ErrorCode(number) The error code
  • 0: No error.
  • 1: At least one point or segment could not be projected and is missing (segment may be splited).
  • 2: An error occurred.
ret.MultiTbl(Array<SMultiline>) Several disconnected pieces can be found during the projection of a SMultiline on a SPoly. It is the reason why the result(s) is returned inside a table.

◆ Proj3D() [2/2]

Object SPoly::Proj3D ( SPoint  point)

Compute the 3D projection of a SPoint on a SPoly.
This function always returns the nearest point.

See also
SPoly.InterInfLine(), SPoly.ProjDir()
Parameters
point(SPoint) The point to project.
Return values
ret.ErrorCode(number) The error code
  • 0: No error.
  • 1: No projection found.
  • 2: An error occurred.
ret.Point(SPoint) The projected SPoint.

◆ ProjDir() [1/2]

Object SPoly::ProjDir ( SMultiline  multilineToProject,
SVector  direction,
boolean  addIntermediatePt = true,
boolean  isSignedProjection = false 
)

Compute the projection of a SMultiline on a SPoly with a direction.

Note
If more than one point is found the nearest point from the origin of the vector is output.
See also
SPoly.Proj3D
Parameters
multilineToProject(SMultiline) The multiline to project.
direction(SVector) The projection direction
addIntermediatePt(boolean) Should we add intermediate points? If true, intermediate points are added every time the line crosses a triangle edge.
isSignedProjection(boolean) Should we search only in front of each point of current SMultiline? If false, research is made in both directions.
Return values
ret.ErrorCode(number) The error code
  • 0: No error.
  • 1: At least one point or segment could not be projected and is missing (segment may be splitted).
  • 2: An error occurred.
ret.MultiTbl(Array<SMultiline>) Several disconnected pieces can be found during the projection of a SMultiline on a SPoly. It is the reason why the result(s) is returned inside a table.

◆ ProjDir() [2/2]

Object SPoly::ProjDir ( SPoint  point,
SVector  direction,
boolean  isSignedProjection = false 
)

Compute the projection of a SPoint on a SPoly with a direction.
The point to project is considered as the origin of the direction.

See also
SPoly.InterInfLine(), SPoly.Proj3D
Parameters
point(SPoint) The point to project.
direction(SVector) The projection direction
isSignedProjection(boolean) Should we search only in front of each point of current SPoint? If false, research is made in both directions.
Return values
ret.ErrorCode(number) The error code
  • 0: No error.
  • 1: No projection found.
  • 2: An error occurred.
ret.Point(SPoint) The projected SPoint.

◆ Reduce()

Object SPoly::Reduce ( number  targetNbVertex,
number  minAngle 
)

Reduce a mesh according to the angle between facets to minimize the visual degradation.

Parameters
targetNbVertex(number) The number of vertices to keep inside the SPoly.
minAngle(number) The angle of the thinest triangle authorized to be created. This angle is in degrees.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.NbVert(number) The number of suppressed vertices.

◆ ReduceDeviation()

Object SPoly::ReduceDeviation ( number  deviationError,
DeviationOptionEnum  criteria,
boolean  isSharpEdgeKept = false,
number  deviationOnSharpEdges = 0,
number  sharpEdgeAngleValue = 0,
number  maxEdgeLength = 0,
number  deviationOnBorders = 0 
)

Reduce the SPoly by deleting some vertices and triangles according to a deviation error.

See also
SPoly.Reduce()
Parameters
deviationError(number) The maximum deviation error. All vertices of the SPoly before the reduction must have a distance lower than this value with the mesh after reduction.
criteria(DeviationOptionEnum) The Reduction options
  • SPoly.KEEP_EQUI: Re-mesh locally to preserve equilateral triangles if it is possible.
  • SPoly.BEST_POS: Allow to move the point to another position in order to keep the mesh aspect (create new vertices).
  • SPoly.ON_BORDERS: Allow to also reduce the free borders (will reduce free borders size and can result in filling some small holes).
isSharpEdgeKept(boolean) If false there is no restriction on sharp edges. Else if true deviationOnSharpEdges and sharpEdgeAngleValue must be defined
deviationOnSharpEdges(number) If isSharpEdgeKept = true, define a deviation value authorized on sharp edges. All vertices on sharp edge of the mesh before the reduction must have a distance lower than this value with the mesh after reduction. If 0, it means that moving/removing points on sharp edge is NOT allowed
sharpEdgeAngleValue(number) if isSharpEdgeKept = true, define an angle in degrees between two neighbor triangles to consider that we are on a sharp edge.
maxEdgeLength(number) The maximum length of edges. If 0, there is no control on the length of edges
deviationOnBorders(number) If ON_BORDERS option is used, define a deviation value authorized on borders. If 0, use the deviation error.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ RemeshRefineDev()

Object SPoly::RemeshRefineDev ( number  deviation,
number  sizeMin,
number  maxiTriNumber,
BordersEnum  borderOption,
number  distanceWrongPoints,
number  reorganize,
SCloud  cloud = null,
number  maxCosAngle = -1 
)

Refine an existing SPoly with deviation error and optionally better fitting on a SCloud.

Note
The main difference between SPoly.Tolerance3DMesh() and SPoly.RemeshRefineDev() are:
Tolerance3DMesh takes directly some points of the cloud. If the noise reduction is activated the function will try to take points in the middle of the noise thickness, if any. However, if no point is present in the middle of the noise thickness, it may result a very noisy shape.
RemeshRefineDev takes some new points with the deviation error criterion, which do not exist in the cloud. These points are placed in the middle of the noise thickness even if there is no corresponding point inside your cloud.

If your point cloud is very noisy and dense, you should obtain a better result with RemeshRefineDev. If your point cloud is very accurate or sparse, you should obtain a better result with Tolerance3DMesh.
Parameters
deviation(number) The tolerance to respect (deviation error)
sizeMin(number) The minimum size of triangles. It is not authorized to create new triangles with a size below this value.
maxiTriNumber(number) The maximum number of triangle in the SPoly to return. Note that the input SPoly is not reduced if its number of triangles is already bigger when calling this function.
borderOption(BordersEnum) What should be done with free borders?
  • NO_CHANGE: Don't change free edges (borders)
  • REFINE: Refine free edges.
  • EXTEND_REFINE: Extend (if some points of the cloud are outside free borders) and refine free edges. The extension value is DistanceWrongPoints, if not zero or the average triangle size of the current SPoly.
distanceWrongPoints(number) If a point of the cloud has a distance to the SPoly over this value, it is considered as wrong (aberrant) and the point is rejected. If this value is zero, taking a default value, which is the average triangle size of the current SPoly.
reorganize(number) The option bit mask.
  • bit 0 (0x01): Should we try to reorganize so that sharp edges and small radii are better fitted?
  • bit 1 (0x02): should we avoid smoothing operation at the end of the process.
cloud(SCloud) The cloud of points, which should be fitted on the new mesh or 0 if none
maxCosAngle(number) The max cosine value for the angle between the triangle and the scanning direction. If 0 <= 'maxCosAngle' < 1 AND if 'cloud' has scanning direction information, then the triangles are attracted only by points whose scanning direction makes an angle with triangle's normal lower than this value. This parameter is useful when you try to refine a very thin piece. In such case, you don't want the triangles to be attracted by the other side of the piece. If maxCosAngle is set to -1 no selection is made and thus the scanning directions are effectively ignored. A good value to avoid meshing the other side is 0.1 (~85 degrees).
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The resulting refined mesh

◆ RemeshSharpEdge()

Object SPoly::RemeshSharpEdge ( Array< SMultiline lines,
SPoint  referencePoint 
)

Modify locally the existing mesh to recreate sharp edge(s)

Parameters
lines(Array<SMultiline>) The table of SMultiline representing the sharp edges(s) to recreate.
referencePoint(SPoint) The reference point which indicates the part of the SPoly, whose distance is lower than this value, is authorized to move.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The resulting mesh.

◆ RemoveSpikes()

Object SPoly::RemoveSpikes ( number  loopNumber = 1,
number  propag = -1,
number  intensity = 1,
boolean  isRecomputeBorder = true 
)

Suppress or correct absurd points (i.e. spikes) of the current SPoly.

Parameters
loopNumber(number) Number of loops (iteration of the treatment)
propag(number) Neighbor level propagation of the treatment.
-1 or negative value mean no limit. This functionality allows to detect a point that becomes spike after having suppressed his neighbor.
intensity(number) The suppression criterion.
  • 0: Suppress non manifold vertices only.
  • 1: Low suppression: only very wrong points are suppressed.
  • 2: Middle suppression
  • 3: High suppression: a lot of points are suppressed even if they are not very wrong.
isRecomputeBorder(boolean) Allow to also modify free borders
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.NbVert(number) The number of suppressed vertices.

◆ RemoveTrianglesOnHoles()

Object SPoly::RemoveTrianglesOnHoles ( SCloud  cloud,
number  holeSize,
number  maxDistToCloud = -1,
number  maxAngle = -1 
)

Remove triangles which are considered to be over a hole of a certain diameter regarding 'cloud'.

Parameters
cloud(SCloud) The cloud with the corresponding points
holeSize(number) The minimal size of a hole (diameter)
maxDistToCloud(number) If positive, keep triangles if at least one point of the cloud can be projected inside the triangle.
Point to project must be closer than this distance.
maxAngle(number) If positive, the max angle value (in degree) between the triangle and the scanning direction. For each triangle it looks only for points with compatible scanning direction. This parameter is useful when you try to refine a very thin piece. In such case, you don't want the triangles to be attracted by the other side of the piece. A good value to avoid meshing the other side is 85 degree.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ Save()

Object SPoly::Save ( string  filePath,
boolean  isTextExport = false,
SMatrix  coordinateSystemMatrix = SMatrix() 
)

Save the mesh into a file.

Note
Supported extensions :
.stl: STL (binary or text format)
.pbi: Binary PBI
.poly: Ascii POLY
.obj: OBJ
.stp: STEP
.msh: Ascii Leica format
.ply: PLY (binary or text format)
.msd: MSD
.glb: GLB
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
isTextExport(boolean) Should the mesh be exported as text or binary data?
  • true: Text
  • false: Binary
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 SPoly::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: No error
  • 1: No color gradient associated to this SPoly
  • 2: An error occurred

◆ SaveFBX()

static number SPoly::SaveFBX ( string  filePath,
Array< SPoly meshesToExport,
boolean  isExportTexture = false,
EExportVertexColor  exportVertexColor = SPoly.EXPORT_FBX_NO_COLOR,
SMatrix  coordinateSystemMatrix = SMatrix() 
)
static

Save the SPoly(s) into a FBX 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
meshesToExport(Array<SPoly>) The list of SPoly(s) to export
isExportTexture(boolean) Should the texture be exported?
exportVertexColor(EExportVertexColor) The color information to export
coordinateSystemMatrix(SMatrix) The matrix to define a UCS used for the export (or identity to use the WCS)
Returns
The error code
Return values
0No error
1An error occurred
2Some of the exported meshes don't have the chosen texture or color information.

◆ ScanToMesh() [1/4]

static Object SPoly::ScanToMesh ( SCloud  cloud,
number  boxSize,
number  averagePointDistance,
number  minTriangleSize,
number  texturePixelSize = 0.01,
boolean  ignoreScanDir = false 
)
static

Compute a SPoly from a scanned data by specifying meshing parameters.

Note
This function takes into account up to one active limit object.
See also
SPoly.Direct3DMesh()
Parameters
cloud(SCloud) The SCloud to compute.
boxSize(number) The size of boxes used to mesh the cloud.
averagePointDistance(number) The average distance between points.
minTriangleSize(number) The minimum size of the triangles in the SPoly.
texturePixelSize(number) The pixel resolution to create a textured SPoly. (Use 0 to not texture)
ignoreScanDir(boolean) If true, ignore the scanning directions for computation.
Return values
ret.ErrorCode(number) The error code:
  • 0: No error.
  • 1: An exception occurred.
  • 2: Some part(s) failed during meshing.
  • 3: Some part(s) failed during texturing.
  • 4: Global computation failed.
ret.Poly(SPoly) The resulting SPoly.

◆ ScanToMesh() [2/4]

static Object SPoly::ScanToMesh ( SCloud  cloud,
ScannerType  scannerType,
boolean  textureFromCloud,
boolean  ignoreScanDir = false 
)
static

Compute a SPoly from a scanned data by specifying the scanner type.

Note
This function takes into account up to one active limit object.
See also
SPoly.Direct3DMesh()
Parameters
cloud(SCloud) The SCloud to compute.
scannerType(ScannerType) Choose the type of scanner used for the scan.
textureFromCloud(boolean) If true, create a textured SPoly from cloud color.
ignoreScanDir(boolean) If true, ignore the scanning directions for computation.
Return values
ret.ErrorCode(number) The error code:
  • 0: No error.
  • 1: An exception occurred.
  • 2: Some part(s) failed during meshing.
  • 3: Some part(s) failed during texturing.
  • 4: Global computation failed.
ret.Poly(SPoly) The resulting SPoly.

◆ ScanToMesh() [3/4]

static Object SPoly::ScanToMesh ( SCwCloud  cloud,
number  boxSize,
number  averagePointDistance,
number  minTriangleSize,
number  texturePixelSize = 0.01,
boolean  ignoreScanDir = false 
)
static

Compute a SPoly from a scanned data by specifying meshing parameters.

Note
This function takes into account up to one active limit object.
Parameters
cloud(SCwCloud) The SCloud to compute.
boxSize(number) The size of boxes used to mesh the cloud.
averagePointDistance(number) The average distance between points.
minTriangleSize(number) The minimum size of the triangles in the SPoly.
texturePixelSize(number) The pixel resolution to create a textured SPoly. (Use 0 to not texture)
ignoreScanDir(boolean) If true, ignore the scanning directions for computation.
Return values
ret.ErrorCode(number) The error code:
  • 0: No error.
  • 1: An exception occurred.
  • 2: Some part(s) failed during meshing.
  • 3: Some part(s) failed during texturing.
  • 4: Global computation failed.
ret.Poly(SPoly) The resulting SPoly.

◆ ScanToMesh() [4/4]

static Object SPoly::ScanToMesh ( SCwCloud  cloud,
ScannerType  scannerType,
boolean  textureFromCloud,
boolean  ignoreScanDir = false 
)
static

Compute a SPoly from a scanned data by specifying the scanner type.

Note
This function takes into account up to one active limit object.
Parameters
cloud(SCwCloud) The SCwCloud to compute.
scannerType(ScannerType) Choose the type of scanner used for the scan.
textureFromCloud(boolean) If true, create a textured SPoly from cloud color.
ignoreScanDir(boolean) If true, ignore the scanning directions for computation.
Return values
ret.ErrorCode(number) The error code:
  • 0: No error.
  • 1: An exception occurred.
  • 2: Some part(s) failed during meshing.
  • 3: Some part(s) failed during texturing.
  • 4: Global computation failed.
ret.Poly(SPoly) The resulting SPoly.

◆ SectionCylindric()

Object SPoly::SectionCylindric ( SPoint  firstPointOnAxis,
SPoint  secondPointOnAxis,
SPoint  pointOnTheFirstCylinder,
number  numberOfCylinders,
number  distancebetweenCylinders 
)

Compute the intersection of a SPoly with parallel cylinders.

See also
SPoly.SectionPlane(), SPoly.SectionRadial()
Parameters
firstPointOnAxis(SPoint) The first point determining axis
secondPointOnAxis(SPoint) The second point determining axis
pointOnTheFirstCylinder(SPoint) The point on the first cylinder
numberOfCylinders(number) If > 0 the sections are done only in the direction of the vector. If < 0, an infinity of parallel planes is assumed.
distancebetweenCylinders(number) The distance between cylinders.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.MultiTbl(Array<SMultiline>) An Array of SMultiline, cylindrical sections of the SPolyIf no sections are available returns an empty Array

◆ SectionOnMulti()

Object SPoly::SectionOnMulti ( SMultiline  multiLine,
Array< number >  listDist,
number  maxDist,
number  optBitMask = 0 
)

Compute the sections of a SPoly (for example a tube or a tunnel) along a SMultiline (normal to the SMultiline). We take points on the neutral axis which are regularly distributed according to a curvilinear distance.

Parameters
multiLine(SMultiline) The reference SMultiline. The sections will be computed along this SMultiline with perpendicular planes.
listDist(Array<number>) The list of curvilinear distances. In this case, we will compute as many sections as ListDist.length. ListDist contains the list of the offsets from the first point.
maxDist(number) The max distance between the sections and the SMultiline. Zero means no limit. The section parts, which are too far away from the MultiLine are deleted.
optBitMask(number) Bit mask option
  • Bit 0: If 1, do not interpolate the tangents on SMultiline segments (the tangent to a segment will be its direction)
Return values
ret.ErrorCode(number) The error code:
  • 0: No error, the sections could be computed
  • 1: The input distances are either empty or too big: there is no point on the multiline which is at a good distance from the first point.
  • 2: MaxDist is either not strictly positive or too big.
  • 3: The SMultiline is not correct, impossible to compute the normal plane on a point
  • 5: An exception occurred.
ret.SetMultiTbl(Array<SSetMultiline>) The sections computed. A SetMultiline table.

◆ SectionOnMultiReg()

Object SPoly::SectionOnMultiReg ( SMultiline  multiLine,
number  dist,
number  maxDist,
number  optBitMask = 0 
)

Compute the sections of a SPoly (for example a tube or a tunnel) along a SMultiline (normal to the SMultiline). We take a list of curvilinear distances.

Parameters
multiLine(SMultiline) The reference SMultiline. The sections will be computed along this SMultiline with perpendicular planes.
dist(number) the curvilinear and regular distance between two sections.
maxDist(number) The max distance between the sections and the SMultiline. Zero means no limit. The section parts, which are too far away from the SMultiline are deleted.
optBitMask(number) Bit mask option
  • Bit 0: If 1, do not interpolate the tangents on polyline segments (the tangent to a segment will be its direction)
Return values
ret.ErrorCode(number) The error code:
  • 0: No error, the sections could be computed
  • 1: Dist is too big, there's no point on the SMultiline which are at a distance 'dist' from the first point
  • 2: MaxDist is either not strictly positive or too big.
  • 3: The SMultiline is not correct, impossible to compute the normal plane on a point
  • 5: An exception occurred.
ret.SetMultiTbl(Array<SSetMultiline>) The sections computed. A SetMultiline table.

◆ SectionPlane()

Object SPoly::SectionPlane ( SVector  planeNormal,
SPoint  ptFirstPlane,
number  nbPlanes,
number  distance 
)

Compute the intersection between a SPoly and a parallel plane.

See also
SPoly.SectionCylindric(), SPoly.SectionRadial()
Parameters
planeNormal(SVector) The normal vector of the plane
ptFirstPlane(SPoint) A point on the first plane
nbPlanes(number) The number of parallel planes
  • : If > 0 the sections are done only in the vector's direction.
  • : If < 0, an infinity of parallel planes is assumed.
distance(number) The distance between planes
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.MultiTbl(Array<SMultiline>) An Array of SMultiline, planar sections of the SPoly. If no sections are available returns an empty Array

◆ SectionRadial()

Object SPoly::SectionRadial ( SPoint  firstPointOnAxis,
SPoint  secondPointOnAxis,
SPoint  ptFirstPlane,
number  nbSections,
number  maxAngleInRadian 
)

Compute the intersection of a SPoly by radial planes.

See also
SPoly.SectionCylindric(), SPoly.SectionPlane()
Parameters
firstPointOnAxis(SPoint) The first point on the axis
secondPointOnAxis(SPoint) The second point on the axis
ptFirstPlane(SPoint) A point on the first plane or null if indifferent
nbSections(number) The number of sections within the maxAngleInRadian.
maxAngleInRadian(number) The max angle in radian (2*PI means complete circle).
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.MultiTbl(Array<SMultiline>) An Array of SMultiline, radial sections of the SPoly. If no sections are available returns an empty Array

◆ SeparateTriangleBox()

Object SPoly::SeparateTriangleBox ( SPoint  lowerPoint,
SPoint  upperPoint,
SeparateTriBoxEnum  selType,
SeparateTriBoxSelectEnum  whichPartToKeep 
)

Separate triangles of a SPoly according to a box. Depending of whichPartToKeep, the current SPoly is updated and Array.Poly can be fill also (case of SEPARATETRIBOX_KEEP_BOTH).

Parameters
lowerPoint(SPoint) The lower point of the box
upperPoint(SPoint) The upper point of the box
selType(SeparateTriBoxEnum) The option for triangle selection
whichPartToKeep(SeparateTriBoxSelectEnum) The option to know which part has to be kept.
Return values
ret.ErrorCode(number) The error code
  • 0: No error.
  • 1: No triangles have been selected.
  • 2: An error occurred.
ret.Poly(SPoly) The mesh or compound mesh containing the triangles removed by the operation (using SEPARATETRIBOX_KEEP_BOTH).

◆ SeparateTriangleInPrism()

Object SPoly::SeparateTriangleInPrism ( SMultiline  profil,
number  distance,
SeparateTriBoxEnum  selType,
SeparateTriBoxSelectEnum  whichPartToKeep 
)

Separate triangles of a SPoly according to a prism. Depending of iWhichPartToKeep, the current SPoly is updated and Array.Poly can be fill also (case of SEPARATETRIBOX_KEEP_BOTH). The prism is created by a given planar profile and is extruded on both sides using given distance/2.

Parameters
profil(SMultiline) The base SMultiline of the prism (median plane)
distance(number) The distance between the two main faces of the prism
selType(SeparateTriBoxEnum) The option for triangle selection
whichPartToKeep(SeparateTriBoxSelectEnum) The option to know which part has to be kept.
Return values
ret.ErrorCode(number) The error code
  • 0: No error.
  • 1: No triangles have been selected.
  • 2: An error occurred.
ret.Poly(SPoly) The mesh or compound mesh containing the triangles removed by the operation (case of SEPARATETRIBOX_KEEP_BOTH).
ret.TopContour(SMultiline) The SMultiline representing the top contour of the prism computed from given profil.
ret.BottomContour(SMultiline) The SMultiline representing the bottom contour of the prism computed from given profil.
ret.ConvexHull(SMultiline) The SMultiline representing the convex hull contour of the prism computed from given profil for debug purpose.

◆ SeparateTriangleSize()

Object SPoly::SeparateTriangleSize ( number  smallestSize,
number  biggestSize 
)

Separate a SPoly into parts according to the triangle size.

See also
SPoly.GetTriangleSize()
Parameters
smallestSize(number) The minimum size of triangle
biggestSize(number) The maximum size of triangle
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PolySmallTriangle(SPoly) The SPoly or compound SPoly with the small triangles.
ret.Poly(SPoly) The SPoly or compound SPoly without small and big triangles.
ret.PolyBigTriangle(SPoly) The SPoly or compound SPoly with the big triangles.

◆ SeparateTriangleWithActivatedClippingPlanes()

Object SPoly::SeparateTriangleWithActivatedClippingPlanes ( Array< SClippingPlane clippingPlanes,
SeparateTriBoxEnum  selType 
)

Separate triangles of a mesh according to clipping planes. Depending of iWhichPartToKeep, the current SPoly is updated and Array.Poly can be fill also (case of SEPARATETRIBOX_KEEP_BOTH).

Parameters
clippingPlanes(Array<SClippingPlane>) The table of SClippingPlane to use.
selType(SeparateTriBoxEnum) Option for the selection
Return values
ret.ErrorCode(number) The error code
  • 0: No error.
  • 1: No triangles have been selected.
  • 2: An error occurred.
  • 3: No clipping plane was activated so nothing was done
ret.Poly(SPoly) The result mesh with all selected triangles

◆ SetBorders()

Object SPoly::SetBorders ( Array< SMultiline multiTbl,
number  remeshDistance 
)

Create a new SPoly by updating the input one in order to make it fit the input border.

Parameters
multiTbl(Array<SMultiline>) The input table of SMultiline borders
remeshDistance(number) The distance from the borders used for the remeshing
Return values
ret.ErrorCode(number) The error code
  • 0: No error.
  • 1: The number of regions (part of border line) that couldn't be filled.
ret.Poly(SPoly) The resulting SPoly.

◆ SetPolyRepresentation()

SPoly::SetPolyRepresentation ( PolyRepresentationTypeEnum  representation)

Set the representation of the SPoly.

Parameters
representation(PolyRepresentationTypeEnum) The representation to set.

◆ Smooth()

Object SPoly::Smooth ( number  loopNumber,
SmoothEnum  option,
number  maxiDeviation,
boolean  isReorganise,
number  minAngleReorg,
number  refineDistProj = -1,
number  refineVrtxAngle = -1,
number  angleSharpEdge = -1,
number  nbTriMax = -1 
)

Smooth the surface of the current SPoly.

Note
This function can reorganize, and (or) recompute vertices and (or) subdivide triangles.
You can also refine the SPoly with Refine parameters.
Parameters
loopNumber(number) The number of loop of the smoothing calculation. This parameter will determine the smoothing intensity. If zero, the vertices will not move at all.
option(SmoothEnum) The option for smoothing
  • SPoly.POLY_SMOOTH_KEEP_DETAILS: Do we try to limit increasing the radii and reducing the mesh volume and surface? The most efficient smoothing, noise reduction and response time is obtained if you disable this feature.
  • SPoly.POLY_SMOOTH_LIMIT_DIST_BY_PROJ: Determine whether we should limit the distance of the new vertex location against the projection on the original surface (1) or against the original vertex location (0).
  • SPoly.POLY_SMOOTH_COMPLEX_SURF: Do we consider original mesh triangles as complex surfaces (1) to compute the distance of the new vertex location or do we consider original mesh triangles as flat surfaces (0)
  • SPoly.POLY_SMOOTH_SMOOTH_BORDERS: Determine if free borders can move (1) or if free borders must stay immobile (0) to make fusion after with another mesh
maxiDeviation(number) The maximum distance authorized to determine the new position of the vertices. If this value is <0, no limitation is done. The interpretation of this parameter should be done with the smoothing option.
isReorganise(boolean) If true the function Reorganise is called at each loop.
minAngleReorg(number) The Angle (in degree) of the thinest triangle authorized to be created if a reorganization is ordered between all the smoothing loops. A good value is 10 degrees.
refineDistProj(number) Refinement parameters or 0 if no refinement is required. If a refinement is asked, the function will consider each triangle of the input mesh as a complex piece of surface. Some new vertices are added in the mesh lying on this complex surface so that the triangles are becoming smaller and smaller and also smoother and smoother. If >0, new vertices are added when the deviation from the complex surface to the plane of the triangle is over this value.
refineVrtxAngle(number) If >0, new vertices are added when the angle between 2 neighbour vertices is over this value (in degrees)
angleSharpEdge(number) If >0, over this value (in degrees) an angle between triangles is considered as a sharp edge without relevant complex surface
nbTriMax(number) if not -1, define here max number of triangles of the mesh (triangles are added when refine is made). If only smoothing, no points are added
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: Parameter(s) are not valid
  • 2: An error occurred.

◆ SmoothBorders()

Object SPoly::SmoothBorders ( Array< SPoint pointTable,
number  maxEdgeLength = 0 
)

3D smoothing of borders. The function creates triangles on the edges of the holes to create smooth borders. The borders to be treated are selected with a point on the borders.

Parameters
pointTable(Array<SPoint>) A table of points to identify each border to process
maxEdgeLength(number) The maximum length of the edges to generate
  • < 0: The maximum length
  • <= 0: No limit
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ SphericalMesh()

static Object SPoly::SphericalMesh ( Array< SCloud cloudOfPoints,
SPoint  scanPos,
number  regularSampling,
number  deviationErr,
number  maxiNbTriangle,
number  alphaShapeThreshold,
number  maxSizeThreshold,
number  minSizeThreshold,
number  deleteSmall 
)
static

Make a spherical 3D mesh from SCloud(s)

Parameters
cloudOfPoints(Array<SCloud>) The table of clouds to mesh
scanPos(SPoint) The scanning position. If null, find scan positions in cloud informations (if none, retrieve the centroid of the global cloud as scanning position)
regularSampling(number) First filter to make a noise reduction taking in the cloud only points evenly spaced
  • =0: No noise reduction, Keeping all points.
  • >0: The minimum average distance between points. The function project a "grid" of this size on the shape to mesh and takes ONLY the best points in each grid element. Then, the subset represented by these points is meshed with a the deviation error. The point meshed are the points returned by SCloud.ReduceBest()
deviationErr(number) Second filter applied after the first filter. Points are kept in the mesh only if they are needed to have distance with the cloud lower than a certain value. Note however that this distance criterion is statistic and does not means that all the points of the cloud will have a distance with the resulting mesh lower than this value.
maxiNbTriangle(number) The maximum number of triangles in the resulting mesh
alphaShapeThreshold(number) Parameter for the algorithm of contour detection to delete the triangles that are not part of the surface Recommended value is -3.
  • >0: All the triangles having a radius passing through the 3 points greater than alphaShapeThreshold are deleted.
  • =0: This filter will be disabled.
  • -1<= alpha <0: The system will take a default value of -3 that is suitable in most cases.
  • <-1: Triangle are deleted according to the local vertex density. A high value (near to -1) will detect many jagged contours while a high value will result in smoother contours or no contour detection at all if the value is too small
maxSizeThreshold(number) Always delete triangles having a size higher than this value. If <=0, this filter will be disabled.
minSizeThreshold(number) Never delete triangles having a size smaller than this value. If <=0, this filter will be disabled.
deleteSmall(number) During the cleaning process to retrieve holes and contours, we may obtain several disconnected pieces. Each piece with a number of triangles lower than this value is deleted. Note that you can retrieve the number of pieces with the function SPoly.GetNbPieces() and you can also retrieve each individual piece with the function SPoly.Explode()
Return values
ret.PolyTbl(Array<SPoly>) This function returns a table of SPoly (1 per scanning position or 1 per input clouds if no scanning position containing in clouds)
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ StitchOverlap()

Object SPoly::StitchOverlap ( SPoly  meshToStitch,
number  tolDist,
StitchOverlapEnum  options 
)

Stitch a SPoly (meshToStitch) with the current SPoly.

Note
The SPoly on which StitchOverlap is called will be modified. You may have to copy this SPoly before calling StitchOverlap.
options is a combination of STITCH_OVERLAP_ flags. For instance :
var meshToStitch = ....;
var meshToRepair = ....;
var retVal = meshToRepair.StitchOverlap(
@ STITCHOVERLAP_MAKE_SEWING_ZONE_INVISIBLE
Modify the sewing zone so that it should not be visible.
Definition: Reshaper.h:6618
@ STITCHOVERLAP_MODIFY_OVERLAP_IN_MIDDLE_ZONE
Modify the output overlapping surface so that it becomes in the middle of the two input surfaces.
Definition: Reshaper.h:6622
Parameters
meshToStitch(SPoly) The SPoly to stitch
tolDist(number) The tolerance distance. The zones to merge must overlap with a distance lower than this value.
options(StitchOverlapEnum) A combination of SPoly.STITCHOVERLAP_... flags to use
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ SubdivideTriangles()

Object SPoly::SubdivideTriangles ( number  maxEdgeLength,
boolean  ignoreFreeEdges = false,
number  limitCos = 0,
boolean  preserveGeometry = false 
)

Subdivide triangles when at least one of its edges is longer than the maximum allowed edge length.

Note
Only the selected triangles are considered for subdivision. However, if the free edges are to be split, some of the unselected triangles adjacent to the selection boundaries might be subdivided anyway.
Parameters
maxEdgeLength(number) The maximum allowed edge length.
ignoreFreeEdges(boolean) If true does not split free nor selection boundary edges. By default these edges can be split.
limitCos(number) The maximum cosine value allowed between each source face normal and new created ones.
preserveGeometry(boolean) If true, forces the resulting mesh to fit exactly to the original surface (slower).
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The subdivided SPoly.

◆ Tolerance3DMesh()

Object SPoly::Tolerance3DMesh ( SCloud  cloud,
number  deviation,
number  distanceWrongPoints,
number  sizeTriMax,
boolean  isReorganize,
number  extension,
boolean  isNoiseReduct 
)

Upgrade the current SPoly by using its topology.

Note
The function chooses the most relevant points in the cloud according to the accuracy (tolerance or deviation error) it must reach. If the cloud is very noisy (i.e. the cloud is not really a surface) the command can throw exceptions.
The main difference between SPoly.Tolerance3DMesh() and SPoly.RemeshRefineDev() are:
Tolerance3DMesh takes directly some points of the cloud. If the noise reduction is activated the function will try to take points in the middle of the noise thickness, if any. However, if no point is present in the middle of the noise thickness, it may result a very noisy shape.
RemeshRefineDev takes some new points with the deviation error criterion, which do not exist in the cloud. These points are placed in the middle of the noise thickness even if there is no corresponding point inside your cloud.

If your point cloud is very noisy and dense, you should obtain a better result with RemeshRefineDev. If your point cloud is very accurate or sparse, you should obtain a better result with Tolerance3DMesh.
See also
SPoly.RemeshRefineDev(), SPoly.Direct3DMesh()
Parameters
cloud(SCloud) The cloud of points to mesh
deviation(number) The tolerance to respect (deviation error)
distanceWrongPoints(number) If a point of the cloud has a distance to the input SPoly over this value, it is considered as wrong (aberrant) and the point is rejected.
sizeTriMax(number) The maximum triangle size for triangle created on free contours, if an extension of the existing SPoly is requested.
isReorganize(boolean) If true, try to reorganise locally sharp edges or small radii.
extension(number) What must be done on free borders. If not 0, the borders can be smoothed and the small holes can be filled.
  • 0: Mesh inside limits of existing SPoly. Do not extend outside from the borders.
  • 1: Mesh inside and outside limits of existing SPoly.
  • 2: Mesh only outside of existing SPoly.
isNoiseReduct(boolean) Should we keep only best points to make noise reduction?
  • true: Yes, only best points are used for calculation.
  • false: No, all the points are kept for calculation.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ toString()

string SPoly::toString ( )

Get the type of the variable.

Returns
(string) The type name

◆ ValuesToString()

string SPoly::ValuesToString ( )

Get a debug string representation of the poly.

Returns
(string) A debug string representing the poly

◆ VolumeFromElevation()

Object SPoly::VolumeFromElevation ( Array< number >  elevations,
SVector  projDir = SVector() 
)

Compute the volume of the SPoly above and below the given elevation.

var polyTbl = SPoly.FromSel();
var poly = polyTbl[0];
var elevations = [0.0, 1.0, 2.0];
var resVolumeFromElevation = poly.VolumeFromElevation(elevations);
if(resVolumeFromElevation.ErrorCode != 0)
throw new Error('Failed to compute volume from elevations');
resVolumeFromElevation.ValueTbl.forEach(function(curResult)
{
print('under='+curResult.VolumeUnder);
print('over='+curResult.VolumeOver);
}
);
Parameters
elevations(Array<number>) The list of elevations to use
projDir(SVector) The normal direction of the planes.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.ValueTbl(string) A table of results. Each result is a structure with the following members:
  • VolumeUnder: Contains the volume below the plane at the n-th elevation
  • VolumeOver: Contains the volume above the plane at the n-th elevation

◆ WriteOnMesh()

Object SPoly::WriteOnMesh ( string  textToWrite,
SVector  textNormal,
SVector  textHorizontalNormal,
SPoint  textPosition,
number  textDepth,
number  planeDepth,
number  scale,
string  font = "Arial",
boolean  isBold = false,
boolean  isItalic = false,
number  writingStyle = 1 
)

Write a text on a mesh. The mesh will be engraved.

Parameters
textToWrite(string) The text to write
textNormal(SVector) The normal direction of the text
textHorizontalNormal(SVector) The direction of the writing
textPosition(SPoint) The top left corner of the displayed text
textDepth(number) The depth of the engraved text
planeDepth(number) If>0, Choose to write your text on a plane added to the mesh. By default the text is writing on the mesh directly
scale(number) The scale of the text : choose between 0 and 1
font(string) The font of the text. "Arial" by default
isBold(boolean) Should the text be in bold?
isItalic(boolean) Should the text be in italic?
writingStyle(number) The engraving mode
  • 0: hollow
  • 1: embossed
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The resulting SPoly.