Getting Started#
The volmdlr_tools package provides numerical methods for CAD analysis,
building on top of volmdlr and dessia_common. It offers graph-based
analysis, feature recognition, shape classification, and assembly analysis.
Installation#
Install from the root directory:
pip install -e .
For development with documentation and tests:
pip install -e .[doc,test]
Dependencies#
Core dependencies (installed automatically):
volmdlr>=0.18.2- BRep geometry librarydessia_common>=0.18.0- Serialization and platform integrationnetworkx- Graph algorithmsplot_data>=0.26.7- Visualization
Quick Examples#
Feature Recognition#
Extract blends (fillets) and cavities (holes) from a BRep shape:
from volmdlr.model import VolumeModel
from volmdlr_tools.features import FeatureProcessor
# Load a STEP file
model = VolumeModel.from_step("part.step")
shape = model.primitives[0]
# Extract features
processor = FeatureProcessor(shape=shape)
processor.extract_blends()
processor.extract_cavities()
# Access results
print(f"Found {processor.blend_count} blends")
print(f"Found {processor.cavity_count} cavities")
# Visualize
processor.show_features()
Sheet Metal Recognition#
Recognize sheet metal parts and extract features:
from volmdlr.model import VolumeModel
from volmdlr_tools.shapes.recognizers import SheetMetalRecognizer
from volmdlr_tools.features.extractors import SheetMetalFeatureExtractor
# Load and recognize
model = VolumeModel.from_step("sheet_metal_part.step")
shape = model.primitives[0]
recognizer = SheetMetalRecognizer(shape=shape)
if recognizer.perform():
sheet_metal = recognizer.result
print(f"Thickness: {sheet_metal.thickness:.3f}")
# Extract sheet metal features
extractor = SheetMetalFeatureExtractor(sheet_metal=sheet_metal)
extractor.perform()
for feature in extractor.boundary_features:
print(f" - {feature.__class__.__name__}")
Assembly Analysis#
Analyze CAD assemblies with graph-based methods:
from volmdlr.model import VolumeModel
from volmdlr_tools.graph.assembly import GraphAssembly
# Load assembly
model = VolumeModel.from_step("assembly.step")
# Create assembly graph
graph = GraphAssembly.from_volume_model(model)
# Access components
for node in graph.get_nodes():
print(f"Component: {graph[node]['name']}")
Shape Signatures#
Compare shapes using distribution signatures:
from volmdlr.model import VolumeModel
from volmdlr_tools.shapes.utils.signature import D2Signature
# Create signatures
model1 = VolumeModel.from_step("part1.step")
model2 = VolumeModel.from_step("part2.step")
sig1 = D2Signature.from_volume_model(model1, n_points=100000)
sig2 = D2Signature.from_volume_model(model2, n_points=100000)
# Compare
similarity = sig1.similarity(sig2)
print(f"Similarity: {similarity:.4f}")
Module Overview#
Graph Analysis#
volmdlr_tools.graph.core- BaseGraphclass with serializationvolmdlr_tools.graph.faces-AttributedAdjacencyGraph(AAG) for face adjacencyvolmdlr_tools.graph.assembly-GraphAssemblyfor CAD assembliesvolmdlr_tools.graph.kinematics- Joint detection and determinacy analysis
Feature Recognition#
volmdlr_tools.features.core-FeatureProcessororchestratorvolmdlr_tools.features.extractors- Blend, cavity, and sheet metal extractorsvolmdlr_tools.features.feature_types- Feature abstractions
Shape Classification#
volmdlr_tools.shapes.recognizers- Shape recognizers (sheet metal, swept shapes)volmdlr_tools.shapes.utils.signature- Shape distribution signatures
Distance Analysis#
volmdlr_tools.distance.clearance- Clearance distance computationvolmdlr_tools.distance.interference- Interference detection
Next Steps#
Core Concepts - Core concepts (Graph, AAG, GraphAssembly)
Shape Analysis - Shape classification and feature recognition
Assembly Analysis - Assembly analysis and kinematics
API Reference - Complete API reference