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

The SPoly class provides triangular mesh(es) manipulation.
The SPoly creation can be done by calling the static functions:
. More...

#include <SPoly.h>

Inheritance diagram for SPoly:
SComp SObject

Public Types

enum  BordersEnum { NO_CHANGE , REFINE , EXTEND_REFINE }
 
enum  CylinderEnum {
  CYL_FORCE_NOTHING , CYL_FORCE_RADIUS , CYL_INIT_RADIUS , CYL_FORCE_CENTER ,
  CYL_INIT_CENTER , CYL_FORCE_DIRECTION , CYL_INIT_DIRECTION
}
 Bit mask to know which parameter(s) are forced and do not need to be computed. More...
 
enum  DeviationOptionEnum { KEEP_EQUI , BEST_POS , ON_BORDERS }
 
enum  EExportVertexColor { EXPORT_FBX_NO_COLOR , EXPORT_FBX_INSPECTION , EXPORT_FBX_REAL_COLOR , EXPORT_FBX_COLOR_PER_TRIANGLE }
 
enum  FusionOptionEnum { SIMPLE , REMESH , FILL_HOLES , CLOSE }
 
enum  HoleOptionEnum { NO_CLOSED , INSIDE_CLOSED , ALL_CLOSED }
 
enum  OffsetEnum { NORMAL_OFFSET , NO_AUTO_INTERSECTION }
 
enum  PolyRepresentationTypeEnum {
  POLY_SMOOTH , POLY_FLAT , POLY_WIRE , POLY_SMOOTH_WIRE ,
  POLY_FLAT_WIRE , POLY_SMOOTH_REALTIME , POLY_TEXTURE , POLY_COLORED ,
  POLY_INSPECTION , POLY_FLAT_TEXTURE_COLOR , POLY_TEXTURE_ASYNC
}
 The different representation types for polyhedrons.
Use SPoly.SMOOTH. More...
 
enum  ProjectionTypeEnum { PERSPECTIVE , EQUIRECTANGULAR , REPETITIVE , FISH_EYE }
 Enumeration of all available texturage projection types. More...
 
enum  RotateEnum { ROTATE_AUTO , ROTATE_CENTROID , ROTATE_INTERSECTION , ROTATE_USER_DEFINE }
 How the extrusion rotate point is compute. More...
 
enum  SegmentationFeaturesEnum {
  SEGMENTATION_PLANE , SEGMENTATION_SPHERE , SEGMENTATION_CONE , SEGMENTATION_CYLINDER ,
  SEGMENTATION_All
}
 
enum  SeparateTriBoxEnum { SEPARATETRIBOX_STRICLTY_INSIDE , SEPARATETRIBOX_ONLY_CROSSING , SEPARATETRIBOX_CROSSING_AND_INSIDE }
 
enum  SeparateTriBoxSelectEnum { SEPARATETRIBOX_KEEP_INSIDE_TRI , SEPARATETRIBOX_KEEP_OUTSIDE_TRI , SEPARATETRIBOX_KEEP_BOTH }
 
enum  SmoothEnum { POLY_SMOOTH_KEEP_DETAILS , POLY_SMOOTH_LIMIT_DIST_BY_PROJ , POLY_SMOOTH_COMPLEX_SURF , POLY_SMOOTH_SMOOTH_BORDERS }
 
enum  SphereEnum { SPHERE_FORCE_NOTHING , SPHERE_FORCE_RADIUS , SPHERE_FORCE_CENTER }
 Bit mask to know which parameter(s) are forced and do not need to be computed. More...
 
enum  StitchOverlapEnum { STITCHOVERLAP_MAKE_SEWING_ZONE_INVISIBLE , STITCHOVERLAP_REORGANIZE_SEWING_ZONE , STITCHOVERLAP_MODIFY_OVERLAP_IN_MIDDLE_ZONE , STITCHOVERLAP_ONLY_CONSISTENT_NORMALES }
 
- Public Types inherited from SComp
enum  RepresentationTypeEnum {
  SMOOTH , FLAT , WIRE , SMOOTH_WIRE ,
  FLAT_WIRE , SMOOTH_ROTWIRE , FLAT_ROTWIRE , TEXTURE ,
  INSPECTION
}
 The different representation types for inherited classes.
Use (inherited class).SMOOTH. Example: for a cloud, use SCloud.SMOOTH. More...
 

Public Slots

static Array All (Number iVisCrit)
 To get all the SComp in the document. More...
 
Array BooleanAdd (SPoly iPoly)
 To make a boolean addition with the current SPoly. More...
 
Array BooleanCommon (SPoly iPoly)
 To get the boolean common part between two closed volumes (the current object and a given parameter). More...
 
Array BooleanCutIn (SPoly iPoly)
 To cut the current SPoly against the parameter SPoly and keep the part of the current SPoly that is INside the parameter SPoly. More...
 
Array BooleanCutOut (SPoly iPoly)
 To cut the current SPoly against the parameter SPoly and keep the part of the current SPoly that is OUTside the parameter SPoly. More...
 
Array BooleanOperation (SPoly iPoly, Boolean iIsCutPoly)
 To make a boolean operation between two SPoly. More...
 
Array BooleanSub (SPoly iPoly)
 To make a boolean subtraction with the current object. More...
 
 Clear ()
 To deallocate memory of the object. More...
 
static Array ColorAlongDir (Array< SPoly > iMeshes, SVector iDirectionVect, SPoint iOrigin={})
 Color the mesh along a direction with a gradient. More...
 
Array Compare (SCloud iMeasCloud, Number iDistMax, Number iMappingObject, Boolean iIsIgnoreEdge, SVector iDirection, Number iMaxCosAngle=-2, Boolean iIsCheckForThinParts)
 Calculates the distances between 2 components for further inspection purpose (color mapping) More...
 
Array Compare (SPoly iMeasPoly, Number iDistMax, Number iMappingObject, Boolean iIsIgnoreEdge, SVector iDirection, Number iMaxCosAngle=0., Boolean iIsCheckThinParts)
 Calculates the distances between 2 components for further inspection purpose (color mapping) More...
 
static Array ConstraintMesh2D (SCloud iCloudOfPoints, Array< SMultiline > iSetOfMultilines, SVector iMeshDir, Number iTolerance, Number iZoneType)
 Makes a 2D1/2 meshing on a set of multilines and a point cloud; both are optional but at least one is necessary! More...
 
Array ConstraintMesh3D (SCloud iCloudOfPoints, Array< SMultiline > iSetOfMultilines, Number iTolerance, Number iZoneType)
 Makes a 3D meshing on a mesh (this), a set of multilines and a point cloud; both are optional but at least one is necessary to add points on the mesh! More...
 
Array Contours (Boolean iIsExportSuspiciousTriangles=false)
 
static Array CreateCompound (Array< SPoly > iTablePoly, Boolean iOptOrient)
 Make a compound SPoly from a table of SPoly. More...
 
Array Cubature (SPoly iSecondPoly, SVector iProjDir={})
 Calculate volumes between 2 surfaces to make cubature of embankments and excavations. This function makes the volume computation according the projection direction iProjDir. If the projection direction is null, the function will try to evaluate this direction. 2 volumes are calculated: volume over Poly0 and under Poly1 (side 1), volume under Poly0 and over Poly1 (side 2) More...
 
Array DestructTrianglesOnHoles (SCloud iCloud, Number iHoleSize, Number iMaxDistToCloud=0.f, Number iOptions, Number iMaxCosAngle=-1)
 Remove triangles which are considered over a hole of a certain diameter regarding iCloud. More...
 
static Array Direct3DMesh (SCloud iCloudToMesh, Number iDeviationError, Number iMiniAverageDist, HoleOptionEnum iOptionHole, Number iSizeTriHole, Boolean iIsIgnoreScanDir)
 Makes a direct 3D mesh of a point cloud according different strategies (regular, deviation, etc.). More...
 
static Array DirectionMesh (SCloud iCloudOfPoints, SVector iMeshingDirection, Number iTolerance, Boolean iIsFindCntr)
 Meshes a cloud of points according to a certain tolerance and direction (2D1/2 meshing) More...
 
Array Explode ()
 Explodes a compound mesh into several parts. More...
 
Array ExplodeColor ()
 Explodes a compound mesh into several parts according to the color of the triangles. More...
 
Array ExplodeWithInspectionSteps ()
 Split the mesh according to the inspection steps. More...
 
Array ExtractCylinder (Array< SPoint > iSeedPoint, Number iTolerance, CylinderEnum iForce, SPoint iCenter={}, SVector iDirectionVector={}, Number iRadius)
 Extract the cylindrical region on the current polyhedron starting from a seed point. More...
 
Array ExtractFeatureLines (Number iSmoothingIntensity=0.0)
 Extract all the feature lines on the mesh. More...
 
Array ExtractPlane (SPoint iSeedPoint, Number iTolerance)
 Extract the planar region on the current cloud starting from seed point(s). More...
 
Array ExtractSphere (Array< SPoint > iSeedPoint, Number iTolerance, SphereEnum iForce, SPoint Center={}, Number iRadius)
 Extract the spherical region on the current polyhedron starting from seed point(s). More...
 
static Array Extrusion (SMultiline iProfile, SMultiline iPath, Boolean iTurnWithPath, Boolean iPerpendicularToPath, SMultiline iSecondPath, RotateEnum iOption, SPoint iRotatePt)
 Create a mesh from a path and a profile, the profile is extracted along the path. More...
 
Array FillContours (Array< SMultiline > iContourTable, Number iTension=0.732f, Number iWallThickness=-1, Boolean iIsForceNonSmoothShape)
 3D Hole filling. The function creates triangles on the edges of the holes to fill the concave parts. More...
 
Array FillHoles (Array< SPoint > iPointTable, Number iTension, Number iWallThickness=-1)
 3D Hole filling. The function creates 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...
 
Array FillHolesDirection (SVector iDirection, Array< SPoint > iPointTable, Number iTension)
 To fill the holes that have at least one point listed in the table of points. More...
 
static Array FromClick ()
 Launches a click interaction to select a SComp in the scene. More...
 
static Array FromFile (String iFileName)
 
static Array FromName (String iName)
 Search all the component with the given name. More...
 
static Array FromSel ()
 To get all the selected SComp. More...
 
static Array Fusion (Array< SPoly > iPolyTable, FusionOptionEnum iOption, Number iAccuracyPoint=1.E-5, Number iAccuracyBorders=0.001)
 Sew common edges of a SPoly list, or rebuild topology of existing Polyhedron(s). More...
 
Array GetColorGradient ()
 To get the color gradient of the SPoly. More...
 
Array GetContours ()
 Extract free contour(s) from the current SPoly.
Returns a table of SMultilines containing all the free edges of a SPoly. More...
 
Array GetHighestPoint (SVector iDirection)
 Get the highest point according to the Direction. More...
 
Array GetInertiaMatrix (Boolean iIsOnlyIfClosed)
 Calculates the solid's inertia matrix. More...
 
Array GetLowestPoint (SVector iDirection)
 Get the lowest point according to the Direction. More...
 
Number GetNbPieces ()
 
Number GetNumberOfTextureMaps ()
 Returns the number of dynamic textures (texture maps) applied to the mesh. More...
 
Array GetNumberOfTextures ()
 Returns the number of textures applied to the mesh. More...
 
Array GetSilhouette (SVector iViewDirection, Number iDraftAngle, Number iMinClosedLine, Number iMinUnclosedLine, Number iResultType)
 Calculates the silhouette or external contour of a SPoly according to a direction and possibly a draft angle. More...
 
Array GetSurface ()
 To retrieve the polyhedron's surface. More...
 
Array GetTextureName (Number iTextureIdx)
 Returns the original name of a dynamic texture (texture map) applied to the mesh. More...
 
Array GetTriangleSize ()
 To retrieve the triangle size of current SPoly. More...
 
Number GetTrianglesNumber ()
 
Array GetVolume (Boolean iIsOnlyIfClosed)
 To retrieve the polyhedron's volume. More...
 
Array ImproveBorders (Array< SSetMultiline > iSetMultiTbl, Number iRemeshDistance, Number iCleaningDistance)
 Create a new SPoly by updating the input one in order to make it fit the input border. More...
 
Array InterInfLine (SPoint iPoint, SVector iVect)
 Calculates the intersection with an infinite line. More...
 
Array Intersect (SPoly iPoly, Number iOption)
 To make an intersection between two objects (the current object and a given parameter). More...
 
static Array JoinContour (Array< SMultiline > iMultiLines, Array< SPoly > iPolyhedrons, Number iTangency1, Number iTangency2, Number iTension=0.732, Boolean iReorganize, Number iNbPoint)
 Create a meshed surface from two contours or mesh holes, which optionally preserves tangency continuity. More...
 
