Geode-solutions Explicit Models

7.0.7 · active · verified Fri Apr 17

geode-explicit is the OpenGeode module from Geode-solutions for defining and manipulating explicit geometric models, such as regular grids and explicit solids, within a 3D space. It is part of a larger ecosystem of C++ and Python libraries for geometric modeling. The library is actively maintained with frequent updates and bug fixes, typically following a rapid release cadence for the Geode-solutions ecosystem, with the current version being 7.0.7.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a 3D `RegularGrid` from a bounding box, save it to a file, and then load it back. It utilizes common utility classes like `Point3D` and `BoundingBox` from `geode-common`.

import os
from geode_explicit import RegularGrid
from geode_common import Point3D, BoundingBox

# Define the bounding box for the grid
min_point = Point3D([0.0, 0.0, 0.0])
max_point = Point3D([10.0, 10.0, 10.0])
grid_bbox = BoundingBox(min_point, max_point)

# Create a 3D regular grid with 10x10x10 cells
grid_dimensions = [10, 10, 10]
grid = RegularGrid(grid_bbox, grid_dimensions)

print(f"Created a RegularGrid with {grid.nb_cells()} cells.")
print(f"Grid origin: {grid.grid_origin()}")
print(f"Grid cell size: {grid.cell_size()}")

# Save the grid to a file
output_filename = "my_regular_grid.grd"
grid.save_regular_grid(output_filename)
print(f"Grid saved to {output_filename}")

# Load the grid from the file
loaded_grid = RegularGrid.load_regular_grid(output_filename)
print(f"Loaded a RegularGrid with {loaded_grid.nb_cells()} cells.")

# Clean up the created file
os.remove(output_filename)

view raw JSON →