Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2021.
SPoly Class Reference

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

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  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 VisCrit)
 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 Poly)
 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 Poly)
 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 Poly, Boolean CutPoly)
 To make a boolean operation between two SPoly. More...
 
Array BooleanSub (SPoly Poly)
 To make a boolean subtraction with the current object. More...
 
 Clear ()
 To deallocate memory of the object. More...
 
static Array ColorAlongDir (Array< SPoly > Meshes, SVector DirectionVect, SPoint iOrigin={})
 Color the mesh along a direction with a gradient. More...
 
Array Compare (SCloud iMeasCloud, Number DistMax, Number MappingObject, Boolean IgnoreEdge, SVector Direction, Number maxCosAngle=-2, Boolean checkForThinParts)
 Calculates the distances between 2 components for further inspection purpose (color mapping) More...
 
Array Compare (SPoly iMeasPoly, Number DistMax, Number MappingObject, Boolean IgnoreEdge, SVector Direction, Number MaxCosAngle=0., Boolean CheckThinParts)
 Calculates the distances between 2 components for further inspection purpose (color mapping) More...
 
static Array ConstraintMesh2D (SCloud CloudOfPoints, Array< SMultiline > SetOfMultilines, SVector MeshDir, Number Tolerance, Number ZoneType)
 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 CloudOfPoints, Array< SMultiline > SetOfMultilines, Number Tolerance, Number ZoneType)
 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 ExportSuspiciousTriangles=false)
 
static Array CreateCompound (Array< SPoly > TablePoly, Boolean OptOrient)
 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 DeviationError, Number MiniAverageDist, HoleOptionEnum OptionHole, Number SizeTriHole, Boolean iIgnoreScanDir)
 Makes a direct 3D mesh of a point cloud according different strategies (regular, deviation, etc.). More...
 
static Array DirectionMesh (SCloud iCloudOfPoints, SVector MeshingDirection, Number Tolerance, Boolean FindCntr)
 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 > SeedPoint, Number Tolerance, CylinderEnum Force, SPoint iCenter={}, SVector DirectionVector={}, Number Radius)
 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 Tolerance)
 Extract the planar region on the current cloud starting from seed point(s). More...
 
Array ExtractSphere (Array< SPoint > SeedPoint, Number Tolerance, SphereEnum Force, SPoint Center={}, Number Radius)
 Extract the spherical region on the current polyhedron starting from seed point(s). More...
 
static Array Extrusion (SMultiline iProfile, SMultiline iPath, Boolean TurnWithPath, Boolean PerpendicularToPath, SMultiline SecondPath, RotateEnum Option, SPoint RotatePt)
 Create a mesh from a path and a profile, the profile is extracted along the path. More...
 
Array FillContours (Array< SMultiline > ContourTable, Number Tension=0.732f, Number WallThickness=-1, Boolean ForceNonSmoothShape)
 3D Hole filling. The function creates triangles on the edges of the holes to fill the concave parts. More...
 
Array FillHoles (Array< SPoint > PointTable, Number Tension, Number WallThickness=-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 Direction, Array< SPoint > PointTable, Number Tension)
 To fill the holes that have at least one point listed in the table of points. More...
 
static Array FromClick ()
 Displays a dialog box to select an SComp in the scene. More...
 
static Array FromFile (String FileName)
 
static Array FromName (String Name)
 Search all the component with the given name. More...
 
static Array FromSel ()
 To get all the selected SComp. More...
 
static Array Fusion (Array< SPoly > PolyTable, FusionOptionEnum Option, Number AccuracyPoint=1.E-5, Number AccuracyBorders=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 Direction)
 Get the highest point according to the Direction. More...
 
Array GetInertiaMatrix (Boolean OnlyIfClosed)
 Calculates the solid's inertia matrix. More...
 
Array GetLowestPoint (SVector iDirection)
 Get the lowest point according to the Direction. More...
 
Number GetNbPieces ()
 
Number GetNumberOfTextureMaps ()
 Return the number of dynamic textures (texture maps) applied to the polyhedron. More...
 
Array GetNumberOfTextures ()
 Return the number of textures applied to the polyhedron. More...
 
