-
Notifications
You must be signed in to change notification settings - Fork 3
Node
The Node
class represents a geometric or structural node within a system, defined by a point in space, along with optional attributes like a direction vector, identifying number, and other characteristics.
"Initializes a new Node instance.
- `id` (str): A unique identifier for the node.
- `type` (str): The class name, "Node".
- `point` (Point, optional): The location of the node in 3D space.
- `vector` (Vector, optional): A vector indicating the orientation or direction associated with the node.
- `number` (any, optional): An identifying number or label for the node.
- `distance` (float): A scalar attribute, potentially representing distance from a reference point or another node.
- `diameter` (any, optional): A diameter associated with the node, useful in structural applications.
- `comments` (str, optional): Additional comments or notes about the node.
-
__str__(self) -> str
: Generates a string representation of the Node. -
deserialize(data: dict) -> Node
: Recreates a Node object from a dictionary of serialized data. -
merge(self)
: Merges this node with others in a project according to defined rules.The actual implementation of this method should consider merging nodes based on proximity or other criteria within the project context.
-
serialize(self) -> dict
: Serializes the node's attributes into a dictionary.This method allows for the node's properties to be easily stored or transmitted in a dictionary format.
-
snap(self)
: Adjusts the node's position based on snapping criteria.This could involve aligning the node to a grid, other nodes, or specific geometric entities.
Generates a string representation of the Node.
str
: A string that represents the Node, including its type and potentially other identifying information.
Recreates a Node object from a dictionary of serialized data.
- data (dict): The dictionary containing the node's serialized data.
Node
: A new Node object initialized with the data from the dictionary.
Merges this node with others in a project according to defined rules.
The actual implementation of this method should consider merging nodes based on proximity or other criteria within the project context.
Serializes the node's attributes into a dictionary.
This method allows for the node's properties to be easily stored or transmitted in a dictionary format.
dict
: A dictionary containing the serialized attributes of the node.
Adjusts the node's position based on snapping criteria.
This could involve aligning the node to a grid, other nodes, or specific geometric entities.