FormIt Plugin API  v23.0.0 (2023.0.0)
FormIt.Selection API

Description

Functions

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

Function Documentation

json FormIt.Selection.AddSelections ( aSelection  )

Add a list of ObjectIDs to the selections.

Parameters
[in]aSelectionWSM.Utils.HistoryObjects
Returns
JSON_UNDEFINED
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
json FormIt.Selection.ClearPreSelections ( )

Clear the pre-selected objects.

Returns
JSON_UNDEFINED
json FormIt.Selection.ClearSelections ( )

Clears all of the selections.

Returns
JSON_UNDEFINED
json FormIt.Selection.CommitPreselections ( )

CommitPreselections makes the pre-selections the current selections.

Returns
JSON_UNDEFINED
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
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
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.
json FormIt.Selection.GetFirstSelectedObject ( )

Get the first selection.

It may not be the first element in m_SelectedObjects.

Returns
The first selected Object ID.
json FormIt.Selection.GetObjectTypeFilter ( )
json FormIt.Selection.GetPreSelections ( )

Get the pre-selections.

Returns
{ first: , preselections: } Returns the first pre-selection and the full list of pre-selections.
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"
}
]
json FormIt.Selection.HasPreSelections ( )

Returns true if there are pre-selections.

Returns
bool
json FormIt.Selection.HasSelections ( )

HasSelections returns true is there are selections.

Returns
bool
json FormIt.Selection.IsSelected ( objPath  )

Check if the given object is selected.

Parameters
[in]objPathWSM.GroupInstancePath
Returns
bool
json FormIt.Selection.SelectAll ( )

Select all objects in the model.

Returns
JSON_UNDEFINED
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);
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
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
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