static Array LinearExtrusion (Number iLength, SVector iDirection, Boolean iCloseExtremities, Array< SComp > iComps)
 Compute poly(s) corresponding to the extrusion of profile(s) -polyline, linear feature, linear CAD object- along a direction, with a given length. More...
 
Array LoadColorGradient (String iFilePath)
 Loads the color gradient from a file (*.rsi binary file). More...
 
Array LocalizeValues (Array< Number > iThresholdList)
 Extract the points or the lines at threshold values of an inspected mesh. More...
 
static Array MergeCommonBorders (Array< SPoly > iPolyTable, FusionOptionEnum iOption, Number iAccuracyPoint=1.E-5, Number iAccuracyBorders=0.001)
 Sew common edges of a SPoly list, or rebuild topology of existing Polyhedron(s). More...
 
Array MeshSegmentation (Number iAngleThreshold=15.0, Number iMergeMaxDistance=0., Number iMinRegionArea=0., Number iClassificationMaxDistance=0., SegmentationFeaturesEnum iFeatures)
 Segment a mesh in several regions matching with geometric features (Plane, Sphere, Cylinder and Cone). 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...
 
static SPoly New ()
 Default constructor to create an empty new SPoly. More...
 
static SPoly New (SPoly iOther)
 Constructs an SPoly by copying the SPoly Other. More...
 
Array Offset (Boolean iIsDirect, Number iDistCoef, OffsetEnum iOptBitMask)
 Calculates and returns a new parallel polyhedron. More...
 
static Array PipeTubeAlongPath (Number iRadius, Boolean iCloseExtremities, Array< SComp > iComps)
 Compute mesh(es) corresponding to the extrusion of a circle with a given radius along a given path. More...
 
static Array ProfileAlongPath (SComp iProfile, SComp iPath, Boolean iMakePerpendicular, Boolean iTurnWthCurve, Boolean iUsePathToLeanOn, Boolean iStartAtProfilePosition, Boolean iCloseExtremities, SComp iPathToLeanOn)
 Compute mesh corresponding to the extrusion of a given profile along a given path. More...
 
Array Proj3D (SMultiline iMultilineToProject, Boolean iHadIntermediatePt)
 Calculates the 3D projection of a SMultiline on an SPoly. More...
 
Array Proj3D (SPoint iPoint)
 Calculates the 3D projection of a point on an SPoly.
This function always returns the nearest point. More...
 
Array ProjDir (SMultiline iMultilineToProject, SVector iDirection, Boolean iHadIntermediatePt, Boolean iIsSignedProjection)
 Calculates the projection of a SMultiline on an SPoly with a direction. More...
 
Array ProjDir (SPoint iPoint, SVector iDirection, Boolean iIsSignedProjection)
 Calculates the projection of a point on an SPoly with a direction.
The point to project is considered as the origin of the direction. More...
 
Array Reduce (Number iTargetNbVertex, Number iMinAngle)
 Function to reduce a mesh according to the angle between facets to minimize the visual degradation. More...
 
Array ReduceDeviation (Number iDeviationError, DeviationOptionEnum iCriteria, Boolean iIsKeepSharpEdge, Number iDeviationOnSharpEdges, Number iSharpEdgeAngleValue, Number iMaxEdgeLength, Number iDeviationOnBorders)
 Reduces the mesh by deleting some vertices and triangles according to a deviation error. More...
 
Array RemeshRefineDev (Number iDeviation, Number iSizeMin, Number iMaxiTriNumber, BordersEnum iBorderOption, Number iDistanceWrongPoints, Number iReorganize, SCloud iCloud, Number iMaxCosAngle=-1)
 Refines an existing SPoly with deviation error and optionally better fitting on a SCloud. More...
 
Array RemeshSharpEdge (Array< SMultiline > iLines, SPoint iReferencePoint)
 Modifies locally the existing mesh to recreate sharp edge(s) More...
 
Array RemoveSpikes (Number iLoopNumber, Number iPropag=-1, Number iIntensity, Boolean iIsRecalculateBorder)
 This function will suppress or correct absurd points (ie spikes) of the current SPoly. More...
 
Array RemoveTexture ()
 Removes all textures applied on the current mesh. More...
 
Array RemoveTrianglesOnHoles (SCloud iCloud, Number iHoleSize, Number iMaxDistToCloud=-1, Number iMaxAngle=-1)
 Remove triangles which are considered to be over a hole of a certain diameter regarding iCloud. More...
 
Array Save (String iFilePath, Boolean iIsTextExport, SMatrix iCoordinateSystemMatrix={})
 Saves the mesh into a file. More...
 
Array SaveColorGradient (String iFilePath)
 Saves the color gradient into a file (*.rsi binary file). More...
 
static Number SaveFBX (String FilePath, Array< SPoly > MeshesToExport, Boolean IsExportTexture, EExportVertexColor ExportVertexColor, SMatrix CoordinateSystemMatrix={})
 Saves the meshes into a FBX file. More...
 
Array SectionCylindric (SPoint iFirstPointOnAxis, SPoint iSecondPointOnAxis, SPoint iPointOnTheFirstCylinder, Number iNumberOfCylinders, Number iDistanceBeetweenCylinders)
 Intersection of a Polyhedron by parallel cylinders. More...
 
Array SectionOnMulti (SMultiline iMultiLine, Array< Number > iListDist, Number iMaxDist, Number iOptBitMask)
 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...
 
Array SectionOnMultiReg (SMultiline iMultiLine, Number iDist, Number iMaxDist, Number iOptBitMask)
 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 distance. More...
 
Array SectionPlane (SVector iPlaneNormal, SPoint iPtFirstPlane, Number iNbPlanes, Number iDistance)
 Intersection between an SPoly and a parallel plane. More...
 
Array SectionRadial (SPoint iFirstPointOnAxis, SPoint iSecondPointOnAxis, SPoint iPtFirstPlane, Number iNbSections, Number iMaxAngleInRadian)
 Intersection of a Polyhedron by radial planes. More...
 
Array SeparateTriangleBox (SPoint iLowerPoint, SPoint iUpperPoint, SeparateTriBoxEnum iSelType, SeparateTriBoxSelectEnum iWhichPartToKeep)
 Separate triangles of a mesh according to a box. Depending of iWhichPartToKeep, the current poly is updated and Array.Poly can be fill also (case of SEPARATETRIBOX_KEEP_BOTH). More...
 
Array SeparateTriangleInPrism (SMultiline iProfil, Number iDistance, SeparateTriBoxEnum iSelType, SeparateTriBoxSelectEnum iWhichPartToKeep)
 Separate triangles of a mesh according to a prism. Depending of iWhichPartToKeep, the current poly 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 by iDistance/2. More...
 
Array SeparateTriangleSize (Number iSmallestSize, Number iBiggestSize)
 Separate a mesh into parts according to the triangle size. More...
 
Array SeparateTriangleWithActivatedClippingPlanes (Array< SClippingPlane > iClippingPlanes, SeparateTriBoxEnum iSelType)
 Separate triangles of a mesh according to clipping planes. Depending of iWhichPartToKeep, the current poly is updated and Array.Poly can be fill also (case of SEPARATETRIBOX_KEEP_BOTH). More...
 
Array SetBorders (Array< SMultiline > iMultiTbl, Number iRemeshDistance)
 Create a new SPoly by updating the input one in order to make it fit the input border. More...
 
 SetPolyRepresentation (PolyRepresentationTypeEnum Representation)
 The representation of the component is modified. More...
 
Array Smooth (Number iLoopNumber, SmoothEnum iOptionMask, Number iMaxiDeviation, Boolean iIsReorganise, Number iMinAngleReorg, Number iRefineDistProj=-1.0, Number iRefineVrtxAngle=-1.0, Number iAngleSharpEdge=-1.0, Number iNbTriMax=-1)
 Smooth the surface of the current SPoly. More...
 
Array SmoothBorders (Array< SPoint > iPointTable, Number iMaxEdgeLength)
 3D smoothing of free borders. The function creates triangles on the edges of the holes to create smooth edges. The contours to be treated are selected with a point on the contour. More...
 
static Array SphericalMesh (Array< SCloud > iCloudOfPoints, SPoint iScanPos, Number iRegularSampling, Number iDeviationErr, Number iMaxiNbTriangle, Number iAlphaShapeThreshold, Number iMaxSizeThreshold, Number iMinSizeThreshold, Number iDeleteSmall)
 Makes a spherical 3D mesh from point cloud(s) More...
 
Array StitchOverlap (SPoly iMeshToStitch, Number iTolDist, StitchOverlapEnum iOptions)
 Stitch a SPoly (meshToStitch) with the current SPoly. More...
 
Array SubdivideTriangles (Number iMaxEdgeLength, Boolean iIgnoreFreeEdges, Number iLimitCos=0., Boolean iPreserveGeometry)
 Subdivide triangles when at least one of its edges is longer than the maximum allowed edge length. More...
 
Array TakeColorFromClouds (Array< SCloud > iCloudsTbl, Number iIgnoreOver, Number iResetColor, Number iDefaultRed, Number iDefaultGreen, Number iDefaultBlue)
 Uses the color (or the color of inspection) of point clouds to color the vertices on the current mesh. More...
 
Array TextureAddRepetitive (String iFilePathName, Number iNbRepWidth, Number iNbRepHeight, SVector iDirXScreen, SVector iDirYScreen, SPoint iImageOrigin)
 Adds repetitive texture to a mesh. More...
 
Array Tolerance3DMesh (SCloud iCloud, Number iDeviation, Number iDistanceWrongPoints, Number iSizeTriMax, Boolean iIsReorganize, Number iExtension, Boolean iIsNoiseReduct)
 Upgrade the current SPoly by using its topology. More...
 
String toString ()
 Get the type of the variable. More...
 
static String toString ()
 Get the type of the variable. More...
 
Array VolumeFromElevation (Array< Number > iElevations, SVector iProjDir={ 0., 0., 1. })
 Calculate the Polyhedron volume above and below the given elevation. More...
 
Array WriteOnMesh (String iTextToWrite, SVector iTextNormal, SVector iTextHorizontalNormal, SPoint iTextPosition, Number iTextDepth, Number iPlaneDepth, Number iScale, String iFont="Arial", Boolean isBold, Boolean isItalic, Number iWritingStyle)
 Write a text on a mesh. The mesh will be engraved. More...
 
- Public Slots inherited from SComp
 AddToDoc ()
 To add the object to the document. More...
 
static Array All (Number VisCrit)
 To get all the SComp in the document. More...
 
 ApplyTransformation (SMatrix iMatrix)
 To apply a geometric transformation to the current object by making a product with the given matrix. More...
 
 Clear ()
 To deallocate object memory. More...
 
static Array FromClick ()
 Launches a click interaction to select a SComp in the scene. More...
 
static Array FromName (String Name)
 Search all the component with the given name. More...
 
static Array FromSel ()
 To get all the selected SComp. More...
 
Array GetBoundingBox ()
 Calculates the bounding box of the component. More...
 
Array GetColors ()
 To get the colors of the component. More...
 
String GetFolderName ()
 The component containing folder's name. More...
 
String GetName ()
 The component's name. More...
 
String GetPath ()
 To get the full path of a comp in the tree. More...
 
 Invert ()
 Normal of the component is inverted. More...
 
Boolean IsInDoc ()
 Return if the component is in the document or not. More...
 
Boolean IsVisible ()
 
 MoveToGroup (String GroupPath, Boolean MoveInsideTopParent)
 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 ()
 To remove the object from the document. More...
 
 SetClippable (Boolean clipping)
 Set clippable or not. More...
 
 SetColors (Number Red, Number Green, Number Blue)
 Sets the colors of the component. More...
 
 SetName (String ComponentName)
 To set the component's name. More...
 
 SetRepresentationType (RepresentationTypeEnum Representation)
 The shading type of the component is modified. More...
 
 SetTransparency (Number Alpha)
 Sets the transparency of the component. More...
 
 SetVisibility (Boolean Visible)
 Sets the component to be visible, or not visible. More...
 
String toString ()
 Get the type of the variable. More...
 
String toString ()
 Get the type of the variable. More...
 
 Translate (SVector Vector)
 To make a translation of the current object with an SVector. More...
 
- Public Slots inherited from SObject
 Clear ()
 To deallocate memory of the object. More...
 
String toString ()
 Get the type of the variable. More...
 

Detailed Description

