GO2cam Javascript API  6.11
GO2SWireFeature Class Reference

Wire Feature management. More...

Inheritance diagram for GO2SWireFeature:
GO2SMultipleGeometry GO2SWireGeometry GO2SGeometry

Public Member Functions

 GO2SWireFeature (Array< GO2SSimpleGeometry > geoms)
 Create a new GO2SWireFeature from an array of wire geometry.
 
GO2SEnum::GO2SError AddFeatureData (String opeListKey, String description, any paramValue)
 
GO2SEnum::GO2SError ClearFeatureData ()
 Clear all the the feature parameters.
 
Array< Array< any > > GetFeatureData ()
 
String GetOpeListFolder ()
 
String GetOpeListName ()
 
GO2SEnum::GO2SError SetOpeListFolder (String adr)
 
GO2SEnum::GO2SError SetOpeListName (String name)
 
- Public Member Functions inherited from GO2SMultipleGeometry
Array< GO2SGeometryExplode ()
 
Number GetElementCount ()
 
GO2SXYZ GetFirstPoint () override
 
GO2SXYZ GetLastPoint () override
 
Number GetLength () override
 
GO2SXYZ GetNormalOnCurve (Number t) override
 
GO2SXYZ GetPositionOnCurve (Number t) override
 
GO2SXYZ GetProjPoint (GO2SXYZ point) override
 
Number GetT (GO2SXYZ point) override
 
GO2SXYZ GetTangentOnCurve (Number t) override
 
Boolean IsClose () override
 
- Public Member Functions inherited from GO2SGeometry
GO2SEnum::GO2SError ChangePlane (Number plane)
 
GO2SGeometry Copy ()
 
GO2SEnum::GO2SError Delete ()
 
Array< GO2SXYZDiscretize (Number accuracy=0.01)
 
Boolean Equals (GO2SGeometry other)
 
Array< GO2SXYZGetBoundingBox ()
 
Number GetColor ()
 
Array< GO2SEnum::GO2SParamGetEditableParams ()
 
Number GetLayer ()
 
Number GetLineType ()
 
Number GetLineWidth ()
 
String GetName ()
 
Number GetParam (GO2SEnum::GO2SParam param)
 
GO2SGeometry GetParent ()
 
Number GetPlane ()
 
GO2SXYZ GetPosition ()
 
Boolean IsCircular ()
 
Boolean IsLinear ()
 
Boolean IsParamEditable (GO2SEnum::GO2SParam param)
 
Boolean IsPoint ()
 
Boolean IsPositionEditable ()
 
Boolean IsSolid ()
 
Boolean IsValid ()
 
Boolean IsVisible ()
 
Boolean IsWireframe ()
 
GO2SGeometry Rotated (GO2SXYZ xyz, Number angle, Boolean xyzDir)
 
GO2SEnum::GO2SError SetColor (Number color)
 
GO2SEnum::GO2SError SetLayer (Number layer)
 
GO2SEnum::GO2SError SetLineType (ELineType type)
 
GO2SEnum::GO2SError SetLineWidth (Number width)
 
GO2SEnum::GO2SError SetName (String p1)
 
GO2SEnum::GO2SError SetParam (GO2SEnum::GO2SParam param, Number value)
 
GO2SEnum::GO2SError SetPlane (Number plane)
 
GO2SEnum::GO2SError SetPolarPosition (Number radius, Number angle, Number altitude=0)
 
GO2SEnum::GO2SError SetPosition (GO2SXYZpos)
 
GO2SEnum::GO2SError SetPosition (Number x, Number y, Number z)
 
GO2SEnum::GO2SError SetVisible (Boolean visibility)
 
String toString ()
 
GO2SEnum::GO2SError Transform (GO2SMatrix matrix)
 
GO2SGeometry Transformed (GO2SMatrix matrix)
 
GO2SGeometry Translated (GO2SXYZ origin, GO2SXYZ p)
 

Detailed Description

Wire Feature management.

Attention
this works only in turning application

This objects allows to create turning features.

