Group¶

This class describes a group of nodes. In SAMSON, the user may group selected nodes. Groups added to a document appear in the document view, and the user may perform various operations using groups, e.g. select the nodes in the group, intersect the current selection with the nodes in the group, etc.

Let’s for example create a group which contains references to all currently selected nodes.

# get the active document
activeDocument = SAMSON.getActiveDocument()

# get a node indexer of all currently selected nodes
selectedNodesIndexer = activeDocument.getSelectedNodes()

# construct a group based on the node indexer
group = sam.DataModel.DataGraph.Group("My selection", selectedNodesIndexer)

# turn the undo system on
SAMSON.beginHolding("Group selection")

# hold the group
SAMSON.hold(group)

# create the group (it node should be created before adding it to another node of the data graph)
group.create()

# add the group to the active document
activeDocument.addChild(group)

# turn the undo system off
SAMSON.endHolding()

You can get the node indexer of nodes in the group using the samson.DataModel.DataGraph.Group.getGroupNodes() function:

groupNodesIndexer = group.getGroupNodes()
groupNodesIndexer.size

You can also clone a group to, for example, create another modified group:

clonedGroup = group.clone()
clonedGroup.name = "My selection 2"

SAMSON.beginHolding("Group selection")
SAMSON.hold(clonedGroup)

clonedGroup.create()
activeDocument.addChild(clonedGroup)

SAMSON.endHolding()

See also

SAMSON API: sbddatagraphnodegroup

class samson.DataModel.DataGraph.Group(*args, **kwargs)¶

Bases: samson.DataModel.DataGraph.Node

This class describes a node group.

Overloaded function.

  1. __init__(self: samson.DataModel.DataGraph.Group) -> None
  2. __init__(self: samson.DataModel.DataGraph.Group, name: str, nodeIndexer: samson.DataModel.DataGraph.NodeIndexer) -> None

Constructs a group with name from nodes in nodeIndexer.

class NodeType(self: samson.DataModel.DataGraph.Node.NodeType, arg0: int) → None¶

Bases: pybind11_builtins.pybind11_object

Members:

Undefined

StructuralModel

StructuralModelNode

StructuralModelConformation

Conformation

StructuralModelPath

Path

StructuralModelNodeGroup

StructuralGroup

StructuralModelNodeRoot

Root

StructuralModelNodeParticle

StructuralParticle

StructuralModelNodeAtom

Atom

StructuralModelNodePseudoAtom

PseudoAtom

StructuralModelNodeBond

Bond

StructuralModelNodeResidue

Residue

StructuralModelNodeSegment

Segment

StructuralModelNodeProtein

Protein

StructuralModelNodeChain

Chain

StructuralModelNodeMolecule

Molecule

StructuralModelNodeBackbone

Backbone

StructuralModelNodeSideChain

SideChain

VisualModel

VisualModelMesh

Mesh

DynamicalModel

DynamicalModelParticleSystem

ParticleSystem

DynamicalModelRigidBodySystem

RigidBodySystem

DynamicalModelArticulatedBodySystem

ArticulatedBodySystem

DynamicalModelNode

DynamicalNode

DynamicalModelNodeGroup

DynamicalGroup

DynamicalModelNodeRoot

DynamicalRoot

DynamicalModelNodeParticle

DynamicalParticle

DynamicalModelNodeRigidBody

RigidBody

DynamicalModelNodeArticulatedBody

ArticulatedBody

InteractionModel

InteractionModelParticleSystem

InteractionModelRigidBodySystem

InteractionModelArticulatedBodySystem

PropertyModel

PropertyModelFunction

Simulator

SimulatorParticleSystem

SimulatorRigidBodySystem

SimulatorArticulatedBodySystem

StateUpdater

StateUpdaterParticleSystem

StateUpdaterRigidBodySystem

StateUpdaterArticulatedBodySystem

DocumentManager

Document

Folder

Camera

Label

DataGraphNodeGroup

NodeGroup

Controller

ControllerNode

Asset