Array GetSilhouette (SVector ViewDirection, Number DraftAngle, Number MinClosedLine, Number MinUnclosedLine, Number ResultType)
 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 TextureIdx)
 Return the original name of a dynamic texture (texture map) applied to the polyhedron. More...
 
Array GetTriangleSize ()
 To retrieve the triangle size of current SPoly. More...
 
Number GetTrianglesNumber ()
 
Array GetVolume (Boolean OnlyIfClosed)
 To retrieve the polyhedron's volume. More...
 
Array ImproveBorders (Array< SSetMultiline > SetMultiTbl, Number RemeshDistance, Number CleaningDistance)
 Create a new SPoly by updating the input one in order to make it fit the input border. More...
 
Array InterInfLine (SPoint iPoint, SVector Vect)
 Calculates the intersection with an infinite line. More...
 
Array Intersect (SPoly iPoly, Number Option)
 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 FilePath)
 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 > PolyTable, FusionOptionEnum Option, Number AccuracyPoint=1.E-5, Number AccuracyBorders=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 Direct, Number DistCoef, OffsetEnum OptBitMask)
 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 HadIntermediatePt)
 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 Direction, Boolean HadIntermediatePt, Boolean iSignedProjection)
 Calculates the projection of a SMultiline on an SPoly with a direction. More...
 
Array ProjDir (SPoint iPoint, SVector Direction, Boolean iSignedProjection)
 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 TargetNbVertex, Number MinAngle)
 Function to reduce a mesh according to the angle between facets to minimize the visual degradation. More...
 
Array ReduceDeviation (Number DeviationError, DeviationOptionEnum Criteria, Boolean KeepSharpEdge, Number DeviationOnSharpEdges, Number SharpEdgeAngleValue, Number MaxEdgeLength, Number DeviationOnBorders)
 Reduces the mesh by deleting some vertices and triangles according to a deviation error. More...
 
Array RemeshRefineDev (Number Deviation, Number SizeMin, Number MaxiTriNumber, BordersEnum _iBorderOption, Number DistanceWrongPoints, Number Reorganize, SCloud TheCloud, Number MaxCosAngle=-1)
 Refines an existing SPoly with deviation error and optionally better fitting on a SCloud. More...
 
Array RemeshSharpEdge (Array< SMultiline > Lines, SPoint iReferencePoint)
 Modifies locally the existing mesh to recreate sharp edge(s) More...
 
Array RemoveSpikes (Number LoopNumber, Number Propag=-1, Number Intensity, Boolean RecalculateBorder)
 This function will suppress or correct absurd points (ie spikes) of the current SPoly. More...
 
Array RemoveTexture ()
 Remove 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 FilePath, Boolean TextExport, SMatrix CoordinateSystemMatrix={})
 Saves the mesh into a file. More...
 
Array SaveColorGradient (String FilePath)
 Saves the color gradient into a file (*.rsi binary file). More...
 
Array SectionCylindric (SPoint iFirstPointOnAxis, SPoint iSecondPointOnAxis, SPoint iPointOnTheFirstCylinder, Number NumberOfCylinders, Number DistanceBeetweenCylinders)
 Intersection of a Polyhedron by parallel cylinders. More...
 
Array SectionOnMulti (SMultiline iMultiLine, Array< Number > ListDist, Number MaxDist, Number OptBitMask)
 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 Dist, Number MaxDist, Number OptBitMask)
 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 PlaneNormal, SPoint iPtFirstPlane, Number NbPlanes, Number Distance)
 Intersection between an SPoly and a parallel plane. More...
 
Array SectionRadial (SPoint iFirstPointOnAxis, SPoint iSecondPointOnAxis, SPoint iPtFirstPlane, Number NbSections, Number MaxAngleInRadian)
 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 SmallestSize, Number BiggestSize)
 Separate a mesh into parts according to the triangle size. More...
 
Array SeparateTriangleWithActivatedClippingPlanes (Array< SClippingPlane > clippingPlanes, 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 > MultiTbl, Number RemeshDistance)
 Create a new SPoly by updating the input one in order to make it fit the input border. More...
 
 SetPolyRepresentation (PolyRepresentationTypeEnum Representation)
 The representation of the component is modified. More...
 
