topologicpy.ShapeGrammar module
- class topologicpy.ShapeGrammar.ShapeGrammar
Bases:
objectMethods
AddRule(input, output[, title, description, ...])Adds a rule to the topology grammar.
ApplicableRules(topology[, keys, silent])Returns rules applicable to the input topology.
ApplyRule(topology[, rule, matrix, ...])Returns rules applicable to the input topology.
ClusterByInputOutput(input, output[, silent])Returns the Plotly figure of the input and output topologies as a rule.
ClusterByRule(rule[, silent])Returns the Plotly figure of the input rule.
FigureByInputOutput(input, output[, silent])Returns the Plotly figure of the input and output topologies as a rule.
FigureByRule(rule[, silent])Returns the Plotly figure of the input rule.
OperationByTitle(title)Returns the operation given the input title string
Returns the list of available operation titles.
- AddRule(input, output, title: str = 'Untitled Rule', description: str = '', operation: dict = None, matrix: list = None, silent: bool = False)
Adds a rule to the topology grammar.
- Parameters
- inputtopologic_core.Topology
The linput topology of the rule.
- outputtopologic_core.Topology
The output topology of the rule.
- titlestr , optional
The title of the rule. Default is “Untitled Rule”
- descriptionstr, optional
The description of the rule. Default is “”.
- operationdict , optional
The desired rule operation. See Rule Operations. If set to None, the replacement rule is applied. Default is None.
- matrixlist
The 4x4 transformation matrix that tranforms the output topology to the input topology. If set to None, no transformation is applied. Default is None.
- silentbool, optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- None
This method does not return a value.
- ApplicableRules(topology, keys: list = None, silent: bool = False)
Returns rules applicable to the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology
- keyslist , optional
The list of dictionary keys to semantically match the rules. Default is None which means dictionaries are not considered.
- silentbool, optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- list
The list of applicable rules.
- ApplyRule(topology, rule: dict = None, matrix: list = None, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False)
Returns rules applicable to the input topology.
- Parameters
- topologytopologic_core.Topology
The input topology
- ruledict , optional
The desired rule to apply. Default is None.
- matrixlist
The 4x4 transformation matrix that tranforms the output topology to the input topology. If set to None, no transformation is applied. Default is None.
- mantissaint, optional
Decimal precision. Default is 6.
- tolerancefloat, optional
The desired Tolerance. Not used here but included for API compatibility. Default is 0.0001.
- silentbool, optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Topology
The transformed topology
- ClusterByInputOutput(input, output, silent: bool = False)
Returns the Plotly figure of the input and output topologies as a rule.
- Parameters
- inputtopologic_core.Topology
The input topology
- outputtopologic_core.Topology
The output topology
- silentbool, optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- This function does not return a value
- ClusterByRule(rule, silent: bool = False)
Returns the Plotly figure of the input rule.
- Parameters
- ruledict
The input rule
- silentbool, optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- topologic_core.Cluster
The created rule cluster
- FigureByInputOutput(input, output, silent: bool = False)
Returns the Plotly figure of the input and output topologies as a rule.
- Parameters
- inputtopologic_core.Topology
The input topology
- outputtopologic_core.Topology
The output topology
- silentbool, optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- Plotly.Figure
The created plotly figure.
- FigureByRule(rule, silent: bool = False)
Returns the Plotly figure of the input rule.
- Parameters
- ruledict
The input rule
- silentbool, optional
If set to True, error and warning messages are suppressed. Default is False.
- Returns
- Plotly.Figure
The create plotly figure
- OperationByTitle(title)
Returns the operation given the input title string
- Parameters
- titlestr
The input operation str. See OperationTitles for list of operations.
- Returns
- ShapeGrammar.Operation
The requested operation
- OperationTitles()
Returns the list of available operation titles.
- Parameters
- Returns
- list
The requested list of operation titles