ArticulatedBody = NodeType.DynamicalModelNodeArticulatedBody¶
ArticulatedBodySystem = NodeType.DynamicalModelArticulatedBodySystem¶
Asset = NodeType.Asset¶
Atom = NodeType.StructuralModelNodeAtom¶
Backbone = NodeType.StructuralModelNodeBackbone¶
Bond = NodeType.StructuralModelNodeBond¶
Camera = NodeType.Camera¶
Chain = NodeType.StructuralModelNodeChain¶
Conformation = NodeType.StructuralModelConformation¶
Controller = NodeType.Controller¶
ControllerNode = NodeType.ControllerNode¶
DataGraphNodeGroup = NodeType.DataGraphNodeGroup¶
Document = NodeType.Document¶
DocumentManager = NodeType.DocumentManager¶
DynamicalGroup = NodeType.DynamicalModelNodeGroup¶
DynamicalModel = NodeType.DynamicalModel¶
DynamicalModelArticulatedBodySystem = NodeType.DynamicalModelArticulatedBodySystem¶
DynamicalModelNode = NodeType.DynamicalModelNode¶
DynamicalModelNodeArticulatedBody = NodeType.DynamicalModelNodeArticulatedBody¶
DynamicalModelNodeGroup = NodeType.DynamicalModelNodeGroup¶
DynamicalModelNodeParticle = NodeType.DynamicalModelNodeParticle¶
DynamicalModelNodeRigidBody = NodeType.DynamicalModelNodeRigidBody¶
DynamicalModelNodeRoot = NodeType.DynamicalModelNodeRoot¶
DynamicalModelParticleSystem = NodeType.DynamicalModelParticleSystem¶
DynamicalModelRigidBodySystem = NodeType.DynamicalModelRigidBodySystem¶
DynamicalNode = NodeType.DynamicalModelNode¶
DynamicalParticle = NodeType.DynamicalModelNodeParticle¶
DynamicalRoot = NodeType.DynamicalModelNodeRoot¶
Folder = NodeType.Folder¶
InteractionModel = NodeType.InteractionModel¶
InteractionModelArticulatedBodySystem = NodeType.InteractionModelArticulatedBodySystem¶
InteractionModelParticleSystem = NodeType.InteractionModelParticleSystem¶
InteractionModelRigidBodySystem = NodeType.InteractionModelRigidBodySystem¶
Label = NodeType.Label¶
Mesh = NodeType.VisualModelMesh¶
Molecule = NodeType.StructuralModelNodeMolecule¶
NodeGroup = NodeType.DataGraphNodeGroup¶
ParticleSystem = NodeType.DynamicalModelParticleSystem¶
Path = NodeType.StructuralModelPath¶
PropertyModel = NodeType.PropertyModel¶
PropertyModelFunction = NodeType.PropertyModelFunction¶
Protein = NodeType.StructuralModelNodeProtein¶
PseudoAtom = NodeType.StructuralModelNodePseudoAtom¶
Residue = NodeType.StructuralModelNodeResidue¶
RigidBody = NodeType.DynamicalModelNodeRigidBody¶
RigidBodySystem = NodeType.DynamicalModelRigidBodySystem¶
Root = NodeType.StructuralModelNodeRoot¶
Segment = NodeType.StructuralModelNodeSegment¶
SideChain = NodeType.StructuralModelNodeSideChain¶
Simulator = NodeType.Simulator¶
SimulatorArticulatedBodySystem = NodeType.SimulatorArticulatedBodySystem¶
SimulatorParticleSystem = NodeType.SimulatorParticleSystem¶
SimulatorRigidBodySystem = NodeType.SimulatorRigidBodySystem¶
StateUpdater = NodeType.StateUpdater¶
StateUpdaterArticulatedBodySystem = NodeType.StateUpdaterArticulatedBodySystem¶
StateUpdaterParticleSystem = NodeType.StateUpdaterParticleSystem¶
StateUpdaterRigidBodySystem = NodeType.StateUpdaterRigidBodySystem¶
StructuralGroup = NodeType.StructuralModelNodeGroup¶
StructuralModel = NodeType.StructuralModel¶
StructuralModelConformation = NodeType.StructuralModelConformation¶
StructuralModelNode = NodeType.StructuralModelNode¶
StructuralModelNodeAtom = NodeType.StructuralModelNodeAtom¶
StructuralModelNodeBackbone = NodeType.StructuralModelNodeBackbone¶
StructuralModelNodeBond = NodeType.StructuralModelNodeBond¶
StructuralModelNodeChain = NodeType.StructuralModelNodeChain¶
StructuralModelNodeGroup = NodeType.StructuralModelNodeGroup¶
StructuralModelNodeMolecule = NodeType.StructuralModelNodeMolecule¶
StructuralModelNodeParticle = NodeType.StructuralModelNodeParticle¶
StructuralModelNodeProtein = NodeType.StructuralModelNodeProtein¶
StructuralModelNodePseudoAtom = NodeType.StructuralModelNodePseudoAtom¶
StructuralModelNodeResidue = NodeType.StructuralModelNodeResidue¶
StructuralModelNodeRoot = NodeType.StructuralModelNodeRoot¶
StructuralModelNodeSegment = NodeType.StructuralModelNodeSegment¶
StructuralModelNodeSideChain = NodeType.StructuralModelNodeSideChain¶
StructuralModelPath = NodeType.StructuralModelPath¶
StructuralParticle = NodeType.StructuralModelNodeParticle¶
Undefined = NodeType.Undefined¶
VisualModel = NodeType.VisualModel¶
VisualModelMesh = NodeType.VisualModelMesh¶
name¶