Array Smooth (Number LoopNumber, SmoothEnum iOptionMask, Number MaxiDeviation, Boolean Reorganise, Number MinAngleReorg, Number RefineDistProj=-1.0, Number RefineVrtxAngle=-1.0, Number AngleSharpEdge=-1.0, Number iNbTriMax=-1)
 Smooth the surface of the current SPoly. More...
 
Array SmoothBorders (Array< SPoint > PointTable, 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 ipScanPos, 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 options)
 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 > CloudTbl, Number IgnoreOver, Number ResetColor, Number DefaultRed, Number DefaultGreen, Number DefaultBlue)
 Use the color (or the color of inspection) of point clouds to color the vertices on the current SPoly. More...
 
Array TextureAddRepetitive (String FilePathName, Number NbRepWidth, Number NbRepHeight, SVector DirXScreen, SVector DirYScreen, SPoint iImOrigin)
 Add repetitive texture to mesh. More...
 
Array Tolerance3DMesh (SCloud iCloud, Number Deviation, Number DistanceWrongPoints, Number SizeTriMax, Boolean Reorganize, Number Extension, Boolean NoiseReduct)
 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 > elevations, 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 ()
 Displays a dialog box to select an 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 ()
 
String GetName ()
 
 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, .mdl, .vrml, .wrl, .iv, .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 FileName)
  • 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 

◆ 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  VisCrit)
inlinestaticslot

To get all the SComp in the document.

Return values
Arrayall the SPoly contained in the document
Parameters
[in]VisCritVisible 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  Poly)
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]PolySecond object

◆ BooleanCutOut

Array SPoly::BooleanCutOut ( SPoly  Poly)
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]PolySecond object

◆ BooleanOperation

Array SPoly::BooleanOperation ( SPoly  Poly,
Boolean  CutPoly 
)
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]PolySecond object
[in]CutPolyif true, make a cut of this against Poly (No facet of Poly is output in result).

◆ BooleanSub

Array SPoly::BooleanSub ( SPoly  Poly)
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 Meshes,
SVector  DirectionVect,
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
MeshesMeshes to color
DirectionVectDirection 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  DistMax,
Number  MappingObject,
Boolean  IgnoreEdge,
SVector  Direction,
Number  maxCosAngle = -2,
Boolean  checkForThinParts 
)
slot

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

Note
This picture, done with 3DReshaper Application 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]DistMaxignore point having a distance greater than this one.
[in]MappingObject1 means color mapping is done on 'this', else 2 the color mapping is done on MeasCloud.
[in]IgnoreEdgeWhat should be done with points on edges.
  • false Project all points
  • true Ignore points having their projection on edge.
[in]DirectionThe direction of the inspection
  • 0 if it's a 3D inspection not need of a vector direction
[in]maxCosAnglemax 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]checkForThinPartsdoes 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  DistMax,
Number  MappingObject,
Boolean  IgnoreEdge,
SVector  Direction,
Number  MaxCosAngle = 0.,
Boolean  CheckThinParts 
)
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]DistMaxignore point having a distance greater than this one.
[in]MappingObject1 means color mapping is done on 'this', else 2 the color mapping is done on MeasPoly.
[in]IgnoreEdgeWhat should be done with points on edges.
  • false Project all points
  • true Ignore points having their projection on edge.
[in]DirectionThe direction of the inspection
  • 0 if it's a 3D inspection not need of a vector direction
[in]MaxCosAnglemax 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]CheckThinPartsdoes 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  CloudOfPoints,
Array< SMultiline SetOfMultilines,
SVector  MeshDir,
Number  Tolerance,
Number  ZoneType 
)
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]CloudOfPointsThe cloud of points to mesh or 0
[in]SetOfMultilinesSet of contours to merge and mesh with the cloud or an empty table if no contour to insert in the constrain meshing.
[in]MeshDirThis vector defines the meshing direction for which all the points, triangles and contours are visible.
[in]ToleranceTolerance to respect ; deviation error (for the points of the cloud only).
[in]ZoneTypeDefines 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  CloudOfPoints,
Array< SMultiline SetOfMultilines,
Number  Tolerance,
Number  ZoneType 
)
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]CloudOfPointsThe cloud of points to mesh or 0
[in]SetOfMultilinesSet of contours to merge and mesh with the cloud or an empty table if no contour to insert in the constrain meshing.
[in]ToleranceTolerance to respect ; deviation error (for the points of the cloud only).
[in]ZoneTypeDefines 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  ExportSuspiciousTriangles = false)
slot