The SPoly class provides triangular mesh(es) manipulation.
The SPoly creation can be done by calling the static functions:
.

  • New() to create your own empty SPoly.
  • New() to copy an existing SPoly.

  • FromFile() to load the SPoly contained inside a file.
    Supported file extensions are:
    File extension authorized: .stl, .off, .msh, .ply, .obj, .poly, .pbi, .msd, .glb, .gltf

    var result = SPoly.FromFile(currentDir + 'sphere.pbi');
    if(result.ErrorCode == 0)
    {
    var spherePolys = result.Polys;
    }
    Warning
    In Javascript, when you write strings the '\' character is an escape character, you need to use '\\' or '/' instead. Pay especially attention to this when writing file paths in your scripts. For example :
    var res = SPoly.FromFile( 'C:/Poly.stl' ); // Valid syntax\n
    var res2 = SPoly.FromFile( 'C:\\Poly.stl' ); // Valid syntax\n
    var res3 = SPoly.FromFile( 'C:\Poly.stl' ); // Invalid syntax
    The SPoly class provides triangular mesh(es) manipulation. The SPoly creation can be done by calling ...
    Definition: SPoly.h:39
    static Array FromFile(String iFileName)
  • ConstraintMesh() to make a 2D1/2 or 3D mesh, by merging an existing polyhedron, a set of multilines and a point cloud (all are optional).
  • Direct3DMesh() to make a direct 3D mesh from a point cloud according to different strategies (regular, deviation, etc.).

Member Enumeration Documentation

◆ BordersEnum

Enumerator
NO_CHANGE 
REFINE 
EXTEND_REFINE 

◆ CylinderEnum

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

Enumerator
CYL_FORCE_NOTHING 
CYL_FORCE_RADIUS 
CYL_INIT_RADIUS 
CYL_FORCE_CENTER 
CYL_INIT_CENTER 
CYL_FORCE_DIRECTION 
CYL_INIT_DIRECTION 

◆ DeviationOptionEnum

Enumerator
KEEP_EQUI 
BEST_POS 
ON_BORDERS 

◆ EExportVertexColor

Enumerator
EXPORT_FBX_NO_COLOR 
EXPORT_FBX_INSPECTION 
EXPORT_FBX_REAL_COLOR 
EXPORT_FBX_COLOR_PER_TRIANGLE 

◆ FusionOptionEnum

Enumerator
SIMPLE 
REMESH 
FILL_HOLES 
CLOSE 

◆ HoleOptionEnum

Enumerator
NO_CLOSED 
INSIDE_CLOSED 
ALL_CLOSED 

◆ OffsetEnum

Enumerator
NORMAL_OFFSET 
NO_AUTO_INTERSECTION 

◆ PolyRepresentationTypeEnum

The different representation types for polyhedrons.
Use SPoly.SMOOTH.

Enumerator
POLY_SMOOTH 
POLY_FLAT 
POLY_WIRE 
POLY_SMOOTH_WIRE 
POLY_FLAT_WIRE 
POLY_SMOOTH_REALTIME 
POLY_TEXTURE 
POLY_COLORED 
POLY_INSPECTION 
POLY_FLAT_TEXTURE_COLOR 
POLY_TEXTURE_ASYNC 

◆ ProjectionTypeEnum

Enumeration of all available texturage projection types.

Enumerator
PERSPECTIVE 
EQUIRECTANGULAR 
REPETITIVE 
FISH_EYE 

◆ RotateEnum

How the extrusion rotate point is compute.

Enumerator
ROTATE_AUTO 
ROTATE_CENTROID 
ROTATE_INTERSECTION 
ROTATE_USER_DEFINE 

◆ SegmentationFeaturesEnum

Enumerator
SEGMENTATION_PLANE 
SEGMENTATION_SPHERE 
SEGMENTATION_CONE 
SEGMENTATION_CYLINDER 
SEGMENTATION_All 

◆ SeparateTriBoxEnum

Enumerator
SEPARATETRIBOX_STRICLTY_INSIDE 
SEPARATETRIBOX_ONLY_CROSSING 
SEPARATETRIBOX_CROSSING_AND_INSIDE 

◆ SeparateTriBoxSelectEnum

Enumerator
SEPARATETRIBOX_KEEP_INSIDE_TRI 
SEPARATETRIBOX_KEEP_OUTSIDE_TRI 
SEPARATETRIBOX_KEEP_BOTH 

◆ SmoothEnum

Enumerator
POLY_SMOOTH_KEEP_DETAILS 
POLY_SMOOTH_LIMIT_DIST_BY_PROJ 
POLY_SMOOTH_COMPLEX_SURF 
POLY_SMOOTH_SMOOTH_BORDERS 

◆ SphereEnum

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

Enumerator
SPHERE_FORCE_NOTHING 
SPHERE_FORCE_RADIUS 
SPHERE_FORCE_CENTER 

◆ StitchOverlapEnum

Enumerator
STITCHOVERLAP_MAKE_SEWING_ZONE_INVISIBLE 
STITCHOVERLAP_REORGANIZE_SEWING_ZONE 
STITCHOVERLAP_MODIFY_OVERLAP_IN_MIDDLE_ZONE 
STITCHOVERLAP_ONLY_CONSISTENT_NORMALES 

Member Function Documentation

◆ All

static Array SPoly::All ( Number  iVisCrit)
inlinestaticslot

To get all the SComp in the document.

Return values
Arrayall the SPoly contained in the document
Parameters
[in]iVisCritVisible selection criteria
  • 0 Keep if not visible
  • 1 Keep if visible
  • 2 (Default) Indifferent

◆ BooleanAdd

Array SPoly::BooleanAdd ( SPoly  iPoly)
slot

To make a boolean addition with the current SPoly.

Warning
The two SPoly must be closed
See also
BooleanOperation, Algo::Boolean, Intersect.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.PolyTblAn SPoly Array, the boolean operation's result.

◆ BooleanCommon

Array SPoly::BooleanCommon ( SPoly  iPoly)
slot

To get the boolean common part between two closed volumes (the current object and a given parameter).

Warning
The two SPoly must be closed
See also
BooleanOperation, Algo::Boolean, Intersect.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.PolyTblAn SPoly Array, the boolean operation's result.
Parameters
[in]iPolySecond object

◆ BooleanCutIn

Array SPoly::BooleanCutIn ( SPoly  iPoly)
slot

To 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
BooleanOperation, Algo::Boolean, Intersect.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.PolyTblAn SPoly Array, the boolean operation's result.
Parameters
[in]iPolySecond object

◆ BooleanCutOut

Array SPoly::BooleanCutOut ( SPoly  iPoly)
slot

To 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
BooleanOperation, Algo::Boolean, Intersect.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.PolyTblAn SPoly Array, the boolean operation's result.
Parameters
[in]iPolySecond object

◆ BooleanOperation

Array SPoly::BooleanOperation ( SPoly  iPoly,
Boolean  iIsCutPoly 
)
slot

To 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
BooleanOperation, Algo::Boolean, Intersect.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.PolyTblAn SPoly Array, the boolean operation's result.
Parameters
[in]iPolySecond object
[in]iIsCutPolyif true, make a cut of this against Poly (No facet of Poly is output in result).

◆ BooleanSub

Array SPoly::BooleanSub ( SPoly  iPoly)
slot

To make a boolean subtraction with the current object.

See also
BooleanOperation, Algo::Boolean, Intersect.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.PolyTblAn SPoly Array, the boolean operation's result.

◆ Clear

SPoly::Clear ( )
slot

To deallocate memory of the object.

◆ ColorAlongDir

static Array SPoly::ColorAlongDir ( Array< SPoly iMeshes,
SVector  iDirectionVect,
SPoint  iOrigin = {} 
)
staticslot

Color the mesh along a direction with a gradient.

Note
The color used to display the mesh is spread on all meshes
Return values
Array.ErrorCodeThe error code:
  • 0: No error.
  • 1: An error occurred.
Array.PolyTblThe resulting colored meshes
This table contains the same number of meshes as the input table
Parameters
iMeshesMeshes to color
iDirectionVectDirection to use for coloring
[in]iOriginthe origin (the point at which the value should be zero)

◆ Compare [1/2]

Array SPoly::Compare ( SCloud  iMeasCloud,
Number  iDistMax,
Number  iMappingObject,
Boolean  iIsIgnoreEdge,
SVector  iDirection,
Number  iMaxCosAngle = -2,
Boolean  iIsCheckForThinParts 
)
slot

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

Note
This picture shows an example of inspection between an SPoly and an SCloud. The distance returned on each vertex is used here to represent shape with a color mapping.
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.
Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Array.CloudThe new SCloud, which is the result of the comparison, if MappingObject is set to 2. else Array.Cloud is Undefined
Array.PolyThe new SPoly, which is the result of the comparison, if MappingObject is set to 1. else Array.Poly is Undefined
Array.ReportDataThe new SReportData, which contains the view set with the inspected component.
Parameters
[in]iMeasCloudSCloud considered as the measured object to project on this
[in]iDistMaxignore point having a distance greater than this one.
[in]iMappingObject1 means color mapping is done on 'this', else 2 the color mapping is done on MeasCloud.
[in]iIsIgnoreEdgeWhat should be done with points on edges.
  • false Project all points
  • true Ignore points having their projection on edge.
[in]iDirectionThe direction of the inspection
  • 0 if it's a 3D inspection not need of a vector direction
[in]iMaxCosAnglemax cos value for the angle between the triangle and the scanning dir if the cloud contains scanning direction, this parameter can be used to reject points which scanning direction is not valid according to this threshold.
For a value lower than -1, the scanning direction will never invalidate a point For a value equal to 0, the scanning direction and the triangle must be oriented in the same way
[in]iIsCheckForThinPartsdoes the cloud contains thin parts scanned from two sides?
  • if true, it is necessary to find a triangle with a valid orientation
  • if false, the closest triangle is the good one
Note
this option is only valid if the cloud contains scanning direction and maxCosAngle>-2

◆ Compare [2/2]

Array SPoly::Compare ( SPoly  iMeasPoly,
Number  iDistMax,
Number  iMappingObject,
Boolean  iIsIgnoreEdge,
SVector  iDirection,
Number  iMaxCosAngle = 0.,
Boolean  iIsCheckThinParts 
)
slot

Calculates the distances between 2 components 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.
Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Array.PolyThe new SPoly, which is the result of the comparison.
Array.ReportDataThe new SReportData, which contains the view set with the inspected component.
Parameters
[in]iMeasPolySPoly considered as the measured object to project on this
[in]iDistMaxignore point having a distance greater than this one.
[in]iMappingObject1 means color mapping is done on 'this', else 2 the color mapping is done on MeasPoly.
[in]iIsIgnoreEdgeWhat should be done with points on edges.
  • false Project all points
  • true Ignore points having their projection on edge.
[in]iDirectionThe direction of the inspection
  • 0 if it's a 3D inspection not need of a vector direction
[in]iMaxCosAnglemax cos value for the angle between the triangle and the scanning dir if the cloud contains scanning direction, this parameter can be used to reject points which scanning direction is not valid according to this threshold.
For a value lower than -1, the scanning direction will never invalidate a point For a value equal to 0, the scanning direction and the triangle must be oriented in the same way
[in]iIsCheckThinPartsdoes the cloud contains thin parts scanned from two sides?
  • if true, it is necessary to find a triangle with a valid orientation
  • if false, the closest triangle is the good one

◆ ConstraintMesh2D

static Array SPoly::ConstraintMesh2D ( SCloud  iCloudOfPoints,
Array< SMultiline iSetOfMultilines,
SVector  iMeshDir,
Number  iTolerance,
Number  iZoneType 
)
staticslot

Makes a 2D1/2 meshing on a set of multilines 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.
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyTblA table of polyhedron with one or many polyhedron according to the input option.
See also
ConstraintMesh3D
Parameters
[in]iCloudOfPointsThe cloud of points to mesh or 0
[in]iSetOfMultilinesSet of contours to merge and mesh with the cloud or an empty table if no contour to insert in the constrain meshing.
[in]iMeshDirThis vector defines the meshing direction for which all the points, triangles and contours are visible.
[in]iToleranceTolerance to respect ; deviation error (for the points of the cloud only).
[in]iZoneTypeDefines which type of result must be output.
  • 0: One polyhedron 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.

◆ ConstraintMesh3D

Array SPoly::ConstraintMesh3D ( SCloud  iCloudOfPoints,
Array< SMultiline iSetOfMultilines,
Number  iTolerance,
Number  iZoneType 
)
slot