(self – handle) -> str

addChild(self: samson.DataModel.DataGraph.Node, node: samson.DataModel.DataGraph.Node, nextNode: samson.DataModel.DataGraph.Node = None) → bool¶

Adds a child to the node

canAddChild(self: samson.DataModel.DataGraph.Node, node: samson.DataModel.DataGraph.Node, nextNode: samson.DataModel.DataGraph.Node = None) → bool¶

Returns whether this node can add node as a child

canAddChildType(self: samson.DataModel.DataGraph.Node, nodeType: SBDDataGraphNode::Type) → bool¶

Returns whether this node can add a node with type nodeType as a child

castToInteractionModelParticleSystem(self: samson.DataModel.DataGraph.Node) → SBMInteractionModelParticleSystem¶

Casts (if possible) from SBDDataGraphNode to SBMInteractionModelParticleSystem

castToLabel(self: samson.DataModel.DataGraph.Node) → SBDDocumentLabel¶

Casts (if possible) from SBDDataGraphNode to SBDDocumentLabel

castToMesh(self: samson.DataModel.DataGraph.Node) → SBMVisualModelMesh¶

Casts (if possible) from SBDDataGraphNode to SBMVisualModelMesh

castToVisualModel(self: samson.DataModel.DataGraph.Node) → SBMVisualModel¶

Casts (if possible) from SBDDataGraphNode to SBMVisualModel

clone(self: samson.DataModel.DataGraph.Group) → samson.DataModel.DataGraph.Group¶

Returns a copy of the node and its descendants