◆ CreateCompound

static Array SPoly::CreateCompound ( Array< SPoly TablePoly,
Boolean  OptOrient 
)
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]TablePolyTable of SPoly to proceed. All the mesh are cleared when returning from this function.
[in]OptOrientShould 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  DeviationError,
Number  MiniAverageDist,
HoleOptionEnum  OptionHole,
Number  SizeTriHole,
Boolean  iIgnoreScanDir 
)
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]DeviationErrorDeviation error ( tolerance ) to respect.
[in]MiniAverageDistNoise 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]OptionHoleHow 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]SizeTriHolemaxi length of triangle to fill holes; -1 if no limit.
[in]iIgnoreScanDirTo ignore scan directions when meshing

◆ DirectionMesh

static Array SPoly::DirectionMesh ( SCloud  iCloudOfPoints,
SVector  MeshingDirection,
Number  Tolerance,
Boolean  FindCntr 
)
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
MeshingDirectionDirection for which all the points are visible. It is the 2D meshing direction.
ToleranceTolerance to respect (for the points of the cloud only).
FindCntrIf 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 SeedPoint,
Number  Tolerance,
CylinderEnum  Force,
SPoint  iCenter = {},
SVector  DirectionVector = {},
Number  Radius 
)
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]SeedPointSeed points around which the cylindrical region should be extracted.
[in]ToleranceExtract 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]ForceBit 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]DirectionVectorNormed Normal vector of the cylinder.
[in]RadiusRadius 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  Tolerance 
)
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]ToleranceExtract 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 SeedPoint,
Number  Tolerance,
SphereEnum  Force,
SPoint  Center = {},
Number  Radius 
)
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]SeedPointSeed points around which the spherical region should be extracted.
[in]ToleranceExtract 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]ForceBit 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]RadiusRadius of the sphere to force

◆ Extrusion

static Array SPoly::Extrusion ( SMultiline  iProfile,
SMultiline  iPath,
Boolean  TurnWithPath,
Boolean  PerpendicularToPath,
SMultiline  SecondPath,
RotateEnum  Option,
SPoint  RotatePt 
)
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]TurnWithPathtrue : the shape turn with the path
[in]PerpendicularToPathif the profile will be computed perpendicular to the path
[in]SecondPaththe second path to follow, profile orientation will be attracted by this second path This option is not compatible with "TurnWithPath = false"
[in]OptionHow the extrusion rotate point is compute ROTATE_CENTROID // Use centroid of the profile ROTATE_USER_DEFINE // You must defined your rotate point
[in]RotatePtIf ROTATE_USER_DEFINE is used: the profile rotate point. Take a look on the picture below

◆ FillContours

Array SPoly::FillContours ( Array< SMultiline ContourTable,
Number  Tension = 0.732f,
Number  WallThickness = -1,
Boolean  ForceNonSmoothShape 
)
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]ContourTablea table of contours to process
[in]TensionTension 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]WallThicknesswall thickness to allow better filling of horseshoe holes going on two sides of a wall; -1 if no wall thickness.
ForceNonSmoothShapefill unconditionally even if the shape is not smooth and there is a risk to create an absurd shape

◆ FillHoles

Array SPoly::FillHoles ( Array< SPoint PointTable,
Number  Tension,
Number  WallThickness = -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 LIC3DR_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]PointTablea table of points to identify each contour to process
[in]TensionTension 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]WallThicknesswall 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  Direction,
Array< SPoint PointTable,
Number  Tension 
)
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]DirectionDirection defining the view of the hole. If nullptr, the Reshaper will approximate this direction.
[in]PointTablea table of points to identify one of the points of each hole to fill. If empty, all the holes are treated.
[in]TensionTension 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

Displays a dialog box to select an 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  FileName)
staticslot

Function to import a mesh, and create a new SPolyhedron from a file. File extension authorized: .stl, .off, .msh, .ply, .obj, .poly, .mdl, .vrml, .wrl, .iv, .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]FileNameThe file name path

◆ FromName

