FormIt Plugin API v25.0.0 (2025.0.0)
Loading...
Searching...
No Matches
FormIt.Selection API

Description

Functions

json FormIt.Selection.GetObjectTypeFilter ()
 Returns the current ObjectTypeFilter.
 
json FormIt.Selection.SetObjectTypeFilter (objectTypeFilter)
 Sets the current ObjectTypeFilter.
 
json FormIt.Selection.ClearSelections ()
 Clears all of the selections.
 
json FormIt.Selection.AddSelections (aSelection)
 Add a list of ObjectIDs to the selections.
 
json FormIt.Selection.GetSelections ()
 Get selections.
 
json FormIt.Selection.SetSelections (selections)
 Set selections.
 
json FormIt.Selection.SetPreSelections (firstPreselection, selections)
 Set pre-selections
 
json FormIt.Selection.HasPreSelections ()
 Returns true if there are pre-selections.
 
json FormIt.Selection.GetFirstPreSelectedObject ()
 Get the first pre-selection.
 
json FormIt.Selection.GetFirstSelectedObject ()
 Get the first selection.
 
json FormIt.Selection.GetContextMenuObject ()
 Get the object selected from the context menu click.
 
json FormIt.Selection.ClearPreSelections ()
 Clear the pre-selected objects.
 
json FormIt.Selection.IsSelected (objPath)
 Check if the given object is selected.
 
json FormIt.Selection.SelectAll ()
 Select all objects in the model.
 
json FormIt.Selection.HasSelections ()
 HasSelections returns true is there are selections.
 
json FormIt.Selection.GetPreSelections ()
 Get the pre-selections
 
json FormIt.Selection.CommitPreselections ()
 CommitPreselections makes the pre-selections the current selections.
 
json FormIt.Selection.CompareSelections (selection1, selection2)
 Compare two selection sets to see if they are the same.
 
json FormIt.Selection.ToggleObjects (selections)
 ToggleObjects toggles the object selection- If they're in the list, it removes them, else it adds them.
 
json FormIt.Selection.ApplyMaterialToSelection (id, backside)
 Apply the material to selection through the JS API rather than module.ccall() for Web
 

Function Documentation

◆ AddSelections()

json FormIt.Selection.AddSelections ( aSelection  )

Add a list of ObjectIDs to the selections.

Parameters
[in]aSelectionWSM.Utils.HistoryObjects
Returns
JSON_UNDEFINED

◆ ApplyMaterialToSelection()

json FormIt.Selection.ApplyMaterialToSelection ( id  ,
backside   
)

Apply the material to selection through the JS API rather than module.ccall() for Web

Parameters
[in]idWSM.ObjectHistoryID The material (ObjectHistoryID) to assign to the selection.
[in]backsidebool
Returns
JSON_UNDEFINED

◆ ClearPreSelections()

json FormIt.Selection.ClearPreSelections ( )

Clear the pre-selected objects.

Returns
JSON_UNDEFINED

◆ ClearSelections()

json FormIt.Selection.ClearSelections ( )

Clears all of the selections.

Returns
JSON_UNDEFINED

◆ CommitPreselections()

json FormIt.Selection.CommitPreselections ( )

CommitPreselections makes the pre-selections the current selections.

Returns
JSON_UNDEFINED

◆ CompareSelections()

json FormIt.Selection.CompareSelections ( selection1  ,
selection2   
)

Compare two selection sets to see if they are the same.

Parameters
[in]selection1Array of WSM.GroupInstancePath or WSM.GroupInstancePath
[in]selection2Array of WSM.GroupInstancePath or WSM.GroupInstancePath
Returns
bool

◆ GetContextMenuObject()

json FormIt.Selection.GetContextMenuObject ( )

Get the object selected from the context menu click.

Used by tools that are interested which object was picked through the context menu click

Returns
The id of the object selected from the context menu click and the pick point through which the contextn meun was invoked

◆ GetFirstPreSelectedObject()