Makes a 3D meshing on a mesh (this), a set of multilines 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
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyTblA table of polyhedron with one or many polyhedron according to the input option.
See also
ConstraintMesh2D
Parameters
[in]iCloudOfPointsThe cloud of points to mesh or 0
[in]iSetOfMultilinesSet of contours to merge and mesh with the cloud or an empty table if no contour to insert in the constrain meshing.
[in]iToleranceTolerance to respect ; deviation error (for the points of the cloud only).
[in]iZoneTypeDefines which type of result must be output.
  • 0: One polyhedron 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.

◆ Contours

Array SPoly::Contours ( Boolean  iIsExportSuspiciousTriangles = false)
slot

◆ CreateCompound

static Array SPoly::CreateCompound ( Array< SPoly iTablePoly,
Boolean  iOptOrient 
)
staticslot

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 polyhedron can contain several pieces. To retrieve independent polyhedron, use SPoly.Explode().
Warning
All the mesh of the table are cleared.
Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Array.PolyThe compound SPoly.
Parameters
[in,out]iTablePolyTable of SPoly to proceed. All the mesh are cleared when returning from this function.
[in]iOptOrientShould we have the same normal orientation for all parts ?
  • 0 (default) No
  • 1 Yes

◆ Cubature

Array SPoly::Cubature ( SPoly  iSecondPoly,
SVector  iProjDir = {} 
)
slot

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

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred
  • 1 An error occurred
Array.ValueTbl[0] Volume over current mesh and under iSecondPoly (side 1)
Array.ValueTbl[1] Volume under current mesh and over iSecondPoly (side 2)
Parameters
[in]iSecondPolythe second polyhedron
iProjDir[in/out] Projection direction or nullptr if none

◆ DestructTrianglesOnHoles

Array SPoly::DestructTrianglesOnHoles ( SCloud  iCloud,
Number  iHoleSize,
Number  iMaxDistToCloud = 0.f,
Number  iOptions,
Number  iMaxCosAngle = -1 
)
slot

Remove triangles which are considered over a hole of a certain diameter regarding iCloud.

A triangle is considered over a hole if it's possible to find a point on the triangle which can be the center of a sphere of diameter iHoleSize in which there is no point from the cloud. Using option flag 'iOptions', it's possible to keep triangle which have point of cloud that can be projected inside the triangle.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred
  • 1 An error occurred
Deprecated:
This function is deprecated, use RemoveTrianglesOnHoles instead.
Parameters
[in]iCloudThe cloud with the corresponding points
[in]iHoleSizeThe minimal size of a hole (diameter)
[in]iMaxDistToCloudThe maximal distance of points of cloud which are projected on kept triangles. This value is used only if bit 0 (1) of 'iOptions' is set.
[in]iOptionsOptions flag Bit 0 (1): if set, keep triangles if at least one point of the cloud can be projected inside the triangle. Point to project must be nearer than distance 'iMaxDistToCloud'. Bit 1 (2): if true, consider only selected triangle.
[in]iMaxCosAngleMax cosine value for the angle between the triangle and the scanning direction. If 0 <= 'MaxCosAngle' < 1 AND if 'iCloud' have scanning direction information, then 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 0.1 (~85 degrees).

◆ Direct3DMesh

static Array SPoly::Direct3DMesh ( SCloud  iCloudToMesh,
Number  iDeviationError,
Number  iMiniAverageDist,
HoleOptionEnum  iOptionHole,
Number  iSizeTriHole,
Boolean  iIsIgnoreScanDir 
)
staticslot