static Array SPoly::FromName ( String  Name)
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 PolyTable,
FusionOptionEnum  Option,
Number  AccuracyPoint = 1.E-5,
Number  AccuracyBorders = 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
PolyTableThe SPoly table to fusion.
[in]OptionOption 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
AccuracyPointAccuracy beetween vertices (distance under which two points are considered identical); Most often 1.E-5
AccuracyBordersAccuracy 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  Direction)
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.

◆ GetInertiaMatrix

Array SPoly::GetInertiaMatrix ( Boolean  OnlyIfClosed)
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]OnlyIfClosedShould 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.

◆ GetNbPieces

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

◆ GetNumberOfTextureMaps

Number SPoly::GetNumberOfTextureMaps ( )
slot

Return the number of dynamic textures (texture maps) applied to the polyhedron.

Return values
Thenumber of triangles.

◆ GetNumberOfTextures

Array SPoly::GetNumberOfTextures ( )
slot

Return the number of textures applied to the polyhedron.

Return values
Array.Valuethe number of textures

◆ GetSilhouette

Array SPoly::GetSilhouette ( SVector  ViewDirection,
Number  DraftAngle,
Number  MinClosedLine,
Number  MinUnclosedLine,
Number  ResultType 
)
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 LIC3DR_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]ViewDirectionView direction.
[in]DraftAngleDraft Angle in radian. If zero, the contour seen is output.
[in]MinClosedLinedelete closed lines whose number of segment is less than this value.
[in]MinUnclosedLinedelete unclosed lines whose number of segment is less than this value.
[in]ResultTypeResult 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  TextureIdx)
slot

Return the original name of a dynamic texture (texture map) applied to the polyhedron.

Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Array.Stringthe original texture name
Parameters
[in]TextureIdxthe 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  OnlyIfClosed)
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]OnlyIfClosedShould 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 SetMultiTbl,
Number  RemeshDistance,
Number  CleaningDistance 
)
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.
Parameters
SetMultiTblThe 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
RemeshDistanceThe distance from the borders used for the remeshing
CleaningDistanceCleaning distance around the border line

◆ InterInfLine

Array SPoly::InterInfLine ( SPoint  iPoint,
SVector  Vect 
)
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]VectThe normalized vector of the infinite line direction

◆ Intersect

Array SPoly::Intersect ( SPoly  iPoly,
Number  Option 
)
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]OptionDo 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.

Note
You need a valid AEC license to access this feature.
Return values
Array.ErrorCodeThe generated error code:
  • 0 : no error occurred
  • 1 : an error occurred
Array.CompTblExtruded comps
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

◆ LoadColorGradient

Array SPoly::LoadColorGradient ( String  FilePath)
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
FilePathThe 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 PolyTable,
FusionOptionEnum  Option,
Number  AccuracyPoint = 1.E-5,
Number  AccuracyBorders = 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
PolyTableThe SPoly table to fusion.
[in]OptionOption 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
AccuracyPointAccuracy beetween vertices (distance under which two points are considered identical); Most often 1.E-5
AccuracyBordersAccuracy 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  Direct,
Number  DistCoef,
OffsetEnum  OptBitMask 
)
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]Direct1 to offset in the way of the normal, else 0.
[in]DistCoefDistance or coefficient to apply
[in]OptBitMaskBit 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.

Note
You need a valid AEC license to access this feature.
Return values
Array.ErrorCodeThe generated error code:
  • 0 : no error occurred
  • 1 : an error occurred
Array.CompTblExtruded comps
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

◆ 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  HadIntermediatePt 
)
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.
HadIntermediatePtShould 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  Direction,
Boolean  HadIntermediatePt,
Boolean  iSignedProjection 
)
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]Directionprojection direction
HadIntermediatePtShould we add intermediate points?
If true, intermediate points are added every time the line crosses a triangle edge.
iSignedProjectionShould 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  Direction,
Boolean  iSignedProjection 
)
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]Directionprojection direction
iSignedProjectionShould we search only in front of each point of current SPoint ?
if false, research is made in both direction.

◆ Reduce

Array SPoly::Reduce ( Number  TargetNbVertex,
Number  MinAngle 
)
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]TargetNbVertexnumber of vertices to keep inside the polyhedron.
MinAngleAngle of the thinest triangle authorized to be created. This angle is in degrees.

◆ ReduceDeviation