json FormIt.Selection.GetFirstPreSelectedObject ( )

Get the first pre-selection.

It may not be the first element in m_PreSelectedObjects.

Returns
The first pre-selected Object ID.

◆ GetFirstSelectedObject()

json FormIt.Selection.GetFirstSelectedObject ( )

Get the first selection.

It may not be the first element in m_SelectedObjects.

Returns
The first selected Object ID.

◆ GetObjectTypeFilter()

json FormIt.Selection.GetObjectTypeFilter ( )

Returns the current ObjectTypeFilter.

Returns
ObjectTypeFilter
// JS Syntax:
var filter = FormIt.Selection.GetObjectTypeFilter();
console.log(JSON.stringify(filter));
Result:
{
"allowOwnedFaces": false,
"allowsGroupGeometry" : false,
"bodies" : false,
"edges" : true,
"faces" : true,
"instances" : true,
"meshes": true,
"isSelectingProfile" : false,
"minNumObjects" : 0,
"mustBeTopLevel" : false,
"mustSelectAllConnected" : false,
"objectName" : "ObjectTypeFilter",
"restrictGroupGeometryToEditingPath" : false,
"selectBodyIfAllSelected" : true,
"singleObjectOnly" : false,
"vertices" : false
}
FormIt.Selection namespace.
Definition jsapi_include.dox:2745
FormIt namespace.
Definition jsapi_include.dox:1508

◆ GetPreSelections()

json FormIt.Selection.GetPreSelections ( )

Get the pre-selections

Returns
{ first: , preselections: } Returns the first pre-selection and the full list of pre-selections.

◆ GetSelections()

json FormIt.Selection.GetSelections ( )

Get selections.

Returns
selections
// JS Syntax:
var selections = FormIt.Selection.GetSelections();
console.clear();
console.log(JSON.stringify(selections));
Result:
[
{
"ids": [
{
"History": 0,
"Object" : 58,
"objectName" : "ObjectHistoryID"
}
],
"objectName": "GroupInstancePath"
}
]

◆ HasPreSelections()

json FormIt.Selection.HasPreSelections ( )

Returns true if there are pre-selections.

Returns
bool

◆ HasSelections()

json FormIt.Selection.HasSelections ( )

HasSelections returns true is there are selections.

Returns
bool

◆ IsSelected()

json FormIt.Selection.IsSelected ( objPath  )

Check if the given object is selected.

Parameters
[in]objPathWSM.GroupInstancePath
Returns
bool

◆ SelectAll()

json FormIt.Selection.SelectAll ( )

Select all objects in the model.

Returns
JSON_UNDEFINED

◆ SetObjectTypeFilter()

json FormIt.Selection.SetObjectTypeFilter ( objectTypeFilter  )

Sets the current ObjectTypeFilter.

Parameters
[in]objectTypeFilterThe given filter to be set. Run GetObjectTypeFilter to get the filter object to start with.
Returns
JSON_UNDEFINED
// JS Syntax:
FormIt.Selection.SetObjectTypeFilter(filter);

◆ SetPreSelections()

json FormIt.Selection.SetPreSelections ( firstPreselection  ,
selections   
)

Set pre-selections

Parameters
[in]firstPreselectionThe first pre-selection (OPTIONAL)
[in]selectionsArray of WSM.GroupInstancePath or WSM.GroupInstancePath
Returns
JSON_UNDEFINED

◆ SetSelections()

json FormIt.Selection.SetSelections ( selections  )

Set selections.

Parameters
[in]selectionsArray of WSM.GroupInstancePath or WSM.GroupInstancePath. See the result from GetSelections for correct format.
Returns
JSON_UNDEFINED

◆ ToggleObjects()

json FormIt.Selection.ToggleObjects ( selections  )

ToggleObjects toggles the object selection- If they're in the list, it removes them, else it adds them.

Parameters
[in]selectionsArray of WSM.GroupInstancePath
Returns
JSON_UNDEFINED