Makes a direct 3D mesh of a point cloud according 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 Tolerance3DMesh and (or) RemeshRefineDev.
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyThis function returns a polyhedron or a compound polyhedron found (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
Parameters
[in]iCloudToMeshThe cloud of points to mesh
[in]iDeviationErrorDeviation error ( tolerance ) to respect.
[in]iMiniAverageDistNoise reduction strategy
  • =0: No noise reduction. In this case, the only filter is DeviationError. DeviationError=0 means meshing all the points.
  • >0: Mini 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.
[in]iOptionHoleHow holes should be treated ?
  • 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 polyhedron (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 FillHoles, which provides an option to fill the holes "unconditionally".
[in]iSizeTriHolemaxi length of triangle to fill holes; -1 if no limit.
[in]iIsIgnoreScanDirTo ignore scan directions when meshing

◆ DirectionMesh

static Array SPoly::DirectionMesh ( SCloud  iCloudOfPoints,
SVector  iMeshingDirection,
Number  iTolerance,
Boolean  iIsFindCntr 
)
staticslot

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

Note
All the points of the cloud and contour must be visible from the ScanningDirection. The function chooses the most relevant points in the cloud according to the accuracy (tolerance) it must reach. Only those point are meshed.
The result returned can be used as is or used as a "topology", that ie using the function Tolerance3DMesh.
See also
DirectionMeshContour, Tolerance3DMesh, RemeshRefineDev, Direct3DMesh, SMultiline::FilterDirection
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyThe computed mesh.
Parameters
iCloudOfPointsThe cloud of points to mesh
iMeshingDirectionDirection for which all the points are visible. It is the 2D meshing direction.
iToleranceTolerance to respect (for the points of the cloud only).
iIsFindCntrIf true, find the best contour according to the point density.

◆ Explode

Array SPoly::Explode ( )
slot

Explodes a compound mesh into several parts.

Note
If the current polyhedron is made of several disconnected pieces the current mesh is exploded.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.PolyTblThe exploded polyhedron list.
The list returned is sorted by size.

◆ ExplodeColor

Array SPoly::ExplodeColor ( )
slot

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

Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.PolyTblThe exploded polyhedron list.
The list returned is sorted by size.

◆ ExplodeWithInspectionSteps

Array SPoly::ExplodeWithInspectionSteps ( )
slot

Split the mesh according to the inspection steps.

Return values
Array.ErrorCodeThe error code:
  • 0 OK, successful completion, no cluster deleted.
  • 1 Impossible to explode because the mesh contains no inspection steps.
  • 2 An exception occurred.
Array.PolyTblThe resulting list of component.

◆ ExtractCylinder

Array SPoly::ExtractCylinder ( Array< SPoint iSeedPoint,
Number  iTolerance,
CylinderEnum  iForce,
SPoint  iCenter = {},
SVector  iDirectionVector = {},
Number  iRadius 
)
slot

Extract the cylindrical region on the current polyhedron starting from a seed point.

Return values
Array.ErrorCodeThe error code:
  • 0 No error.
  • 1 An error occurred. In this case, results are not available.
Array.CylinderThe resulting best SCylinder
Array.StdDeviationThe standard deviation
Parameters
[in]iSeedPointSeed points around which the cylindrical region should be extracted.
[in]iToleranceExtract only the region that is inside the tolerance that is: only the vertices whose distance with the ideal cylinder is less than this threshold.
[in]iForceBit mask to know which parameter(s) is forced or initialized (initializing the computation provides a more rapid computation.
CYL_FORCE_RADIUS (Force & CYL_FORCE_RADIUS) Radius is forced
CYL_INIT_RADIUS (Force & CYL_INIT_RADIUS) Radius is initialized (near from its good value)
CYL_FORCE_CENTER (Force & CYL_FORCE_CENTER) Center is forced (an axis passing through Center should be found)
CYL_INIT_CENTER (Force & CYL_INIT_CENTER) Center is initialized (near from its good position)
CYL_FORCE_DIRECTION (Force & CYL_FORCE_DIRECTION) Direction is forced (DirectionVector exactly)
CYL_INIT_DIRECTION (Force & CYL_INIT_DIRECTION) Direction is approximately (DirectionVector nearly)
[in]iCenterFirst point of the center line.
[out]iDirectionVectorNormed Normal vector of the cylinder.
[in]iRadiusRadius of the cylinder to force

◆ ExtractFeatureLines

Array SPoly::ExtractFeatureLines ( Number  iSmoothingIntensity = 0.0)
slot

Extract all the feature lines on the mesh.

Return values
Array.ErrorCodeThe error code:
  • 0 No error.
  • 1 An error occurred.
  • 2 The current license does not the curvature computation.
Array.SetMultiTblA table of SSetMultiline containing successively the convex (item 0) and concave lines (item 1).
Parameters
[in]iSmoothingIntensityBetween 0 and 1, this parameter allows to limit smoothing intensity (0 = no smoothing)

◆ ExtractPlane

Array SPoly::ExtractPlane ( SPoint  iSeedPoint,
Number  iTolerance 
)
slot

Extract the planar region on the current cloud starting from seed point(s).

Return values
Array.ErrorCodeThe error code:
  • 0 No error.
  • 1 An error occurred. In this case, results are not available.
Array.PlaneThe resulting extracted SPlane
Array.StdDeviationThe standard deviation
Parameters
[in]iSeedPointSeed point around which the planar region should be extracted.
[in]iToleranceExtract only the region that is inside the tolerance that is: only the vertices whose distance with the ideal plane is less than this threshold.

◆ ExtractSphere

Array SPoly::ExtractSphere ( Array< SPoint iSeedPoint,
Number  iTolerance,
SphereEnum  iForce,
SPoint  Center = {},
Number  iRadius 
)
slot

Extract the spherical region on the current polyhedron starting from seed point(s).

Return values
Array.ErrorCodeThe error code:
  • 0 No error.
  • 1 An error occurred. In this case, results are not available.
Array.SphereThe resulting best SSphere
Array.StdDeviationThe standard deviation
Parameters
[in]iSeedPointSeed points around which the spherical region should be extracted.
[in]iToleranceExtract only the region that is inside the tolerance that is: only the vertices whose distance with the ideal sphere is less than this threshold.
[in]iForceBit mask to know which parameter(s) is forced
SPHERE_FORCE_RADIUS (Force & SPHERE_FORCE_RADIUS) Radius is forced
SPHERE_FORCE_CENTER (Force & SPHERE_FORCE_CENTER) Center is forced
[in]CenterThe center of the sphere to force
[in]iRadiusRadius of the sphere to force

◆ Extrusion

static Array SPoly::Extrusion ( SMultiline  iProfile,
SMultiline  iPath,
Boolean  iTurnWithPath,
Boolean  iPerpendicularToPath,
SMultiline  iSecondPath,
RotateEnum  iOption,
SPoint  iRotatePt 
)
staticslot

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

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyThe extruded SPoly.
Parameters
[in]iProfilea shape composed can be closed or not
[in]iPaththe path to follow, the path must have at minimum 2 points
[in]iTurnWithPathtrue : the shape turn with the path
[in]iPerpendicularToPathif the profile will be computed perpendicular to the path
[in]iSecondPaththe second path to follow, profile orientation will be attracted by this second path This option is not compatible with "TurnWithPath = false"
[in]iOptionHow the extrusion rotate point is compute ROTATE_CENTROID // Use centroid of the profile ROTATE_USER_DEFINE // You must defined your rotate point
[in]iRotatePtIf ROTATE_USER_DEFINE is used: the profile rotate point. Take a look on the picture below

◆ FillContours

Array SPoly::FillContours ( Array< SMultiline iContourTable,
Number  iTension = 0.732f,
Number  iWallThickness = -1,
Boolean  iIsForceNonSmoothShape 
)
slot

3D Hole filling. The function creates triangles on the edges of the holes to fill the concave parts.

Note
If the holes are small enough, the holes are completely filled.
See also
Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Array.MultiTblA table of contours not filled (empty if no error).
Parameters
[in]iContourTablea table of contours to process
[in]iTensionTension 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.
[in]iWallThicknesswall thickness to allow better filling of horseshoe holes going on two sides of a wall; -1 if no wall thickness.
iIsForceNonSmoothShapefill unconditionally even if the shape is not smooth and there is a risk to create an absurd shape

◆ FillHoles

Array SPoly::FillHoles ( Array< SPoint iPointTable,
Number  iTension,
Number  iWallThickness = -1 
)
slot

3D Hole filling. The function creates 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.
This class and corresponding methods require the LicenseModule::Edit License to be executed. Otherwise the call will fail.
See also
FillHolesDirection for 2D1/2 filling
Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Parameters
[in]iPointTablea table of points to identify each contour to process
[in]iTensionTension 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.
[in]iWallThicknesswall thickness to allow better filling of horseshoe holes going on two sides of a wall; -1 if no wall thickness.

◆ FillHolesDirection

Array SPoly::FillHolesDirection ( SVector  iDirection,
Array< SPoint iPointTable,
Number  iTension 
)
slot

To 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
FillHoles for 3D filling
Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Parameters
[in]iDirectionDirection defining the view of the hole. If nullptr, the Reshaper will approximate this direction.
[in]iPointTablea table of points to identify one of the points of each hole to fill. If empty, all the holes are treated.
[in]iTensionTension 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.

◆ FromClick

static Array SPoly::FromClick ( )
inlinestaticslot

Launches a click interaction to select a SComp in the scene.

Warning
This function will break the script, and wait for user interaction.
Return values
Array.ErrorCodeThe error code
  • 0: Success, the SComp is selected.
  • 1: Nothing is selected.
  • 2: The ESCape key has been pressed
Array.Polythe SPoly selected

◆ FromFile

static Array SPoly::FromFile ( String  iFileName)
staticslot

Function to import a mesh, and create a new SPolyhedron from a file. File extension authorized: .stl, .off, .msh, .ply, .obj, .poly, .pbi, .msd, .glb, .gltf

Warning
In Javascript, when you write strings the '\' character is an escape character, you need to use '\\' or '/' instead. Pay especially attention to this when writing file paths in your scripts. For example :
var res = SPoly.FromFile( 'C:/Poly.stl' ); // Valid syntax\n
var res2 = SPoly.FromFile( 'C:\\Poly.stl' ); // Valid syntax\n
var res3 = SPoly.FromFile( 'C:\Poly.stl' ); // Invalid syntax
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.StringA string character to notify some information about the file loading.
Array.PolyTblThe array of SPoly returned is sorted by number of triangles. The biggest polyhedron is the first.
Parameters
[in]iFileNameThe file name path

◆ FromName

static Array SPoly::FromName ( String  iName)
inlinestaticslot

Search all the component with the given name.

Return values
Arrayall the SPoly with the given name

◆ FromSel

static Array SPoly::FromSel ( )
staticslot

To get all the selected SComp.

Return values
Arrayall the SPoly selected

◆ Fusion

static Array SPoly::Fusion ( Array< SPoly iPolyTable,
FusionOptionEnum  iOption,
Number  iAccuracyPoint = 1.E-5,
Number  iAccuracyBorders = 0.001 
)
staticslot

Sew common edges of a SPoly list, or rebuild topology of existing Polyhedron(s).

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.
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyTblThe resulting fused SPoly table.
See also
Explode, MergeCommonBorders
Parameters
iPolyTableThe SPoly table to fusion.
[in]iOptionOption for the fusion
  • SIMPLE : Simple fusion without any modification.
  • REMESH : If parallel free contours 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 polyhedron
iAccuracyPointAccuracy beetween vertices (distance under which two points are considered identical); Most often 1.E-5
iAccuracyBordersAccuracy beetween parallel borders (distance under which two free borders are sewed)

◆ GetColorGradient

Array SPoly::GetColorGradient ( )
inlineslot

To get the color gradient of the SPoly.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 No color gradient associated to this SPoly
Array.Gradientthe SColorGradient associated to the current SPoly

◆ GetContours

Array SPoly::GetContours ( )
slot

Extract free contour(s) from the current SPoly.
Returns a table of SMultilines containing all the free edges of a SPoly.

Return values
Array.ErrorCodeThe error code:
  • 0 No error.
  • 1 An error occurred.
  • 2 The mesh doesn't have any free contour.
Array.MultiTblA 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

Array SPoly::GetHighestPoint ( SVector  iDirection)
slot

Get the highest point according to the Direction.

Return values
Array.ErrorCodeThe error code.
  • 0 Success: a point could be found along the direction
  • 1 Failed to find a point
Array.PointThe highest point found.
Parameters
[in]iDirectionDirection in which the highest point must be found.

◆ GetInertiaMatrix

Array SPoly::GetInertiaMatrix ( Boolean  iIsOnlyIfClosed)
slot

Calculates 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
GetVolume, GetSurface
Return values
Array.MatrixThe solid's inertia matrix
Array.VolumeThe solid's volume
Array.PointThe volume's centroid (center of mass or barycenter). We suppose that we have a uniform mass distribution throughout the volume.
Parameters
[in]iIsOnlyIfClosedShould 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.

◆ GetLowestPoint

Array SPoly::GetLowestPoint ( SVector  iDirection)
slot

Get the lowest point according to the Direction.

Return values
Array.ErrorCodeThe error code.
  • 0 Success: a point could be found along the direction
  • 1 Failed to find a point
Array.PointThe lowest point found.
Parameters
[in]iDirectionDirection in which the lowest point must be found.

◆ GetNbPieces

Number SPoly::GetNbPieces ( )
slot
Returns
The number of independent pieces inside the objects.

◆ GetNumberOfTextureMaps

Number SPoly::GetNumberOfTextureMaps ( )
slot

Returns the number of dynamic textures (texture maps) applied to the mesh.

See also
STexturingUtil.GetNumberOfTextureMaps()
Return values
Thenumber of textures
Deprecated:
This function is deprecated, use STexturingUtil.GetNumberOfTextureMaps() instead.

◆ GetNumberOfTextures

Array SPoly::GetNumberOfTextures ( )
slot

Returns the number of textures applied to the mesh.

See also
STexturingUtil.GetNumberOfTextures()
Return values
Array.ValueThe number of textures
Deprecated:
This function is deprecated, use STexturingUtil.GetNumberOfTextures() instead.

◆ GetSilhouette

Array SPoly::GetSilhouette ( SVector  iViewDirection,
Number  iDraftAngle,
Number  iMinClosedLine,
Number  iMinUnclosedLine,
Number  iResultType 
)
slot

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

Note
You must have the license LicenseModule::Contour to execute this function.
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.MultiTblA table of SMultiline with the silhouette, external contour of the SPoly.
Parameters
[in]iViewDirectionView direction.
[in]iDraftAngleDraft Angle in radian. If zero, the contour seen is output.
[in]iMinClosedLinedelete closed lines whose number of segment is less than this value.
[in]iMinUnclosedLinedelete unclosed lines whose number of segment is less than this value.
[in]iResultTypeResult type.
  • 0 : projected 2D result. Only available if DraftAngle is null
  • 1 : Recalculate 3D result to have the external contour without auto-intersection in the view direction.
  • 2 : exact 3D result

◆ GetSurface

Array SPoly::GetSurface ( )
slot

To retrieve the polyhedron's surface.

See also
GetVolume, GetInertiaMatrix
Return values
Array.SurfaceThe polyhedron's surface
Array.PointThe volume's centroid (center of mass or barycenter). We suppose that we have a uniform mass distribution throughout the volume.

◆ GetTextureName

Array SPoly::GetTextureName ( Number  iTextureIdx)
slot

Returns the original name of a dynamic texture (texture map) applied to the mesh.

See also
STexturingUtil.GetTextureName()
Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Array.StringThe original texture name
Deprecated:
This function is deprecated, use STexturingUtil.GetTextureName() instead.
Parameters
[in]iTextureIdxthe texture index

◆ GetTriangleSize

Array SPoly::GetTriangleSize ( )
slot

To retrieve the triangle size of current SPoly.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.MinimumThe minimum triangle size.
Array.MaximumThe maximum triangle size.

◆ GetTrianglesNumber

Number SPoly::GetTrianglesNumber ( )
slot
Return values
Thenumber of triangles.

◆ GetVolume

Array SPoly::GetVolume ( Boolean  iIsOnlyIfClosed)
slot

To retrieve the polyhedron's volume.

See also
GetSurface, GetInertiaMatrix, Cubature
Return values
Array.VolumeThe SPoly's volume :
  • >0 The normal is oriented outside
  • =0 The polyhedron is not closed
  • <0 The normal is oriented inside.
Array.PointThe volume's centroid (center of mass or barycenter). We suppose that we have a uniform mass distribution throughout the volume.
Parameters
[in]iIsOnlyIfClosedShould 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.

◆ ImproveBorders

Array SPoly::ImproveBorders ( Array< SSetMultiline iSetMultiTbl,
Number  iRemeshDistance,
Number  iCleaningDistance 
)
slot

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

Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 Some errors occurred, but some borders have been improved (partial result).
  • 1 An exception occurred.
Array.PolyThe resulting mesh.
Array.ErrorMessageA string containing the details of errors (when ErrorCode == 1).
Array.PointTblA list of points showing where the errors occurred.
Deprecated:
This function is deprecated, use SPoly.SetBorders() instead.
Parameters
iSetMultiTblThe input table of SSetMultiline borders Each set multilines can have:
  • 1 multiline: simple border
  • 2 multilines: trim border
  • 3 multilines: spline border with 3 points
  • 4 multilines: spline border with 4 points
iRemeshDistanceThe distance from the borders used for the remeshing
iCleaningDistanceCleaning distance around the border line

◆ InterInfLine

Array SPoly::InterInfLine ( SPoint  iPoint,
SVector  iVect 
)
slot

Calculates the intersection with an infinite line.

Return values
Array.ErrorCodethe error code
  • 0: no error
  • 1: an error occurred
Array.PointTblthe table in which will be stored the created points
See also
SPoly.Proj3D(), SPoly.ProjDir()
Parameters
[in]iPointA point on the infinite line
[in]iVectThe normalized vector of the infinite line direction

◆ Intersect

Array SPoly::Intersect ( SPoly  iPoly,
Number  iOption 
)
slot

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

Warning
The two SPoly must be closed
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
BooleanOperation, Algo::Boolean, Intersect.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.MultiTblA table with all intersection SMultilines.
Parameters
[in]iPolySecond object.
[in]iOptionDo we include tangent contacts ?
  • 0 No
  • 1 Yes else For internal purpose only

◆ JoinContour

static Array SPoly::JoinContour ( Array< SMultiline iMultiLines,
Array< SPoly iPolyhedrons,
Number  iTangency1,
Number  iTangency2,
Number  iTension = 0.732,
Boolean  iReorganize,
Number  iNbPoint 
)
staticslot

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

Note
Contours can be closed or opened.
This function requires to have the correct authorization code.
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyThe resulting SPoly
Parameters
[in]iMultiLinesThe two SMultilines defining the 2 contours to join.
[in]iPolyhedronsThe two SPolyhedron(s) which can be used to preserve tangency The length of this table can be 0 if no tangency with a polyhedron must be set The length of this table can be 1 if only the first SMultiline should preserve tangency with this SPolyhedron The length of this table can be 2 if both SMultiline should preserve tangency
[in]iTangency1Tangency option for the first multiline - NOT USED IF THE POLYHEDRON IS DEFINED (length of iPolyhedrons>=1)
  • 0: No tangency continuity
  • 1: Tangent to the best plane of iMultiLines[0] INSIDE (ONLY AVAILABLE WITH CLOSED POLYLINES).
  • 2: Tangent to the best plane of iMultiLines[0] OUTSIDE (ONLY AVAILABLE WITH CLOSED POLYLINES).
  • 3: Tangent perpendicular to the best plane of iMultiLines[0].
[in]iTangency2Tangency option for the second multiline - NOT USED IF THE POLYHEDRON IS DEFINED (length of iPolyhedrons==2)
  • 0: No tangency continuity
  • 1: Tangent to the best plane of iMultiLines[1] INSIDE (ONLY AVAILABLE WITH CLOSED POLYLINES).
  • 2: Tangent to the best plane of iMultiLines[1] OUTSIDE (ONLY AVAILABLE WITH CLOSED POLYLINES).
  • 3: Tangent perpendicular to the best plane of iMultiLines[1].
[in]iTensionTension 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.
[in]iReorganizeshould the mesh be reorganized to follow the local curvature.
[in]iNbPointNumber of points in the direction perpendicular to contours or holes
  • <4: The number of points is automatically calculated
  • >=4: Take a fixed number of points.

◆ LinearExtrusion

static Array SPoly::LinearExtrusion ( Number  iLength,
SVector  iDirection,
Boolean  iCloseExtremities,
Array< SComp iComps 
)
staticslot

Compute poly(s) corresponding to the extrusion of profile(s) -polyline, linear feature, linear CAD object- along a direction, with a given length.

Parameters
[in]iLengthThe length of the extrusion.
[in]iDirectionThe direction of the extrusion.
[in]iCloseExtremitiesTrue if extremities of the extruded comp have to be closed.
[in]iCompsAll the profiles to extrude.
Return values
Array.ErrorCodeThe generated error code:
  • 0 : no error occurred.
  • 1 : an error occurred.
  • 2 : invalid input parameters (either the direction or length are invalid, or none of the components in iShapes can be used as a valid profile).
Array.CompTblExtruded comps.

◆ LoadColorGradient

Array SPoly::LoadColorGradient ( String  iFilePath)
inlineslot

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

Warning
In Javascript, when you write strings the '\' character is an escape character, you need to use '\\' or '/' instead. Pay especially attention to this when writing file paths in your scripts. For example :
var res = TheGradient.Load( 'C:/Gradient.rsi' ); // Valid syntax\n
var res2 = TheGradient.Load( 'C:\\\\Gradient.rsi' ); // Valid syntax\n
var res3 = TheGradient.Load( 'C:\\Gradient.rsi' ); // Invalid syntax
Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 No color gradient associated to this SPoly
  • 2 An error occurred
Array.GradientThe color gradient associated to the current SPoly
Parameters
iFilePathThe complete file path to load from

◆ LocalizeValues

Array SPoly::LocalizeValues ( Array< Number >  iThresholdList)
slot

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

Return values
Array.ErrorCodeThe error code
  • 0 No error
  • 1 The mesh is not inspected
  • 2 An error occurred
Array.ResultsA table of result. Each result is a structure with the following members:
  • result.Comp (SComp) The point or the line
  • result.Label (SLabel) A label pointing on the point
  • result.Threshold (real) The threshold value associated
  • result.Surface (real) If > 0, the surface surrounding by the line (.Comp)
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);
}
);
static Array FromSel()
To get all the selected SComp.
Parameters
[in]iThresholdListList of threshold to extract