Array SPoly::ReduceDeviation ( Number  DeviationError,
DeviationOptionEnum  Criteria,
Boolean  KeepSharpEdge,
Number  DeviationOnSharpEdges,
Number  SharpEdgeAngleValue,
Number  MaxEdgeLength,
Number  DeviationOnBorders 
)
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
DeviationErrorMaximum deviation error. All vertices of the mesh before the reduction must have a distance lower than this value with the mesh after reduction.
[in]CriteriaOption 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).
KeepSharpEdgeif false there is no restriction on sharp edges else if true DeviationOnSharpEdges and SharpEdgeAngleValue must be defined
[in]DeviationOnSharpEdgesif 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]SharpEdgeAngleValueif KeepSharpEdge, Angle in degrees between two neighbor triangles to consider that we are on a sharp edge.
MaxEdgeLengthIf 0, there is no control on the length of edges
[in]DeviationOnBordersif ON_BORDERS is used, Deviation Value authorized on borders. If 0, use the deviation error.

◆ RemeshRefineDev

Array SPoly::RemeshRefineDev ( Number  Deviation,
Number  SizeMin,
Number  MaxiTriNumber,
BordersEnum  _iBorderOption,
Number  DistanceWrongPoints,
Number  Reorganize,
SCloud  TheCloud,
Number  MaxCosAngle = -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]DeviationTolerance to respect (deviation error)
[in]SizeMinMinimum size of triangles. It is not authorized to create new triangles with a size below this value.
[in]MaxiTriNumberMaximum 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]DistanceWrongPointsIf 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]Reorganize[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]TheCloudThe cloud of points, which should be fitted on the new mesh or 0 if none
[in]MaxCosAngleMax 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 Lines,
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]LinesTable 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  LoopNumber,
Number  Propag = -1,
Number  Intensity,
Boolean  RecalculateBorder 
)
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]LoopNumberNumber of loops (iteration of the treatment)
[in]PropagNeighbor 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]IntensitySuppression 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]RecalculateBorderAllow to also modify free borders

◆ RemoveTexture

Array SPoly::RemoveTexture ( )
slot

Remove all textures applied on the current mesh.

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.

◆ 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  FilePath,
Boolean  TextExport,
SMatrix  CoordinateSystemMatrix = {} 
)
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
  • .wrl / .vrml / .iv : VRML 2
  • .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
FilePathThe complete file path to save into
TextExportShould the mesh be exported as text or binary data ?
  • true : Text
  • false : Binary
CoordinateSystemMatrixthe matrix to define a UCS used for the export (or identity to use the WCS)

◆ SaveColorGradient

Array SPoly::SaveColorGradient ( String  FilePath)
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
FilePathThe complete file path to save into

◆ SectionCylindric

Array SPoly::SectionCylindric ( SPoint  iFirstPointOnAxis,
SPoint  iSecondPointOnAxis,
SPoint  iPointOnTheFirstCylinder,
Number  NumberOfCylinders,
Number  DistanceBeetweenCylinders 
)
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
NumberOfCylindersif > 0 the sections are done only in the way of the vector. If < 0, an infinity of parallel planes is assumed.
[in]DistanceBeetweenCylindersdistance between cylinders

◆ SectionOnMulti

Array SPoly::SectionOnMulti ( SMultiline  iMultiLine,
Array< Number >  ListDist,
Number  MaxDist,
Number  OptBitMask 
)
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]ListDistthe 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]MaxDistThe 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]OptBitMaskBit 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  Dist,
Number  MaxDist,
Number  OptBitMask 
)
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]Distthe curvilinear and regular distance between two sections.
[in]MaxDistThe 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]OptBitMaskBit 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  PlaneNormal,
SPoint  iPtFirstPlane,
Number  NbPlanes,
Number  Distance 
)
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]PlaneNormalNormal vector to the plane
[in]iPtFirstPlanePoint on the first plane
[in]NbPlanesParallel planes number
  • If > 0 the sections are done only in the vector's direction.
  • If < 0, an infinity of parallel planes is assumed.
[in]DistanceDistance between planes

◆ SectionRadial

