GO2cam Javascript API
GO2SDisplayGeometry Class Reference

Temporary display of a geometry in the 3D scene. More...

Inheritance diagram for GO2SDisplayGeometry:
GO2SDisplayPoint GO2SDisplayPolyline

Public Member Functions

 GO2SDisplayGeometry ()
 
 GO2SDisplayGeometry (GO2SGeometry geom)
 
void SetColor (Number color)
 
Boolean SetGeometry (GO2SGeometry geom)
 
void SetLineType (GO2SEnum::GO2SLineType type)
 
void SetLineWidth (Number width)
 
void SetTransparency (Number transparency)
 
void SetVisible (Boolean visible)
 

Protected Member Functions

void SetEntity (std::shared_ptr< CGoeElementInterface > entity)
 

Detailed Description

Temporary display of a geometry in the 3D scene.

The display is a snapshot of the shape of the geometry: nothing is created in the GO2cam database. It is the way to show a geometry as a preview while construction values are still modified via a dialog or a loop. It is also the way to show a geometry of a workspace (GO2SWorkspace), which is never displayed. It stays displayed while the script is running and is automatically removed at the end of the script. Shortcuts display directly from coordinates, without creating a geometry first: GO2SDisplayPolyline (lines going through points) and GO2SDisplayPoint (a cross marking a position).

var org = new GO2SXYZ(0, 0, 0);
var end = new GO2SXYZ(10, 0, 0);
// preview of the segment: only displayed, nothing is left in the database
var preview = new GO2SDisplayGeometry(new GO2SSegment(org, end))
preview.SetColor(0x0000FF)
preview.SetLineWidth(3)
preview.SetLineType(GO2SLineType.Dotted)
// each pick moves the end point, ESC validates the last one
var pos;
while ((pos = GO2SInteract.PickXYZ('Pick the end point, ESC to validate')))
{
end = pos;
preview.SetGeometry(new GO2SSegment(org, end))
}
// create the final segment
new GO2SSegment(org, end);
Class to manage interactivity with GO2cam.
Definition GO2SInteract.hpp:10
static GO2SXYZ PickXYZ(String forcedMessage="", Boolean info=false)
Segment object.
Definition GO2SSegment.hpp:8
Creation of a coordinate reference.
Definition GO2SXYZ.hpp:93
Remarks
like GO2SInteract.PickXYZWithPreview, a geometry of the Main workspace is deleted once displayed: nothing is left in the GO2cam database. A geometry of another workspace is kept.
Warning
do not display an existing geometry of the Main workspace that must be kept: display a copy instead
Remarks
the display does not follow the later changes of the geometry: call SetGeometry() again to update it
wireframes are displayed as lines, points as crosses, solids and meshes as facets
Version
2027

Constructor & Destructor Documentation

◆ GO2SDisplayGeometry() [1/2]

GO2SDisplayGeometry::GO2SDisplayGeometry ( )

Default constructor, nothing displayed

Version
2027

◆ GO2SDisplayGeometry() [2/2]

GO2SDisplayGeometry::GO2SDisplayGeometry ( GO2SGeometry geom)
explicit

Constructor, display the given geometry

Version
2027
Parameters
[in]geomgeometry to display (of any workspace)

Member Function Documentation

◆ SetColor()

void GO2SDisplayGeometry::SetColor ( Number color)

Set the color of the display

Version
2027
Parameters
[in]colorcolor (0xBBGGRR)

◆ SetGeometry()

Boolean GO2SDisplayGeometry::SetGeometry ( GO2SGeometry geom)

Set / Update the shape to display as a preview

Remarks
a geometry of the Main workspace is deleted once displayed
Returns
false if the geometry cannot be displayed (it is then not deleted)
Version
2027
Parameters
[in]geomgeometry to display (of any workspace)

◆ SetLineType()

void GO2SDisplayGeometry::SetLineType ( GO2SEnum::GO2SLineType type)

Set the line type (wireframe)

Version
2027
Parameters
[in]typeline type

◆ SetLineWidth()

void GO2SDisplayGeometry::SetLineWidth ( Number width)

Set the line width (wireframe)

Version
2027
Parameters
[in]widthline width in pixels

◆ SetTransparency()

void GO2SDisplayGeometry::SetTransparency ( Number transparency)

Set the transparency (solid and mesh)

Version
2027
Parameters
[in]transparencyfrom 0 (opaque) to 1 (invisible)

◆ SetVisible()

void GO2SDisplayGeometry::SetVisible ( Boolean visible)

Show or hide the display

Version
2027
Parameters
[in]visibletrue to show the geometry, false to hide it