countNodes(self: samson.DataModel.DataGraph.Node, selectionString: str = '*', visitString: str = '*', includeDependencies: bool = False) → int¶
Count nodes into nodeIndexer, based on a selectionPredicate and a visitPredicate, with our without dependencies).
For selectionString and visitString use Node Specification Language (SAMSON API: pagenodespecificationlanguage
create(self: samson.DataModel.DataGraph.Node) → None¶

Creates the node

erase(self: samson.DataModel.DataGraph.Node) → None¶

Erases the node

getDocument(self: samson.DataModel.DataGraph.Node) → SBDDocument¶

Returns the document the node belongs to

getFlags(self: samson.DataModel.DataGraph.Node) → int¶

Returns the flags

getGroupNodes(self: samson.DataModel.DataGraph.Group) → samson.DataModel.DataGraph.NodeIndexer¶

Returns the index of nodes belonging to the group

getHierarchyString(self: samson.DataModel.DataGraph.Node, separator: str = '/', includeNodeType: bool = False) → str¶

Returns a string with hierarchical information on the node and its parents names

getInheritedFlags(self: samson.DataModel.DataGraph.Node) → int¶

Returns the inherited flags

getMaterial(self: samson.DataModel.DataGraph.Node) → SBDDataGraphNodeMaterial¶

Returns the material of the node

getMaterialOwner(self: samson.DataModel.DataGraph.Node) → samson.DataModel.DataGraph.Node¶

Returns the node whose material is inherited

getMemoryFootprint(self: samson.Core.Reference.ReferenceTarget) → int¶

Returns the memory footprint

getNextGroup(self: samson.DataModel.DataGraph.Group) → samson.DataModel.DataGraph.Group¶

Returns the next group

getNextNode(*args, **kwargs)¶

Overloaded function.

  1. getNextNode(self: samson.DataModel.DataGraph.Node) -> samson.DataModel.DataGraph.Node

Returns the pointer to the next node in the children of the node’s parent

  1. getNextNode(self: samson.DataModel.DataGraph.Node, nodeType: SBDDataGraphNode::Type) -> samson.DataModel.DataGraph.Node

Returns the pointer to the next node with type nodeType in the children of the node’s parent

getNode(self: int) → samson.DataModel.DataGraph.Node¶

Returns the unique node corresponding to the node index nodeIndex

getNodes(self: samson.DataModel.DataGraph.Node, selectionString: str = '*', visitString: str = '*', includeDependencies: bool = False) → samson.DataModel.DataGraph.NodeIndexer¶
Returns nodes (in a node indexer), based on a selectionString and a visitString, with our without dependencies).
For selectionString and visitString use Node Specification Language (SAMSON API: pagenodespecificationlanguage
getParent(self: samson.DataModel.DataGraph.Node) → samson.DataModel.DataGraph.Node¶

Returns the parent of the node

getPreviousGroup(self: samson.DataModel.DataGraph.Group) → samson.DataModel.DataGraph.Group¶

Returns the previous group

getPreviousNode(*args, **kwargs)¶

Overloaded function.

  1. getPreviousNode(self: samson.DataModel.DataGraph.Node) -> samson.DataModel.DataGraph.Node

Returns the pointer to the previous node in the children of the node’s parent

  1. getPreviousNode(self: samson.DataModel.DataGraph.Node, nodeType: SBDDataGraphNode::Type) -> samson.DataModel.DataGraph.Node

Returns the pointer to the previous node with type nodeType in the children of the node’s parent

getRoot(self: samson.DataModel.DataGraph.Node) → samson.DataModel.DataGraph.Node¶

Returns the root of the hierarchy the node belongs to

getThisNode(self: samson.DataModel.DataGraph.Node) → samson.DataModel.DataGraph.Node¶

Returns the pointer to this node

getTypeString(type: SBDDataGraphNode::Type) → str¶

Returns a string describing the type of the data graph node

hasOneOf(self: samson.DataModel.DataGraph.Node, nodeIndexer: SBDDataGraphNodeIndexer) → bool¶

Returns true if and only if this node is one of the nodes of the nodeIndexer, or is the ancestor of one of them

isDynamicalModel(self: samson.DataModel.DataGraph.Node) → bool¶

Returns true when the node is a dynamical model

isIn(*args, **kwargs)¶

Overloaded function.

  1. isIn(self: samson.DataModel.DataGraph.Node, node: samson.DataModel.DataGraph.Node) -> bool

Returns true if and only if this node is node, or descends from it

  1. isIn(self: samson.DataModel.DataGraph.Node, nodeIndexer: SBDDataGraphNodeIndexer) -> bool

Returns true if and only if this node is one of the nodes of the nodeIndexer, or descends from one of them

isInteractionModel(self: samson.DataModel.DataGraph.Node) → bool¶

Returns true when the node is a interaction model

isMesh(self: samson.DataModel.DataGraph.Node) → bool¶

Returns true when the node is a mesh

isModel(self: samson.DataModel.DataGraph.Node) → bool¶

Returns true when the node is a model

isOneOf(self: samson.DataModel.DataGraph.Node, nodeIndexer: SBDDataGraphNodeIndexer) → bool¶

Returns true if and only if this node is one of the nodes of the nodeIndexer

isPropertyModel(self: samson.DataModel.DataGraph.Node) → bool¶

Returns true when the node is a property model

isSimulator(self: samson.DataModel.DataGraph.Node) → bool¶

Returns true when the node is a simulator

isStructuralModel(self: samson.DataModel.DataGraph.Node) → bool¶

Returns true when the node is a structural model

isStructuralParticle(self: samson.DataModel.DataGraph.Node) → bool¶

Returns true when the node is a structural particle (an atom or a pseudo-atom)

isType(self: samson.DataModel.DataGraph.Node, type: SBDDataGraphNode::Type) → bool¶

Returns true when the type of the node corresponds to type

isVisualModel(self: samson.DataModel.DataGraph.Node) → bool¶

Returns true when the node is a visual model

printDebugInfo(self: samson.DataModel.DataGraph.Group, offset: int = 0) → None¶

Prints some debugging information in stdout

removeChild(self: samson.DataModel.DataGraph.Node, node: samson.DataModel.DataGraph.Node) → bool¶

Removes a child from the node

removeMaterial(self: samson.DataModel.DataGraph.Node) → bool¶

Removes material from the node

setColor(self: samson.DataModel.DataGraph.Node, color: SBDTypeColor) → bool¶

Sets the color for the node (modifies an existing material of the node or adds a material with a given color)

Args:
color (Color): color to set
setColorScheme(self: samson.DataModel.DataGraph.Node, colorScheme: SBDDataGraphNodeColorScheme) → bool¶

Sets the color scheme for the node (modifies an existing material of the node or adds a material with a given color scheme)

Args: colorScheme (ColorScheme): color scheme to set
setMaterial(self: samson.DataModel.DataGraph.Node, material: SBDDataGraphNodeMaterial) → bool¶

Sets the material for the node.

Args:
material (Material): material to set
ArticulatedBody = NodeType.DynamicalModelNodeArticulatedBody¶
ArticulatedBodySystem = NodeType.DynamicalModelArticulatedBodySystem¶
Asset = NodeType.Asset¶
Atom = NodeType.StructuralModelNodeAtom¶
Backbone = NodeType.StructuralModelNodeBackbone¶
Bond = NodeType.StructuralModelNodeBond¶
Camera = NodeType.Camera¶
Chain = NodeType.StructuralModelNodeChain¶
Conformation = NodeType.StructuralModelConformation¶
Controller = NodeType.Controller¶
ControllerNode = NodeType.ControllerNode¶
DataGraphNodeGroup = NodeType.DataGraphNodeGroup¶
Document = NodeType.Document¶
DocumentManager = NodeType.DocumentManager¶
DynamicalGroup = NodeType.DynamicalModelNodeGroup¶
DynamicalModel = NodeType.DynamicalModel¶
DynamicalModelArticulatedBodySystem = NodeType.DynamicalModelArticulatedBodySystem¶
DynamicalModelNode = NodeType.DynamicalModelNode¶
DynamicalModelNodeArticulatedBody = NodeType.DynamicalModelNodeArticulatedBody¶
DynamicalModelNodeGroup = NodeType.DynamicalModelNodeGroup¶
DynamicalModelNodeParticle = NodeType.DynamicalModelNodeParticle¶
DynamicalModelNodeRigidBody = NodeType.DynamicalModelNodeRigidBody¶
DynamicalModelNodeRoot = NodeType.DynamicalModelNodeRoot¶
DynamicalModelParticleSystem = NodeType.DynamicalModelParticleSystem¶
DynamicalModelRigidBodySystem = NodeType.DynamicalModelRigidBodySystem¶
DynamicalNode = NodeType.DynamicalModelNode¶
DynamicalParticle = NodeType.DynamicalModelNodeParticle¶
DynamicalRoot = NodeType.DynamicalModelNodeRoot¶
Folder = NodeType.Folder¶
InteractionModel = NodeType.InteractionModel¶
InteractionModelArticulatedBodySystem = NodeType.InteractionModelArticulatedBodySystem¶
InteractionModelParticleSystem = NodeType.InteractionModelParticleSystem¶
InteractionModelRigidBodySystem = NodeType.InteractionModelRigidBodySystem¶
Label = NodeType.Label¶
Mesh = NodeType.VisualModelMesh¶
Molecule = NodeType.StructuralModelNodeMolecule¶
NodeGroup = NodeType.DataGraphNodeGroup¶
ParticleSystem = NodeType.DynamicalModelParticleSystem¶
Path = NodeType.StructuralModelPath¶
PropertyModel = NodeType.PropertyModel¶
PropertyModelFunction = NodeType.PropertyModelFunction¶
Protein = NodeType.StructuralModelNodeProtein¶
PseudoAtom = NodeType.StructuralModelNodePseudoAtom¶
Residue = NodeType.StructuralModelNodeResidue¶
RigidBody = NodeType.DynamicalModelNodeRigidBody¶
RigidBodySystem = NodeType.DynamicalModelRigidBodySystem¶
Root = NodeType.StructuralModelNodeRoot¶
Segment = NodeType.StructuralModelNodeSegment¶
SideChain = NodeType.StructuralModelNodeSideChain¶
Simulator = NodeType.Simulator¶
SimulatorArticulatedBodySystem = NodeType.SimulatorArticulatedBodySystem¶
SimulatorParticleSystem = NodeType.SimulatorParticleSystem¶
SimulatorRigidBodySystem = NodeType.SimulatorRigidBodySystem¶
StateUpdater = NodeType.StateUpdater¶
StateUpdaterArticulatedBodySystem = NodeType.StateUpdaterArticulatedBodySystem¶
StateUpdaterParticleSystem = NodeType.StateUpdaterParticleSystem¶
StateUpdaterRigidBodySystem = NodeType.StateUpdaterRigidBodySystem¶
StructuralGroup = NodeType.StructuralModelNodeGroup¶
StructuralModel = NodeType.StructuralModel¶
StructuralModelConformation = NodeType.StructuralModelConformation¶
StructuralModelNode = NodeType.StructuralModelNode¶
StructuralModelNodeAtom = NodeType.StructuralModelNodeAtom¶
StructuralModelNodeBackbone = NodeType.StructuralModelNodeBackbone¶
StructuralModelNodeBond = NodeType.StructuralModelNodeBond¶
StructuralModelNodeChain = NodeType.StructuralModelNodeChain¶
StructuralModelNodeGroup = NodeType.StructuralModelNodeGroup¶
StructuralModelNodeMolecule = NodeType.StructuralModelNodeMolecule¶
StructuralModelNodeParticle = NodeType.StructuralModelNodeParticle¶
StructuralModelNodeProtein = NodeType.StructuralModelNodeProtein¶
StructuralModelNodePseudoAtom = NodeType.StructuralModelNodePseudoAtom¶
StructuralModelNodeResidue = NodeType.StructuralModelNodeResidue¶
StructuralModelNodeRoot = NodeType.StructuralModelNodeRoot¶
StructuralModelNodeSegment = NodeType.StructuralModelNodeSegment¶
StructuralModelNodeSideChain = NodeType.StructuralModelNodeSideChain¶
StructuralModelPath = NodeType.StructuralModelPath¶
StructuralParticle = NodeType.StructuralModelNodeParticle¶
Undefined = NodeType.Undefined¶
VisualModel = NodeType.VisualModel¶
VisualModelMesh = NodeType.VisualModelMesh¶
highlightingFlag¶
isCreated¶

Returns true if and only if the node is created

isErased¶

Returns true if and only if the node is erased

isHighlighted¶

Returns whether the node is highlighted

isSelected¶

Returns whether the node is selected

isSerializable¶

Returns true when the class is serializable

isVisible¶

Returns whether the node is visible

name¶

The name of the node

nodeIndex¶

Returns the node index (unique in the whole data graph, but non-persistent)

selectionFlag¶
size¶

Returns the number of nodes belonging to the group

type¶

Returns the type of the data graph node

typeString¶

Returns a string describing the type of this data graph node

visibilityFlag¶