Array SPoly::SectionRadial ( SPoint  iFirstPointOnAxis,
SPoint  iSecondPointOnAxis,
SPoint  iPtFirstPlane,
Number  NbSections,
Number  MaxAngleInRadian 
)
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]NbSectionsnumber of sections within the MaxAngleInRadian.
[in]MaxAngleInRadianMax 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  SmallestSize,
Number  BiggestSize 
)
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]SmallestSizeminimum size of triangle
[in]BiggestSizemaximum size of triangle

◆ SeparateTriangleWithActivatedClippingPlanes

Array SPoly::SeparateTriangleWithActivatedClippingPlanes ( Array< SClippingPlane clippingPlanes,
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]clippingPlanesthe base Multiline of the prism (median plane)
[in]iSelTypeOption for the selection

◆ SetBorders

Array SPoly::SetBorders ( Array< SMultiline MultiTbl,
Number  RemeshDistance 
)
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 An error occurred.
Array.PolyThe resulting mesh.
Parameters
MultiTblThe input table of SMultiline borders
RemeshDistanceThe 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  LoopNumber,
SmoothEnum  iOptionMask,
Number  MaxiDeviation,
Boolean  Reorganise,
Number  MinAngleReorg,
Number  RefineDistProj = -1.0,
Number  RefineVrtxAngle = -1.0,
Number  AngleSharpEdge = -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]LoopNumberThe 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]MaxiDeviationMaximum 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.
ReorganiseIf true the function Reorganise is called at each loop.
MinAngleReorgangle 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]RefineDistProjRefinement 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.
RefineVrtxAngleIf >0, new vertices are added when the angle between 2 neighbour vertices is over this value (in degrees)
AngleSharpEdgeIf >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 PointTable,
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]PointTablea 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  ipScanPos,
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]ipScanPosScanning 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  options 
)
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]optionsa 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 CloudTbl,
Number  IgnoreOver,
Number  ResetColor,
Number  DefaultRed,
Number  DefaultGreen,
Number  DefaultBlue 
)
slot

Use the color (or the color of inspection) of point clouds to color the vertices on the current SPoly.

Note
For each vertex of the current SPoly 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 ConvertInspectionToColor on each cloud
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.
Parameters
[in]CloudTblTable of SCloud containing the colors. Each of the SCloud must have a colored information, else the cloud is not taking account
[in]IgnoreOverIf a point of the cloud has a distance to the current SPoly over this value, it is ignored. The color of a point moves to a vertex only if the distance to the polyhedron is less than this value. If this value is zero or less, taking 1% of the SPoly size.
[in]ResetColorWhen 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]DefaultRedRed color between [0-1] to be used for the non colored vertices
[in]DefaultGreenGreen color between [0-1] to be used for the non colored vertices
[in]DefaultBlueBlue color between [0-1] to be used for the non colored vertices

◆ TextureAddRepetitive

Array SPoly::TextureAddRepetitive ( String  FilePathName,
Number  NbRepWidth,
Number  NbRepHeight,
SVector  DirXScreen,
SVector  DirYScreen,
SPoint  iImOrigin 
)
slot

Add repetitive texture to mesh.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyReturn a new SPoly with the repetitive texture
Parameters
[in]FilePathNamePath to the texture
[in]NbRepWidthNumber of repetition in width of the screen
[in]NbRepHeightNumber of repetition in height of the screen
[in]DirXScreenDirection X of the projection plane
[in]DirYScreenDirection Y of the projection plane
[in]iImOriginOrigin of the image

◆ Tolerance3DMesh

Array SPoly::Tolerance3DMesh ( SCloud  iCloud,
Number  Deviation,
Number  DistanceWrongPoints,
Number  SizeTriMax,
Boolean  Reorganize,
Number  Extension,
Boolean  NoiseReduct 
)
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
DirectionMesh, RemeshRefineDev, Direct3DMesh
Return values
Array.ErrorCodeThe error code:
  • 0 No error.
  • 1 An error occurred.
Parameters
[in]iCloudThe cloud of points to mesh
[in]DeviationTolerance to respect (deviation error)
[in]DistanceWrongPointsIf 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]SizeTriMaxMaxi triangle size for triangle created on frees contours, if an extension of the existing polyhedron is requested.
[in]ReorganizeIf one, try to reorganise locally sharp edges or small radii.
[in]ExtensionWhat 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]NoiseReductShould 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 >  elevations,
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]elevationsThe 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