Let's consider you have a direct grooving opelist ('groove.opl') having 2 feature parameters (width and radius) used to set the tool cutter width and insert radius parameters

The following script will use the green geometry to create a GO2SWireFeature object on which we attach the opelist with feature parameters coming form the design.

// get the entity named 'Fillet' to know the radius
let fillet = GO2SGeometryUtil.GetByName('Fillet')[0]
let radius = fillet.GetParam(GO2SParam.radius)
console.log('tool radius: ' + radius)
// get the entity named 'Segment' to know the width
let segment = GO2SGeometryUtil.GetByName('Segment')[0]
let width = segment.GetParam(GO2SParam.length)
console.log('tool width: ' + width)
// get all green entities and transfom them in WireFeature
let geom = GO2SGeometryUtil.GetByColor(0x00ff00)
// find the ~vertical segments
let start = 12
let end = geom.length - 1
for (let i = 0; i < geom.length; i++)
{
if (geom[i].IsLinear())
{
let dir = geom[i].GetDirectionOnCurve(0)
if (dir.Y() < -0.9)
start = i
else if (dir.Y() > 0.9)
end = i
}
}
// build a profile from start to end in order to have ordered elements
let prf = GO2SProfileCreate.From2Geom(geom[start], geom[end])
if (prf.GetElementCount() == geom.length)
{
let ordered_geom = prf.Explode()
prf.Delete()
let feature = new GO2SWireFeature(ordered_geom)
feature.SetOpeListName('groove.opl')
feature.AddFeatureData('WIDTH', '', width)
feature.AddFeatureData('RADIUS', '', radius)
}
Boolean IsLinear()
Class for utilitary methods of geometric entities.
Definition GO2SGeometryUtil.hpp:11
static Array< GO2SGeometry > GetByColor(Number color)
static Array< GO2SGeometry > GetByName(String p1)
Array< GO2SGeometry > Explode()
Helper class to create profiles.
Definition GO2SProfile.hpp:45
static GO2SProfile From2Geom(GO2SGeometry start, GO2SGeometry end)
See GO2SProfile.SetFrom2Geom.
GO2SWireFeature(Array< GO2SSimpleGeometry > geoms)
Create a new GO2SWireFeature from an array of wire geometry.

Constructor & Destructor Documentation

◆ GO2SWireFeature()

GO2SWireFeature::GO2SWireFeature ( Array< GO2SSimpleGeometry > geoms)

Create a new GO2SWireFeature from an array of wire geometry.

Parameters
[in]geomsarray of simple wireframe entities

Member Function Documentation

◆ AddFeatureData()

GO2SEnum::GO2SError GO2SWireFeature::AddFeatureData ( String opeListKey,
String description,
any paramValue )

Add a feature data to the feature

Returns
GO2SError.success (0) if success, see GO2SError otherwise
Parameters
[in]opeListKeyKey of the feature parameter in the opelist
[in]descriptionoptional description
[in]paramValuevalue of the parameter

◆ GetFeatureData()

Array< Array< any > > GO2SWireFeature::GetFeatureData ( )
Returns
all the feature parameters
Remarks
Each element of the array is a tuple of ( String, String, {String or Number} )

◆ GetOpeListFolder()

String GO2SWireFeature::GetOpeListFolder ( )
inline
Returns
the folder of the opelist attached to the feature

◆ GetOpeListName()

String GO2SWireFeature::GetOpeListName ( )
inline
Returns
the name of the opelist attached to the feature

◆ SetOpeListFolder()

GO2SEnum::GO2SError GO2SWireFeature::SetOpeListFolder ( String adr)

Set the folder of the OpeList attached to the feature

Remarks
this is optional. If the folder is not set, the opelist is supposed to be in GO2cam opelist directory
Parameters
[in]adrfolder where the opelist is

◆ SetOpeListName()

GO2SEnum::GO2SError GO2SWireFeature::SetOpeListName ( String name)

Set the name of the OpeList attached to the feature

Returns
GO2SError.success (0) if success, see GO2SError otherwise
Parameters
[in]namename of the opelist attached to the feature