◆ MergeCommonBorders

static Array SPoly::MergeCommonBorders ( Array< SPoly iPolyTable,
FusionOptionEnum  iOption,
Number  iAccuracyPoint = 1.E-5,
Number  iAccuracyBorders = 0.001 
)
staticslot

Sew common edges of a SPoly list, or rebuild topology of existing Polyhedron(s).

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.
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyTblThe resulting fused SPoly table.
See also
Explode, Fusion
Parameters
iPolyTableThe SPoly table to fusion.
[in]iOptionOption for the fusion
  • SIMPLE : Simple fusion without any modification.
  • REMESH : If parallel free contours 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 polyhedron
iAccuracyPointAccuracy beetween vertices (distance under which two points are considered identical); Most often 1.E-5
iAccuracyBordersAccuracy beetween parallel borders (distance under which two free borders are sewed)

◆ MeshSegmentation

Array SPoly::MeshSegmentation ( Number  iAngleThreshold = 15.0,
Number  iMergeMaxDistance = 0.,
Number  iMinRegionArea = 0.,
Number  iClassificationMaxDistance = 0.,
SegmentationFeaturesEnum  iFeatures 
)
slot

Segment a mesh in several regions matching with geometric features (Plane, Sphere, Cylinder and Cone). 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.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred,
  • 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 features extraction mask
Array.PlaneTblAn array of all the SPlane detected in the Poly
Array.SphereTblAn array of all the SSphere detected in the Poly
Array.CylinderTblAn array of all the SCylinder detected in the Poly
Array.ConeTblAn array of all the SCone detected in the Poly
Array.PlanePolyTblAn array of all the independent SPoly detected as planes in the Poly (same length as PlaneTbl)
Array.SpherePolyTblAn array of all the independent SPoly detected spheres as in the Poly (same length as SphereTbl)
Array.CylinderPolyTblAn array of all the independent SPoly detected as cylinders in the Poly (same length as CylinderTbl)
Array.ConePolyTblAn array of all the independent SPoly detected as cones in the Poly (same length as ConeTbl)
Array.UndefinedPolyTblAn array of all the independent SPoly that are not detected as an independent geometrical shape
Parameters
[in]iAngleThresholdAngle threshold in degree used during the region creation step (15 degrees by default)
[in]iMergeMaxDistanceMaximum distance threshold used during the merging step. If this parameter is non-positive, the value will correspond to 5% of the largest object dimension.
[in]iMinRegionAreaMinimum area of regions to keep in the output. If 0, nothing will be removed.
[in]iClassificationMaxDistanceMaximum distance authorized to fit feature during classification. If negative, no classification will be performed.
[in]iFeaturesBit mask to tell which features must be extracted:
SEGMENTATION_PLANE (iFeatures & SEGMENTATION_PLANE) : extract planes
SEGMENTATION_SPHERE (iFeatures & SEGMENTATION_SPHERE) : extract spheres
SEGMENTATION_CONE (iFeatures & SEGMENTATION_CONE) : extract cones
SEGMENTATION_CYLINDER (iFeatures & SEGMENTATION_CYLINDER) : extract cylinders
SEGMENTATION_All (default) : extract all the features.

◆ New [1/2]

static SPoly SPoly::New ( )
staticslot

Default constructor to create an empty new SPoly.

◆ New [2/2]

static SPoly SPoly::New ( SPoly  iOther)
staticslot

Constructs an SPoly by copying the SPoly Other.

◆ Offset

Array SPoly::Offset ( Boolean  iIsDirect,
Number  iDistCoef,
OffsetEnum  iOptBitMask 
)
slot

Calculates and returns a new parallel polyhedron.

Note
This function can be used to make a constant parallel polyhedron. For example to add a thickness to a mesh of a part.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.PolyThe new parallel (or deformed) polyhedron.
Parameters
[in]iIsDirect1 to offset in the way of the normal, else 0.
[in]iDistCoefDistance or coefficient to apply
[in]iOptBitMaskBit mask option
  • 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. CAUTION: This option is designed to treat continuous shapes (C1 surfaces). The treatment of surfaces with many sharp edges will not work correctly.

◆ PipeTubeAlongPath

static Array SPoly::PipeTubeAlongPath ( Number  iRadius,
Boolean  iCloseExtremities,
Array< SComp iComps 
)
staticslot

Compute mesh(es) corresponding to the extrusion of a circle with a given radius along a given path.

Parameters
[in]iRadiusThe radius of the circle to extrude.
[in]iCloseExtremitiesTrue if extremities of the extruded comp have to be closed.
[in]iCompsAll the paths to follow.
Return values
Array.ErrorCodeThe generated error code:
  • 0 : no error occurred.
  • 1 : an error occurred.
  • 2 : invalid input parameters (either the radius is invalid, or none of the components in iComps can be used as a valid extrusion path).
Array.CompTblExtruded comps.

◆ ProfileAlongPath

static Array SPoly::ProfileAlongPath ( SComp  iProfile,
SComp  iPath,
Boolean  iMakePerpendicular,
Boolean  iTurnWthCurve,
Boolean  iUsePathToLeanOn,
Boolean  iStartAtProfilePosition,
Boolean  iCloseExtremities,
SComp  iPathToLeanOn 
)
staticslot

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

Note
You need a valid AEC license to access this feature.
Return values
Array.ErrorCodeThe generated error code:
  • 0 : no error occurred
  • 1 : bad iProfile or iPath type
  • 2 : bad iPathToLeanOn type
  • 3 : computation error
Array.CompExtruded comp
Parameters
[in]iProfilethe profile
[in]iPaththe path
[in]iMakePerpendiculartrue if the profile to extrude has to be perpendicular to the first vector of the path
[in]iTurnWthCurvetrue if the shape has to be oriented according to the curve all along the path
[in]iUsePathToLeanOntrue if a 2nd path -iPathToLeanOn- has to be used to determine the profile orientation
[in]iStartAtProfilePositiontrue if the extrusion has to begin at profile and not at path position
[in]iCloseExtremitiestrue if extremities of the extruded comp have to be closed
[in]iPathToLeanOnThe path to lean on, used only if iUsePathToLeanOn is true

◆ Proj3D [1/2]

Array SPoly::Proj3D ( SMultiline  iMultilineToProject,
Boolean  iHadIntermediatePt 
)
slot

Calculates the 3D projection of a SMultiline on an SPoly.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 At least one point or segment could not be projected and is missing (segment may be splited).
  • 2 An error occurred.
Array.MultiTblSeveral disconnected pieces can be found during the projection of a SMultiline on an SPoly. It is the reason why the result(s) is returned inside a table.
See also
SPoly.ProjDir()
Parameters
[in]iMultilineToProjectThe multiline to project.
iHadIntermediatePtShould we add intermediate points?
If true, intermediate points are added every time the line crosses a triangle edge.

◆ Proj3D [2/2]

Array SPoly::Proj3D ( SPoint  iPoint)
slot

Calculates the 3D projection of a point on an SPoly.
This function always returns the nearest point.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 No projection found.
  • 2 An error occurred.
Array.PointThe projected SPoint.
See also
SPoly.InterInfLine(), SPoly.ProjDir()
Parameters
[in]iPointThe point to project.

◆ ProjDir [1/2]

Array SPoly::ProjDir ( SMultiline  iMultilineToProject,
SVector  iDirection,
Boolean  iHadIntermediatePt,
Boolean  iIsSignedProjection 
)
slot

Calculates the projection of a SMultiline on an SPoly with a direction.

Note
If more than one point is found the nearest point from the origin of the vector is output.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 At least one point or segment could not be projected and is missing (segment may be splitted).
  • 2 An error occurred.
Array.MultiTblSeveral disconnected pieces can be found during the projection of a SMultiline on an SPoly. It is the reason why the result(s) is returned inside a table.
See also
SPoly.Proj3D
Parameters
[in]iMultilineToProjectThe multiline to project.
[in]iDirectionprojection direction
iHadIntermediatePtShould we add intermediate points?
If true, intermediate points are added every time the line crosses a triangle edge.
iIsSignedProjectionShould we search only in front of each point of current SMultiLine ?
if false, research is made in both direction.

◆ ProjDir [2/2]

Array SPoly::ProjDir ( SPoint  iPoint,
SVector  iDirection,
Boolean  iIsSignedProjection 
)
slot

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

Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 No projection found.
  • 2 An error occurred.
Array.PointThe projected SPoint.
See also
SPoly.InterInfLine(), SPoly.Proj3D
Parameters
[in]iPointThe point to project.
[in]iDirectionprojection direction
iIsSignedProjectionShould we search only in front of each point of current SPoint ?
if false, research is made in both direction.

◆ Reduce

Array SPoly::Reduce ( Number  iTargetNbVertex,
Number  iMinAngle 
)
slot

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

Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Array.NbVertThe number of suppressed vertices.
Parameters
[in]iTargetNbVertexnumber of vertices to keep inside the polyhedron.
iMinAngleAngle of the thinest triangle authorized to be created. This angle is in degrees.

◆ ReduceDeviation

Array SPoly::ReduceDeviation ( Number  iDeviationError,
DeviationOptionEnum  iCriteria,
Boolean  iIsKeepSharpEdge,
Number  iDeviationOnSharpEdges,
Number  iSharpEdgeAngleValue,
Number  iMaxEdgeLength,
Number  iDeviationOnBorders 
)
slot

Reduces the mesh by deleting some vertices and triangles according to a deviation error.

See also
Reduce
Return values
Array.ErrorCodeThe error code.
  • >0 : The number of vertices suppressed.
  • -1 : An error occurred.
Parameters
iDeviationErrorMaximum deviation error. All vertices of the mesh before the reduction must have a distance lower than this value with the mesh after reduction.
[in]iCriteriaOption bit mask :
  • KEEP_EQUI (Criteria & KEEP_EQUI) Re-mesh locally to preserve equilateral triangles if it is possible.
  • BEST_POS (Criteria & BEST_POS) Allows to move the point to another position in order to keep the mesh aspect (create new vertices).
  • ON_BORDERS (Criteria & ON_BORDERS) Allows to also reduce the free borders (will reduce free borders size and can result in filling some small holes).
iIsKeepSharpEdgeif false there is no restriction on sharp edges else if true DeviationOnSharpEdges and SharpEdgeAngleValue must be defined
[in]iDeviationOnSharpEdgesif KeepSharpEdge, 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
[in]iSharpEdgeAngleValueif KeepSharpEdge, Angle in degrees between two neighbor triangles to consider that we are on a sharp edge.
iMaxEdgeLengthIf 0, there is no control on the length of edges
[in]iDeviationOnBordersif ON_BORDERS is used, Deviation Value authorized on borders. If 0, use the deviation error.

◆ RemeshRefineDev

Array SPoly::RemeshRefineDev ( Number  iDeviation,
Number  iSizeMin,
Number  iMaxiTriNumber,
BordersEnum  iBorderOption,
Number  iDistanceWrongPoints,
Number  iReorganize,
SCloud  iCloud,
Number  iMaxCosAngle = -1 
)
slot

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

Note
The main difference between Tolerance3DMesh and 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 point 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 better result with RemeshRefineDev. If your point cloud is very accurate or sparse, you should obtain better result with Tolerance3DMesh.
Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.PolyThe resulting refined mesh
Parameters
[in]iDeviationTolerance to respect (deviation error)
[in]iSizeMinMinimum size of triangles. It is not authorized to create new triangles with a size below this value.
[in]iMaxiTriNumberMaximum number of triangle in the polyhedron to return. Note that the input polyhedron is not reduced if its number of triangles is already bigger when calling this function.
[in]iBorderOptionWhat 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.
[in]iDistanceWrongPointsIf a point of the cloud has a distance to the PolyToUpgrade 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.
[in]iReorganize[in] 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.
[in]iCloudThe cloud of points, which should be fitted on the new mesh or 0 if none
[in]iMaxCosAngleMax cosine value for the angle between the triangle and the scanning direction. If 0 <= 'MaxCosAngle' < 1 AND if 'TheCloud' have scanning direction information, then the triangles are attracted only by points whose have scanning direction which make an angle with triangle's normal less 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).

