SAMSON Library¶
This module is the main interface.
You can access some of SAMSON functionality directly from this module, for example:
activeDocument = SAMSON.getActiveDocument()
See also
SAMSON API: SAMSON
This class is the main interface of SAMSON. It acts as a facade that centralizes and exposes other functions from the SAMSON API to make it easy for developers to interact with SAMSON, the data graph, etc. All functions in this class are static.
- samson.Facade.SAMSON.askUser(*args, **kwargs)¶
Overloaded function.
askUser(dialogTitle: str, dialogText: str) -> bool
Asks a question to the user with a message in a modal pop-up dialog
askUser(dialogTitle: str, labelText: str, text: str, monospaceFont: bool) -> bool
Asks a question to the user with a message in a modal pop-up dialog
- samson.Facade.SAMSON.beginHolding(name: str) None ¶
Begins holding
- samson.Facade.SAMSON.captureViewport(width: int, height: int, transparentBackground: bool = False) QImage ¶
Captures the viewport
- samson.Facade.SAMSON.captureViewportToFile(filename: str, width: int, height: int, transparentBackground: bool = False) None ¶
Captures the viewport into file
- samson.Facade.SAMSON.disableHolding() None ¶
Pauses holding
- samson.Facade.SAMSON.enableHolding() None ¶
Resumes holding
- samson.Facade.SAMSON.endHolding() None ¶
Ends holding
- samson.Facade.SAMSON.exit() None ¶
Exits SAMSON with a dialog
- samson.Facade.SAMSON.exportToFile(*args, **kwargs)¶
Overloaded function.
exportToFile(nodeIndexer: samson.DataModel.DataGraph.NodeIndexer, fileName: str) -> None
Export a selection of nodes to a file
exportToFile(nodeIndexer: samson.DataModel.DataGraph.NodeIndexer, fileName: str, parameters: List[str]) -> None
Export a selection of nodes to a file with parameters specific to each exporter
- samson.Facade.SAMSON.getAction(*args, **kwargs)¶
Overloaded function.
getAction(actionUUID: samson.Core.Container.UUID) -> samson.GUI.Action.Action
Returns the action with the given actionUUID
getAction(actionUUID: str) -> samson.GUI.Action.Action
Returns the action with the given actionUUID
- samson.Facade.SAMSON.getActiveCamera() samson.DataModel.Document.Camera ¶
Returns the active camera
- samson.Facade.SAMSON.getActiveDocument() samson.DataModel.Document.Document ¶
Returns the active document
- samson.Facade.SAMSON.getActiveDocumentFilter() str ¶
Returns the node filter of the active document
- samson.Facade.SAMSON.getActiveStructuralModel() samson.Modeling.StructuralModel.StructuralModel ¶
Returns the active structural model
- samson.Facade.SAMSON.getAtom(x: int, y: int) samson.Modeling.StructuralModel.Atom ¶
Returns the atom at location (x, y) in the viewport
- samson.Facade.SAMSON.getAtomRadius() samson.DataModel.Quantity.unitsSI ¶
Get the radius of atoms in the default representation of structural models
- samson.Facade.SAMSON.getAtomicWeight(element: samson.Modeling.Element.Element.ElementType) samson.DataModel.Quantity.unitsSI ¶
Returns the atomic weight of periodic table element element
- samson.Facade.SAMSON.getBlock(element: samson.Modeling.Element.Element.ElementType) str ¶
Returns the block of periodic table element element
- samson.Facade.SAMSON.getBond(x: int, y: int) samson.Modeling.StructuralModel.Bond ¶
Returns the bond at location (x, y) in the viewport
- samson.Facade.SAMSON.getBondRadius() samson.DataModel.Quantity.unitsSI ¶
Get the radius of bonds in the default representation of structural models
- samson.Facade.SAMSON.getCameraControllerFlag() bool ¶
Returns true when the camera controller should be displayed in the viewport
- samson.Facade.SAMSON.getColorFromUser(dialogTitle: str = 'Choose a color') tuple ¶
Gets a color from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getColorPaletteFromUser(dialogTitle: str = 'Choose a color palette', defaultColorPalette: samson.DataModel.Color.ColorPalette = 0) tuple ¶
Gets a color palette from the user in a modal pop-up dialog. If the defaultColorPalette is provided it is set as a default one in the color palette dialog
- samson.Facade.SAMSON.getCovalentRadius(element: samson.Modeling.Element.Element.ElementType) samson.DataModel.Quantity.unitsSI ¶
Returns the covalent radius of periodic table element element
- samson.Facade.SAMSON.getCurrentSelectionFilter() str ¶
Returns the current selection filter name
- samson.Facade.SAMSON.getDeepSelectionFlag() bool ¶
Returns whether the user wants deep selection
- samson.Facade.SAMSON.getDoubleFromUser(dialogTitle: str, minimum: float, maximum: float, singleStep: float = 1.0, prefix: str = '', suffix: str = '', decimals: int = 2) tuple ¶
Gets a number from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getDoubleIntervalFromUser(dialogTitle: str, labelsText: List[str], currentValues: Tuple[float, float], minValueInterval: Tuple[float, float], maxValueInterval: Tuple[float, float], singleStep: Tuple[float, float] = (1.0, 1.0), prefix: str = '', suffix: str = '') tuple ¶
Gets a double interval from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getElectronegativity(element: samson.Modeling.Element.Element.ElementType) samson.DataModel.Quantity.unitsSI ¶
Returns the electronegativity of periodic table element element
- samson.Facade.SAMSON.getElementFromUser(dialogTitle: str = 'Set a string') tuple ¶
Gets a periodic table element from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getElementName(element: samson.Modeling.Element.Element.ElementType) str ¶
Returns the name of the periodic table element corresponding to a given type
- samson.Facade.SAMSON.getElementSymbol(element: samson.Modeling.Element.Element.ElementType) str ¶
Returns the symbol of the periodic table element corresponding to a given type
- samson.Facade.SAMSON.getElementTypeByName(elementName: str) samson.Modeling.Element.Element.ElementType ¶
Returns the periodic table element type corresponding to a given name
- samson.Facade.SAMSON.getElementTypeBySymbol(elementSymbol: str) samson.Modeling.Element.Element.ElementType ¶
Returns the periodic table element type corresponding to a given symbol
- samson.Facade.SAMSON.getElementsFromUser(dialogTitle: str = 'Set a string') tuple ¶
Gets periodic table elements from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getFileNameFromUser(dialogTitle: str = 'Choose a filename', dir: str = '', filter: str = '') tuple ¶
Gets a filename from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getFileNamesFromUser(dialogTitle: str = 'Choose a filename', dir: str = '', filter: str = '') tuple ¶
Gets filenames from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getGridFlag() bool ¶
Returns true when the grid should be displayed in the viewport
- samson.Facade.SAMSON.getGroup(element: samson.Modeling.Element.Element.ElementType) int ¶
Returns the group of periodic table element element
- samson.Facade.SAMSON.getIntegerFromUser(dialogTitle: str, minimum: int, maximum: int, singleStep: int = 1, prefix: str = '', suffix: str = '') tuple ¶
Gets a number from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getIntegerIntervalFromUser(dialogTitle: str, labelsText: List[str], currentValues: Tuple[int, int], minValueInterval: Tuple[int, int], maxValueInterval: Tuple[int, int], singleStep: Tuple[int, int] = (1, 1), prefix: str = '', suffix: str = '') tuple ¶
Gets an integer interval from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getItemFromUser(*args, **kwargs)¶
Overloaded function.
getItemFromUser(dialogTitle: str, label: str, items: List[str], current: int = 0) -> tuple
Gets an item from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
getItemFromUser(dialogTitle: str, currentIndex: int, label: str, items: List[str]) -> tuple
Gets an item from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getMaximum3DTextureSize() int ¶
Returns the maximum 3D texture size
- samson.Facade.SAMSON.getMaximumRectangleTextureSize() int ¶
Returns the maximum rectangle texture size
- samson.Facade.SAMSON.getMaximumTextureSize() int ¶
Returns the maximum texture size
- samson.Facade.SAMSON.getMousePositionInViewport() QPoint ¶
Returns the current mouse position in viewport coordinates
- samson.Facade.SAMSON.getMultiSampleFactor() int ¶
Returns the multisampling factor
- samson.Facade.SAMSON.getMultipleBondDisplayFlag() bool ¶
Returns true when bonds are displayed with a variable number of cylinders to represent their order
- samson.Facade.SAMSON.getNode(x: int, y: int, selectionFilter: str = '*') samson.DataModel.DataGraph.Node ¶
- Returns the node at location (x, y) in the viewport based on the selection filter selectionString.
For selectionString use the Node Specification Language (SAMSON API: Node Specification Language)
- samson.Facade.SAMSON.getNodes(*args, **kwargs)¶
Overloaded function.
getNodes(x: int, y: int, width: int, height: int, selectionFilter: str = ‘*’, deepSelectionFlag: bool = False) -> samson.DataModel.DataGraph.NodeIndexer
- Returns the nodes (in a node indexer) found inside the viewport rectangle (x, y, width, height) and based on a selectionString.
For selectionString use the Node Specification Language (SAMSON API: Node Specification Language
getNodes(selectionString: str = ‘*’) -> samson.DataModel.DataGraph.NodeIndexer
- Returns nodes (in a node indexer), based on a selectionString.
For selectionString use Node Specification Language (SAMSON API: Node Specification Language
- samson.Facade.SAMSON.getNumberOfElements() int ¶
Returns the number of defined periodic table elements, including the Unknown element
- samson.Facade.SAMSON.getPathFromUser(dialogTitle: str = 'Choose a path') tuple ¶
Gets a path from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getPeriod(element: samson.Modeling.Element.Element.ElementType) str ¶
Returns the period of periodic table element element
- samson.Facade.SAMSON.getProxy(className: str, elementUUID: samson.Core.Container.UUID =) samson.Core.Class.ClassProxy ¶
Returns the proxy of a class
- samson.Facade.SAMSON.getPublicName(includeVersion: bool = False, includeHashInVersion: bool = False) str ¶
Returns the “public name” of SAMSON
- samson.Facade.SAMSON.getPublicVersionNumber() str ¶
Returns the “public version number” of SAMSON
- samson.Facade.SAMSON.getReplyFromUser(developerUUIDString: str, questionUUIDString: str) None ¶
Asks the user to reply to a question
- samson.Facade.SAMSON.getSAMSONElementsPath() str ¶
Returns the path where SAMSON Elements are installed
- samson.Facade.SAMSON.getSAMSONPath() str ¶
Returns the path where SAMSON is installed
- samson.Facade.SAMSON.getSaveFileNameFromUser(dialogTitle: str = 'Choose a filename', dir: str = '', filter: str = '') tuple ¶
Gets a filename from the user in a modal pop-up dialog with Save button. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getScaleFlag() bool ¶
Returns true when the scale should be displayed in the viewport
- samson.Facade.SAMSON.getScratchPath() str ¶
Returns the path to scratch data
- samson.Facade.SAMSON.getSimulationFlag() bool ¶
Returns true when interactive simulation is on
- samson.Facade.SAMSON.getStringFromUser(dialogTitle: str = 'Set a string') tuple ¶
Gets a string from the user in a modal pop-up dialog. Returns a tuple: True/False (False in case if Cancel button was clicked) and the resulting value if Ok button was clicked
- samson.Facade.SAMSON.getTime() int ¶
Returns SAMSON’s internal time
- samson.Facade.SAMSON.getUserDataPath() str ¶
Returns the path where user data is installed
- samson.Facade.SAMSON.getUserPlan() samson.Core.Container.UserPlan ¶
Returns the user plan
- samson.Facade.SAMSON.getUserPlanString() str ¶
Returns a string containing the user plan
- samson.Facade.SAMSON.getVanDerWaalsAtomRadiusFlag() bool ¶
Returns true when atoms are displayed with a radius proportional to their van der Waals radius
- samson.Facade.SAMSON.getVanDerWaalsAtomRadiusRatio() float ¶
Returns the constant by which the atoms van der Waals radius is multiplied to represent atoms in the viewport (when a constant radius is not used)
- samson.Facade.SAMSON.getVanDerWaalsRadius(element: samson.Modeling.Element.Element.ElementType) samson.DataModel.Quantity.unitsSI ¶
Returns the van der Waals radius of periodic table element element
- samson.Facade.SAMSON.getVersionNumber() samson.Core.Container.VersionNumber ¶
Returns the version number of SAMSON
- samson.Facade.SAMSON.getViewportHeight() int ¶
Returns the viewport height
- samson.Facade.SAMSON.getViewportPositionFromWorldPosition(position: samson.DataModel.Type.vector3) samson.DataModel.Type.vector3 ¶
Returns the projection in the viewport of a given world position
- samson.Facade.SAMSON.getViewportWidth() int ¶
Returns the viewport width
- samson.Facade.SAMSON.hideProgressBar() None ¶
Hides the progress bar
- samson.Facade.SAMSON.hold(node: samson.DataModel.DataGraph.Node) None ¶
Holds a node and its descendants
- samson.Facade.SAMSON.importFromFile(*args, **kwargs)¶
Overloaded function.
importFromFile(fileName: str, preferredFolder: samson.DataModel.Document.Folder = None) -> None
Import a file from the disk
importFromFile(fileNameList: List[str], preferredFolder: samson.DataModel.Document.Folder = None) -> None
Import a file list from the disk
importFromFile(fileName: str, parameters: List[str] = 0, preferredFolder: samson.DataModel.Document.Folder = None) -> None
Import a file from the disk with parameters specific to each importer
importFromFile(fileNameList: List[str], parameters: List[str] = 0, preferredFolder: samson.DataModel.Document.Folder = None) -> None
Import a file list from the disk with parameters specific to each importer
- samson.Facade.SAMSON.informUser(*args, **kwargs)¶
Overloaded function.
informUser(dialogTitle: str, dialogText: str) -> None
Informs the user with a message in a modal pop-up dialog
informUser(dialogTitle: str, labelText: str, text: str, monospaceFont: bool) -> None
Informs the user with a message in a modal pop-up dialog
- samson.Facade.SAMSON.isGUIThread() bool ¶
Returns true if called from the main thread (GUI thread), else return false
- samson.Facade.SAMSON.isHolding() bool ¶
Returns true when SAMSON is holding
- samson.Facade.SAMSON.isProgressBarStopped() bool ¶
Returns true when the progress bar is stopped
- samson.Facade.SAMSON.isRedoing() bool ¶
Returns true while redoing
- samson.Facade.SAMSON.isUndoing() bool ¶
Returns true while undoing
- samson.Facade.SAMSON.makeAnimation(name: str, nodeIndexer: samson.DataModel.DataGraph.NodeIndexer, currentFrame: float, animationClassName: str, animationElementUUID: samson.Core.Container.UUID =) samson.DataModel.Document.Animation ¶
Make an animation
- samson.Facade.SAMSON.makeInteractionModel(dynamicalModel: samson.Modeling.DynamicalModel.ParticleSystem, interactionModelClassName: str, interactionModelElementUUID: samson.Core.Container.UUID =) samson.Modeling.InteractionModel.ParticleSystem ¶
Make an interaction model
- samson.Facade.SAMSON.makeNeigborSearch(dynamicalModel: samson.Modeling.DynamicalModel.ParticleSystem, cutoffDistance: samson.DataModel.Quantity.unitsSI, neighborSearchClassName: str, ineighborSearchElementUUID: samson.Core.Container.UUID =) samson.Simulation.NeighborSearch.ParticleSystem ¶
Make a neighbor search algorithm
- samson.Facade.SAMSON.makePropertyModel(nodeIndexer: samson.DataModel.DataGraph.NodeIndexer, propertyModelClassName: str, propertyModelElementUUID: samson.Core.Container.UUID =) SBMPropertyModel ¶
Make a property model
- samson.Facade.SAMSON.makeSelector(selectorClassName: str, selectorElementUUID: samson.Core.Container.UUID =) samson.DataModel.DataGraph.Selector ¶
Make a selector
- samson.Facade.SAMSON.makeSimulator(nodeIndexer: samson.DataModel.DataGraph.NodeIndexer, interactionModelClassName: str, interactionModelElementUUID: samson.Core.Container.UUID, stateUpdaterClassName: str, stateUpdaterElementUUID: samson.Core.Container.UUID =) samson.Simulation.Simulator.SimulatorParticleSystem ¶
Make a simulator
- samson.Facade.SAMSON.makeStateUpdater(dynamicalModel: samson.Modeling.DynamicalModel.ParticleSystem, interactionModel: samson.Modeling.InteractionModel.ParticleSystem, stateUpdaterClassName: str, stateUpdaterElementUUID: samson.Core.Container.UUID =) samson.Simulation.StateUpdater.StateUpdaterParticleSystem ¶
Make a state updater
- samson.Facade.SAMSON.makeVisualModel(nodeIndexer: samson.DataModel.DataGraph.NodeIndexer, visualModelClassName: str, visualModelElementUUID: samson.Core.Container.UUID =) samson.Modeling.VisualModel.VisualModel ¶
Make a visual model
- samson.Facade.SAMSON.minimize(nodeIndexer: samson.DataModel.DataGraph.NodeIndexer, maximumNumberOfSteps: int, minimumNumberOfStepsInPlateau: int, energyDifferenceCriteria: samson.DataModel.Quantity.unitsSI, printMinimizationInformationFrequency: int = 100, askUser: bool = False) bool ¶
Minimize atoms in the nodeIndexer according to the provided criteria.
- samson.Facade.SAMSON.printDataGraphState() None ¶
Prints in the terminal the data graph state
- samson.Facade.SAMSON.printFullMemoryUsage() None ¶
Prints in the terminal full memory usage
- samson.Facade.SAMSON.printMemoryUsage() None ¶
Prints in the terminal memory usage
- samson.Facade.SAMSON.printRendererState() None ¶
Prints in the terminal the renderer state
- samson.Facade.SAMSON.printUndoStack() None ¶
Prints in the terminal the undo stack
- samson.Facade.SAMSON.processEvents() None ¶
Requests an update
- samson.Facade.SAMSON.redo() None ¶
Redo one command
- samson.Facade.SAMSON.requestViewportUpdate() None ¶
Requests a viewport update
- samson.Facade.SAMSON.setActiveDocumentFilter(filter: str) None ¶
Sets the node filter of the active document
- samson.Facade.SAMSON.setActiveEditor(classUUID: samson.Core.Container.UUID, elementUUID: samson.Core.Container.UUID) None ¶
Sets the current editor
- samson.Facade.SAMSON.setActiveStructuralModel(arg0: samson.Modeling.StructuralModel.StructuralModel) None ¶
Sets the active structural model
- samson.Facade.SAMSON.setBusy(isBusy: bool) None ¶
Notifies the user that SAMSON is busy
- samson.Facade.SAMSON.setCurrentSelectionFilter(selectionFilterName: str) bool ¶
Sets the current selection filter according to the given selection filter name. Returns true in case of the success.
- samson.Facade.SAMSON.setProgressBarValue(value: int) None ¶
Sets the value of the progress bar
- samson.Facade.SAMSON.setSimulationFlag(simulationFlag: bool) None ¶
Sets the interactive simulation flag
- samson.Facade.SAMSON.setStatusMessage(message: str, time: int = 0) None ¶
Shows a message in the status bar
- samson.Facade.SAMSON.showProgressBar(name: str = '', minimum: int = 0, maximum: int = 0, minimumDurationInSeconds: float = 2.0, isCancellable: bool = True, cancelButtonText: str = 'Cancel') None ¶
Shows the progress bar
- samson.Facade.SAMSON.showProperties(node: samson.DataModel.DataGraph.Node) bool ¶
Shows the properties widget of a node
- samson.Facade.SAMSON.snap(*args, **kwargs)¶
Overloaded function.
snap(x: int, y: int) -> List[int]
Returns the snapped mouse viewport displacement (x, y)
snap(x: int, y: int, pointInPlane: samson.DataModel.Type.vector3) -> List[int]
Returns the snapped mouse viewport displacement (x, y) in the plane containing pointInPlane
snap(displacement: samson.DataModel.Quantity.unitsSI) -> samson.DataModel.Quantity.unitsSI
Returns the snapped translational (if the provided displacement is in length units) or angular (if the provided displacement is in dimensionless units) displacement if the snapping of translational/angular displacements is on, else it returns the unchanged displacement
snap(displacement: samson.DataModel.Type.vector3) -> samson.DataModel.Type.vector3
Returns the snapped displacement if the snapping of translational displacements is on, else it returns the unchanged displacement
snap(rotationMatrix: samson.DataModel.Type.matrix33) -> samson.DataModel.Type.matrix33
Returns the snapped rotation matrix if the snapping of angular displacements is on, else it returns the unchanged rotationMatrix
snap(transform: samson.DataModel.Type.spatialTransform) -> samson.DataModel.Type.spatialTransform
Returns the snapped spatial transform according to the translational and angular snapping parameters
- samson.Facade.SAMSON.startSimulation() None ¶
Starts interactive simulation
- samson.Facade.SAMSON.startTimer() None ¶
Starts a new performance timer
- samson.Facade.SAMSON.stopSimulation() None ¶
Stops interactive simulation
- samson.Facade.SAMSON.stopTimer() List[samson.DataModel.Quantity.unitsSI] ¶
Stops the top performance timer. Returns elapsed time and total time [in seconds]
- samson.Facade.SAMSON.toggleSimulation() None ¶
Toggles interactive simulation on and off
- samson.Facade.SAMSON.undo() None ¶
Undo one command