◆ RemeshSharpEdge

Array SPoly::RemeshSharpEdge ( Array< SMultiline iLines,
SPoint  iReferencePoint 
)
slot

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

Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Array.PolyThe resulting mesh.
Parameters
[in]iLinesTable of polylines representing the sharp edges(s) to recreate.
[in]iReferencePointThe reference point which indicates the part of the mesh, whose distance is lower than this value, is authorized to move.

◆ RemoveSpikes

Array SPoly::RemoveSpikes ( Number  iLoopNumber,
Number  iPropag = -1,
Number  iIntensity,
Boolean  iIsRecalculateBorder 
)
slot

This function will suppress or correct absurd points (ie spikes) of the current SPoly.

Return values
Array.ErrorCodeThe error code:
  • 0 No error.
  • 1 An error occurred.
Array.NbVertThe number of suppressed vertices is returned.
Parameters
[in]iLoopNumberNumber of loops (iteration of the treatment)
[in]iPropagNeighbor level propagation of the treatment
  • -1 or negative value mean no limit This functionality allows to detect a point that become spike after having suppressed his neighbor.
[in]iIntensitySuppression 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.
[in]iIsRecalculateBorderAllow to also modify free borders

◆ RemoveTexture

Array SPoly::RemoveTexture ( )
slot

Removes all textures applied on the current mesh.

See also
STexturingUtil.RemoveTexture()
Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 The mesh does not have any texture to remove.
Array.ValueThe number of textures removed.
Deprecated:
This function is deprecated, use STexturingUtil.RemoveTexture() instead.

◆ RemoveTrianglesOnHoles

Array SPoly::RemoveTrianglesOnHoles ( SCloud  iCloud,
Number  iHoleSize,
Number  iMaxDistToCloud = -1,
Number  iMaxAngle = -1 
)
slot

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

A triangle is considered to be over a hole if it's possible to find a point on the triangle which can be the center of a sphere of diameter iHoleSize in which there is no point from the cloud.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred
  • 1 An error occurred
Parameters
[in]iCloudThe cloud with the corresponding points
[in]iHoleSizeThe minimal size of a hole (diameter)
[in]iMaxDistToCloudIf 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.
[in]iMaxAngleIf positive, 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.

◆ Save

Array SPoly::Save ( String  iFilePath,
Boolean  iIsTextExport,
SMatrix  iCoordinateSystemMatrix = {} 
)
slot

Saves the mesh into a file.

Supported extensions :

  • .stl : STL (binary or text format)
  • .pbi : Binary PBI
  • .poly : Ascii POLY
  • .asc : Vertices only (Ascii)
  • .obj : OBJ
  • .stp : STEP
  • .msh : Ascii Leica format
  • .ply : PLY (binary or text format)
  • .msd : MSD
  • .glb : GLB
Warning
In Javascript, when you write strings the '\' character is an escape character, you need to use '\\' or '/' instead. Pay especially attention to this when writing file paths in your scripts. For example :
var res = ThePoly.Save( 'C:/Poly.stl' ); // Valid syntax\n
var res2 = ThePoly.Save( 'C:\\Poly.stl' ); // Valid syntax\n
var res3 = ThePoly.Save( 'C:\Poly.stl' ); // Invalid syntax
Return values
Array.ErrorCodeThe error code.
  • 0 : No error.
  • 1 : An error occured.
Array.IsDemoVersionIndicates if this is a demonstration version or not
Parameters
iFilePathThe complete file path to save into
iIsTextExportShould the mesh be exported as text or binary data ?
  • true : Text
  • false : Binary
iCoordinateSystemMatrixthe matrix to define a UCS used for the export (or identity to use the WCS)

◆ SaveColorGradient

Array SPoly::SaveColorGradient ( String  iFilePath)
inlineslot

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

Warning
In Javascript, when you write strings the '\' character is an escape character, you need to use '\\' or '/' instead. Pay especially attention to this when writing file paths in your scripts. For example :
var res = TheGradient.Save( 'C:/Gradient.rsi' ); // Valid syntax\n
var res2 = TheGradient.Save( 'C:\\\\Gradient.rsi' ); // Valid syntax\n
var res3 = TheGradient.Save( 'C:\\Gradient.rsi' ); // Invalid syntax
Return values
Array.ErrorCodeThe error code.
  • 0 OK, no error
  • 1 No color gradient associated to this SPoly
  • 2 An error occurred
Array.IsDemoVersionIndicates if this is a demonstration version or not
Parameters
iFilePathThe complete file path to save into

◆ SaveFBX

static Number SPoly::SaveFBX ( String  FilePath,
Array< SPoly MeshesToExport,
Boolean  IsExportTexture,
EExportVertexColor  ExportVertexColor,
SMatrix  CoordinateSystemMatrix = {} 
)
staticslot

Saves the meshes into a FBX file.

Warning
In Javascript, when you write strings the '\' character is an escape character, you need to use '\\' or '/' instead. Pay especially attention to this when writing file paths in your scripts. For example:
var res = ThePoly.Save( 'C:/Poly.fbx' ); // Valid syntax\n
var res2 = ThePoly.Save( 'C:\\Poly.fbx' ); // Valid syntax\n
var res3 = ThePoly.Save( 'C:\Poly.fbx' ); // Invalid syntax
Return values
Theerror code:
  • 0 No error occurred.
  • 1 An error occurred.
  • 2 Some of the exported meshes don't have the chosen texture or color information.
Parameters
[in]FilePathThe complete file path to save into
[in]MeshesToExportList of meshes to export
[in]IsExportTextureShould the texture be exported ?
[in]ExportVertexColorColor information to export
[in]CoordinateSystemMatrixThe matrix to define a UCS used for the export (or identity to use the WCS)

◆ SectionCylindric

Array SPoly::SectionCylindric ( SPoint  iFirstPointOnAxis,
SPoint  iSecondPointOnAxis,
SPoint  iPointOnTheFirstCylinder,
Number  iNumberOfCylinders,
Number  iDistanceBeetweenCylinders 
)
slot

Intersection of a Polyhedron by parallel cylinders.

See also
SectionPlane(), SectionRadial()
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.MultiTblAn Array of SMultiline, cylindrical sections of the SPoly
If no sections are available returns an empty Array
Parameters
[in]iFirstPointOnAxisfirst point determining axis
[in]iSecondPointOnAxissecond point determining axis
[in]iPointOnTheFirstCylinderpoint on the first cylinder
iNumberOfCylindersif > 0 the sections are done only in the way of the vector. If < 0, an infinity of parallel planes is assumed.
[in]iDistanceBeetweenCylindersdistance between cylinders

◆ SectionOnMulti

Array SPoly::SectionOnMulti ( SMultiline  iMultiLine,
Array< Number >  iListDist,
Number  iMaxDist,
Number  iOptBitMask 
)
slot

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.

Return values
Array.ErrorCodeThe error code:
  • 0 OK, 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 First value of ListDist is too big, no section are returned
  • 3 The SMultiline is not correct, impossible to compute the normal plane on a point
  • 4 Parameters are not correct
  • 5 An exception occurred.
Array.SetMultiTblThe sections computed. A SetMultiline table.
Parameters
[in]iMultiLineThe reference SMultiline. The sections will be computed along this SMultiline with perpendicular planes.
[in]iListDistthe list of curvilinear distances. In this case, we will compute as many sections as ListDist.length. If Dist is not null, ListDist is the offset from the first point.
[in]iMaxDistThe 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.
[in]iOptBitMaskBit mask option
  • Bit 0: If 1, do not interpolate the tangents on polyline segments (the tangent to a segment will be its direction)

◆ SectionOnMultiReg

Array SPoly::SectionOnMultiReg ( SMultiline  iMultiLine,
Number  iDist,
Number  iMaxDist,
Number  iOptBitMask 
)
slot

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 distance.

Return values
Array.ErrorCodeThe error code:
  • 0 OK, 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 too big, no section are returned
  • 3 The SMultiline is not correct, impossible to compute the normal plane on a point
  • 4 Parameters are not correct
  • 5 An exception occurred.
Array.SetMultiTblThe sections computed. A SetMultiline table.
Parameters
[in]iMultiLineThe reference SMultiline. The sections will be computed along this SMultiline with perpendicular planes.
[in]iDistthe curvilinear and regular distance between two sections.
[in]iMaxDistThe 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.
[in]iOptBitMaskBit mask option
  • Bit 0: If 1, do not interpolate the tangents on polyline segments (the tangent to a segment will be its direction)

◆ SectionPlane

Array SPoly::SectionPlane ( SVector  iPlaneNormal,
SPoint  iPtFirstPlane,
Number  iNbPlanes,
Number  iDistance 
)
slot

Intersection between an SPoly and a parallel plane.

See also
SectionCylindric(), SectionRadial()
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.MultiTblAn Array of SMultiline, planar sections of the SPoly
If no sections are available returns an empty Array
Parameters
[in]iPlaneNormalNormal vector to the plane
[in]iPtFirstPlanePoint on the first plane
[in]iNbPlanesParallel planes number
  • If > 0 the sections are done only in the vector's direction.
  • If < 0, an infinity of parallel planes is assumed.
[in]iDistanceDistance between planes

◆ SectionRadial

Array SPoly::SectionRadial ( SPoint  iFirstPointOnAxis,
SPoint  iSecondPointOnAxis,
SPoint  iPtFirstPlane,
Number  iNbSections,
Number  iMaxAngleInRadian 
)
slot

Intersection of a Polyhedron by radial planes.

See also
SectionCylindric(), SectionPlane()
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.MultiTblAn Array of SMultiline, radial sections of the SPoly
If no sections are available returns an empty Array
Parameters
[in]iFirstPointOnAxisFirst point on axis
[in]iSecondPointOnAxisSecond point on axis
[in]iPtFirstPlanePoint on first plane or 0 if indifferent
[in]iNbSectionsnumber of sections within the MaxAngleInRadian.
[in]iMaxAngleInRadianMax angle in radian 2*PI means complete circle.

◆ SeparateTriangleBox

Array SPoly::SeparateTriangleBox ( SPoint  iLowerPoint,
SPoint  iUpperPoint,
SeparateTriBoxEnum  iSelType,
SeparateTriBoxSelectEnum  iWhichPartToKeep 
)
slot

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

Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 No triangles has been selected.
  • 2 An error occurred.
Array.PolyThe mesh or compound mesh containing the triangles removed by the operation.
Parameters
[in]iLowerPointLower point of the box
[in]iUpperPointUpper point of the box
[in]iSelTypeOption for the selection
[in]iWhichPartToKeepOption to know which part has to be kept.

◆ SeparateTriangleInPrism

Array SPoly::SeparateTriangleInPrism ( SMultiline  iProfil,
Number  iDistance,
SeparateTriBoxEnum  iSelType,
SeparateTriBoxSelectEnum  iWhichPartToKeep 
)
slot

Separate triangles of a mesh according to a prism. Depending of iWhichPartToKeep, the current poly 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 by iDistance/2.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 No triangles has been selected.
  • 2 An error occurred.
Array.PolyThe mesh or compound mesh containing the triangles removed by the operation.
Array.TopContourThe multiline representing the top contour of the prism calculated from iProfil.
Array.BottomContourThe multiline representing the bottom contour of the prism calculated from iProfil.
Array.ConvexHullThe multiline representing the convex hull contour of the prism calculated from iProfil for debug purpose.
Parameters
[in]iProfilthe base Multiline of the prism (median plane)
[in]iDistancethe distance between the two main faces of the prism
[in]iSelTypeOption for the selection
[in]iWhichPartToKeepOption to know which part has to be kept.

◆ SeparateTriangleSize

Array SPoly::SeparateTriangleSize ( Number  iSmallestSize,
Number  iBiggestSize 
)
slot

Separate a mesh into parts according to the triangle size.

Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 An error occurred.
Array.PolySmallTriangleThe mesh or compound mesh with the small triangles.
Array.PolyThe mesh or compound mesh without small and big triangles.
Array.PolyBigTriangleThe mesh or compound mesh with the big triangles.
See also
GetTriangleSize
Parameters
[in]iSmallestSizeminimum size of triangle
[in]iBiggestSizemaximum size of triangle

◆ SeparateTriangleWithActivatedClippingPlanes

Array SPoly::SeparateTriangleWithActivatedClippingPlanes ( Array< SClippingPlane iClippingPlanes,
SeparateTriBoxEnum  iSelType 
)
slot

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

Return values
Array.ErrorCodeThe error code.
  • 0 OK, No error.
  • 1 No triangles has been selected.
  • 2 An error occurred.
  • 3 no clipping plane was activated so nothing was done
Array.PolyThe mesh or compound mesh containing the triangles removed by the operation.
Parameters
[in]iClippingPlanesthe base Multiline of the prism (median plane)
[in]iSelTypeOption for the selection

◆ SetBorders

Array SPoly::SetBorders ( Array< SMultiline iMultiTbl,
Number  iRemeshDistance 
)
slot

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

Return values
Array.ErrorCodeThe error code.
  • 0 No error.

    ‍0 The number of regions (part of border line) that couldn't be filled.

Array.PolyThe resulting mesh.
Parameters
iMultiTblThe input table of SMultiline borders
iRemeshDistanceThe distance from the borders used for the remeshing

◆ SetPolyRepresentation

SPoly::SetPolyRepresentation ( PolyRepresentationTypeEnum  Representation)
slot

The representation of the component is modified.

Parameters
[in]RepresentationThe polyhedron representation type

◆ Smooth

Array SPoly::Smooth ( Number  iLoopNumber,
SmoothEnum  iOptionMask,
Number  iMaxiDeviation,
Boolean  iIsReorganise,
Number  iMinAngleReorg,
Number  iRefineDistProj = -1.0,
Number  iRefineVrtxAngle = -1.0,
Number  iAngleSharpEdge = -1.0,
Number  iNbTriMax = -1 
)
slot

Smooth the surface of the current SPoly.

Note
This function can reorganize, and (or) recalculate vertices and (or) subdivide triangles.
You can also refine the poly with Refine parameters.
Warning
If an error occurred during execution, the script will be stopped
Return values
Array.ErrorCodeThe error code.
  • 0 No error
  • 1 Parameter(s) are not valid
  • 2 An exception occurred the execution
Parameters
[in]iLoopNumberThe Number of loop of the smoothing calculation. This parameter will determine the smoothing intensity. If zero, the vertices will not move at all.
[in]iOptionMaskOption bit mask
  • bit 0 (0x01): 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.
  • bit 1 (0x02): This bit determines 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).
  • bit 2 (0x04): 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)
  • bit 3 (0x08): This bit determines if free borders can move (1) or if free borders must stay immobile (0) to make fusion after with another mesh
[in]iMaxiDeviationMaximum 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 bit mask.
iIsReorganiseIf true the function Reorganise is called at each loop.
iMinAngleReorgangle of the thinest triangle authorized to be created if a reorganization is ordered between all the smoothing loops a good value is
  • 10 degrees.
    Angle is in degrees
[in]iRefineDistProjRefinement parameters or nullptr 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.
iRefineVrtxAngleIf >0, new vertices are added when the angle between 2 neighbour vertices is over this value (in degrees)
iAngleSharpEdgeIf >0, over this value (in degrees) an angle between triangles is considered as a sharp edge without relevant complex surface
[in]iNbTriMaxif 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

◆ SmoothBorders

Array SPoly::SmoothBorders ( Array< SPoint iPointTable,
Number  iMaxEdgeLength 
)
slot

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

Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Parameters
[in]iPointTablea table of points to identify each contour to process
[in]iMaxEdgeLengththe maximum length of the edges to generate <=0: no limit

◆ SphericalMesh

static Array SPoly::SphericalMesh ( Array< SCloud iCloudOfPoints,
SPoint  iScanPos,
Number  iRegularSampling,
Number  iDeviationErr,
Number  iMaxiNbTriangle,
Number  iAlphaShapeThreshold,
Number  iMaxSizeThreshold,
Number  iMinSizeThreshold,
Number  iDeleteSmall 
)
staticslot

Makes a spherical 3D mesh from point cloud(s)

Note
Return values
Array.PolyTblThis function returns a table of polyhedrons (1 per scanning position or 1 per input clouds if no scanning position containing in clouds)
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Parameters
[in]iCloudOfPointsThe table of clouds to mesh
[in]iScanPosScanning position If, find scan positions in cloud informations. If none, retrieve the centroid of the global cloud as scanning position
[in]iRegularSamplingFirst filter to make a noise reduction taking in the cloud only points evenly spaced
  • =0: No noise reduction, Keeping all points.
  • >0: Mini 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
[in]iDeviationErrSecond 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.
[in]iMaxiNbTriangleMaxi number of triangles in the resulting mesh
[in]iAlphaShapeThresholdParameter for the algorithm of contour detection to delete the triangles that are not part of the surface Recommended value is -3.
  • if Alpha>0 All the triangles having an radius passing thought the 3 points greater than Alpha are deleted.
  • if -1<= Alpha <0 the system will take a default value of -3 that is suitable in most cases.
  • if Alpha==0 This filter will be disabled.
  • if Alpha<-1 Triangle are deleted according to the local vertex density. A high value (near to -1) will detect many jagged contour while a high value will result in smoother contours or no contour detection at all if the value is too small
[in]iMaxSizeThresholdAlways delete triangles having a size greater than this value. If <=0, this filter will be disabled.
[in]iMinSizeThresholdNever delete triangles having a size less than this value. If <=0, this filter will be disabled.
[in]iDeleteSmallDuring 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::GetNumberOfPieces and you can also retrieve each individual piece with the function SPoly::Explode

◆ StitchOverlap

Array SPoly::StitchOverlap ( SPoly  iMeshToStitch,
Number  iTolDist,
StitchOverlapEnum  iOptions 
)
slot

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(
                      meshToStitch,0.56,
                      SPoly.STITCHOVERLAP_MAKE_SEWING_ZONE_INVISIBLE + SPoly.STITCHOVERLAP_MODIFY_OVERLAP_IN_MIDDLE_ZONE);
    
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Parameters
[in]iMeshToStitchthe mesh to stitch
[in]iTolDistTolerance. The zones to merge must overlap with a distance lower than this value.
[in]iOptionsa combination of SPoly.STITCHOVERLAP_... flags

◆ SubdivideTriangles

Array SPoly::SubdivideTriangles ( Number  iMaxEdgeLength,
Boolean  iIgnoreFreeEdges,
Number  iLimitCos = 0.,
Boolean  iPreserveGeometry 
)
slot

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.
Return values
Array.ErrorCode
  • 0 No error occurred.
  • 1 An error occurred.
Polysubdivided Mesh.
Parameters
[in]iMaxEdgeLengthMaximum allowed edge length.
[in]iIgnoreFreeEdgesIf true does not split free nor selection boundary edges. By default these edges can be split.
[in]iLimitCosLimit cosines for remeshing.
[in]iPreserveGeometryIf true, forces the resulting mesh to fit exactly to the original surface (slower).

◆ TakeColorFromClouds

Array SPoly::TakeColorFromClouds ( Array< SCloud iCloudsTbl,
Number  iIgnoreOver,
Number  iResetColor,
Number  iDefaultRed,
Number  iDefaultGreen,
Number  iDefaultBlue 
)
slot

Uses the color (or the color of inspection) of point clouds to color the vertices on the current mesh.

Note
For each vertex of the current mesh the color of the nearest point is used
If the expected colors are the inspection's colors, you need first to convert the inspection colors to 'simple' colors with the function SCloud.ConvertInspectionToColor() on each cloud
See also
STexturingUtil.TextureFromClouds to compute a textured mesh, STexturingUtil.TakeColorFromClouds()
Return values
Array.ErrorCodeThe error code.
  • 0 No error
  • 1 Warning, some of the point clouds have no color
  • 2 Error, an exception occurred.
Array.PolyThe colored mesh.
Deprecated:
This function is deprecated, use STexturingUtil.TakeColorFromClouds() instead.
Parameters
[in]iCloudsTblTable of clouds containing the colors. Each of the cloud must have a colored information, else the cloud is not taken into account
[in]iIgnoreOverIf a point of the cloud has a distance to the current mesh greater than this value, it is ignored. The color of a point moves to a vertex only if the distance to the mesh is less than this value. If this value is zero or less, takes 1% of the mesh size.
[in]iResetColorWhen should we use the default color ?
  • 0 Do not reset previous color. DefaultRGB is used only if no color is associated with the vertex.
  • 1 Previous color (if any) is reseted with the default color if no point of the cloud can be used to define a new color.
[in]iDefaultRedRed color between [0-1] to be used for the non colored vertices
[in]iDefaultGreenGreen color between [0-1] to be used for the non colored vertices
[in]iDefaultBlueBlue color between [0-1] to be used for the non colored vertices

◆ TextureAddRepetitive

Array SPoly::TextureAddRepetitive ( String  iFilePathName,
Number  iNbRepWidth,
Number  iNbRepHeight,
SVector  iDirXScreen,
SVector  iDirYScreen,
SPoint  iImageOrigin 
)
slot

Adds repetitive texture to a mesh.

See also
STexturingUtil.TextureAddRepetitive()
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyThe mesh with the repetitive texture
Deprecated:
This function is deprecated, use STexturingUtil.TextureAddRepetitive() instead.
Parameters
[in]iFilePathNamePath to the texture
[in]iNbRepWidthNumber of repetition in width of the screen
[in]iNbRepHeightNumber of repetition in height of the screen
[in]iDirXScreenDirection X of the projection plane
[in]iDirYScreenDirection Y of the projection plane
[in]iImageOriginOrigin of the image

◆ Tolerance3DMesh

Array SPoly::Tolerance3DMesh ( SCloud  iCloud,
Number  iDeviation,
Number  iDistanceWrongPoints,
Number  iSizeTriMax,
Boolean  iIsReorganize,
Number  iExtension,
Boolean  iIsNoiseReduct 
)
slot

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 (that ie the cloud is not really a surface) the command can throw exceptions.
The main difference between Tolerance3DMesh and 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 point 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 better result with RemeshRefineDev. If your point cloud is very accurate or sparse, you should obtain better result with Tolerance3DMesh.
See also
RemeshRefineDev, Direct3DMesh
Return values
Array.ErrorCodeThe error code:
  • 0 No error.
  • 1 An error occurred.
Parameters
[in]iCloudThe cloud of points to mesh
[in]iDeviationTolerance to respect (deviation error)
[in]iDistanceWrongPointsIf a point of the cloud has a distance to the PolyToUpgrade over this value, it is considered as wrong (aberrant) and the point is rejected.
[in]iSizeTriMaxMaxi triangle size for triangle created on frees contours, if an extension of the existing polyhedron is requested.
[in]iIsReorganizeIf one, try to reorganise locally sharp edges or small radii.
[in]iExtensionWhat must be done on free borders If not null, 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.
[in]iIsNoiseReductShould 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.

◆ toString [1/2]

String SPoly::toString ( )
slot

Get the type of the variable.

◆ toString [2/2]

static String SPoly::toString ( )
staticslot

Get the type of the variable.

◆ VolumeFromElevation

Array SPoly::VolumeFromElevation ( Array< Number >  iElevations,
SVector  iProjDir = { 0., 0., 1. } 
)
slot

Calculate the Polyhedron volume above and below the given elevation.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred
  • 1 An error occurred
Array.ValueTblArray of structured value:

Array.ValueTbl: [ { VolumeUnder: number, Contains the volume below the plane at the n-th elevation VolumeOver: number // Contains the volume above the plane at the n-th elevation } ]

Parameters
[in]iElevationsThe list of elevations
[in]iProjDirNormal direction of the planes

◆ WriteOnMesh

Array SPoly::WriteOnMesh ( String  iTextToWrite,
SVector  iTextNormal,
SVector  iTextHorizontalNormal,
SPoint  iTextPosition,
Number  iTextDepth,
Number  iPlaneDepth,
Number  iScale,
String  iFont = "Arial",
Boolean  isBold,
Boolean  isItalic,
Number  iWritingStyle 
)
slot

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

Return values
Array.ErrorCodeThe error code:
  • 0 No error.
  • 1 An error occurred.
Parameters
[in]iTextToWritethe text to write
[in]iTextNormalthe normal direction of the text
[in]iTextHorizontalNormalthe direction of the writing
iTextPositiontop left corner of the displayed text
[in]iTextDepthdepth of the engraved text
[in]iPlaneDepthif>0, Choose to write your text on a plane added to the mesh. By default the text is writing on the mesh directly
iScalethe scale of the text : choose between 0 and 1
[in]iFontthe font of the text. "Arial" by default
[in]isBoldBold . By default , the text isn't bold
[in]isItalicItalic . By default the text isn't italic
[in]iWritingStylethe engraving mode: hollow (0) or embossed (1). Embossed by default