Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation cleanup #50

Merged
merged 5 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Changed `Element.graph_node` to `Element.graphnode`.
* Changed `Element.tree_node` to `Element.treenode`.
* Changed `blockmodel_interfaces` to use the bestfit frame shared by two aligned interfaces instead of the frame of first face of the pair.
* Changed notebook.scene `__all__` is moved to notebook folder for building documentation.

### Removed

Expand Down
4 changes: 2 additions & 2 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
API Reference
********************************************************************************


.. toctree::
:maxdepth: 1
:titlesonly:

api/compas_model.algorithms
api/compas_model.elements
api/compas_model.interactions
api/compas_model.materials
api/compas_model.models
api/compas_model.notebook
api/compas_model.scene
api/compas_model.scene
14 changes: 0 additions & 14 deletions docs/api/compas_model.algorithms.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/api/compas_model.models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Classes

ElementNode
ElementTree
GroupNode
InteractionGraph
Model
BlockModel
12 changes: 2 additions & 10 deletions docs/api/compas_model.notebook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@ compas_model.notebook

.. currentmodule:: compas_model.notebook


Classes
=======

.. autosummary::
:toctree: generated/
:nosignatures:

scene.ThreeBlockObject


Functions
=========

.. autosummary::
:toctree: generated/
:nosignatures:
ThreeBlockObject
ThreeModelObject
5 changes: 3 additions & 2 deletions docs/api/compas_model.scene.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ compas_model.scene

.. currentmodule:: compas_model.scene


Classes
=======

.. autosummary::
:toctree: generated/
:nosignatures:

ElementObject
ElementObject
BlockObject
ModelObject
4 changes: 2 additions & 2 deletions docs/examples/dem/000_stack.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ As a result, the stack requires equilibriating "glue" forces (in red) at those i
Code
====

.. literalinclude:: 100_stack.py
:language: python
.. .. literalinclude:: 100_stack.py
.. :language: python
5 changes: 2 additions & 3 deletions src/compas_model/algorithms/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
from math import fabs

from shapely.geometry import Polygon as ShapelyPolygon

from compas.datastructures import Mesh
from compas.geometry import Frame
from compas.geometry import Plane
from compas.geometry import Polygon
from compas.geometry import Transformation
from compas.geometry import Vector
from compas.geometry import bestfit_frame_numpy
from compas.geometry import centroid_polygon
from compas.geometry import is_colinear
from compas.geometry import is_coplanar
from compas.geometry import is_parallel_vector_vector
from compas.geometry import transform_points
from compas.itertools import window
from shapely.geometry import Polygon as ShapelyPolygon

from compas_model.elements import BlockGeometry
from compas_model.interactions import ContactInterface
from compas_model.models import Model
Expand Down
7 changes: 5 additions & 2 deletions src/compas_model/algorithms/overlaps.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from compas.geometry import Brep
from compas.tolerance import TOL
from compas_occ.brep import OCCBrepFace as BrepFace

from compas_model.interactions import ContactInterface
from compas_model.models import Model

from .nnbrs import find_nearest_neighbours

try:
from compas_occ.brep import OCCBrepFace as BrepFace
except ImportError:
print("compas_occ not installed. Using compas.geometry.BrepFace instead.")


def model_overlaps(
model: Model,
Expand Down
12 changes: 8 additions & 4 deletions src/compas_model/analysis/cra.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from compas_assembly.datastructures import Assembly
from compas_assembly.datastructures import Block
from compas_cra.equilibrium import cra_penalty_solve as _cra_penalty_solve

from compas_model.interactions import ContactInterface
from compas_model.models import Model

try:
from compas_cra.equilibrium import cra_penalty_solve as _cra_penalty_solve

from compas_assembly.datastructures import Assembly
from compas_assembly.datastructures import Block
except ImportError:
print("compas_cra not installed. Using compas.geometry.BrepFace instead.")


def cra_penalty_solve(
model: Model,
Expand Down
1 change: 0 additions & 1 deletion src/compas_model/elements/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from compas.geometry import oriented_bounding_box
from compas.geometry import volume_polyhedron
from compas.geometry.brep.brep import Brep

from compas_model.elements import Element
from compas_model.elements import Feature

Expand Down
1 change: 0 additions & 1 deletion src/compas_model/elements/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from compas.geometry import Frame
from compas.geometry import Shape
from compas.geometry import Transformation

from compas_model.materials import Material

if TYPE_CHECKING:
Expand Down
1 change: 0 additions & 1 deletion src/compas_model/elements/plate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from compas.geometry import bounding_box
from compas.geometry import oriented_bounding_box
from compas.itertools import pairwise

from compas_model.elements import Element
from compas_model.elements import Feature

Expand Down
7 changes: 5 additions & 2 deletions src/compas_model/models/blockmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

from compas.geometry import Brep
from compas.tolerance import Tolerance
from compas_occ.brep import OCCBrepFace as BrepFace

from compas_model.algorithms.nnbrs import find_nearest_neighbours
from compas_model.elements import Element
from compas_model.interactions import ContactInterface

from .model import Model

try:
from compas_occ.brep import OCCBrepFace as BrepFace
except ImportError:
print("compas_occ not installed. Using compas.geometry.BrepFace instead.")


class BlockModel(Model):
def __init__(self, name: Optional[str] = None) -> None:
Expand Down
1 change: 0 additions & 1 deletion src/compas_model/models/elementnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Optional

from compas.datastructures import TreeNode

from compas_model.elements import Element

if TYPE_CHECKING:
Expand Down
1 change: 0 additions & 1 deletion src/compas_model/models/elementtree.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Optional

from compas.datastructures import Tree

from compas_model.elements import Element

from .elementnode import ElementNode
Expand Down
1 change: 0 additions & 1 deletion src/compas_model/models/interactiongraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Optional

from compas.datastructures import Graph

from compas_model.elements import Element # noqa: F401
from compas_model.interactions import Interaction # noqa: F401

Expand Down
1 change: 0 additions & 1 deletion src/compas_model/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from compas.datastructures import Datastructure
from compas.geometry import Frame
from compas.geometry import Transformation

from compas_model.elements import Element
from compas_model.interactions import Interaction
from compas_model.materials import Material
Expand Down
6 changes: 6 additions & 0 deletions src/compas_model/notebook/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .scene import ThreeBlockObject, ThreeModelObject

__all__ = [
"ThreeBlockObject",
"ThreeModelObject",
]
8 changes: 0 additions & 8 deletions src/compas_model/notebook/scene/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,3 @@
def register_scene_objects():
register(BlockElement, ThreeBlockObject, context="Notebook")
register(Model, ThreeModelObject, context="Notebook")

# print("PyThreeJS Model elements registered.")


__all__ = [
"ThreeBlockObject",
"ThreeModelObjec",
]
8 changes: 4 additions & 4 deletions src/compas_model/notebook/scene/blockobject.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import compas.datastructures # noqa: F401
import compas.geometry # noqa: F401
import numpy
import pythreejs as three
from compas.geometry import Polygon
from compas.geometry import earclip_polygon
from compas_notebook.scene import ThreeSceneObject

import compas.datastructures # noqa: F401
import compas.geometry # noqa: F401
from compas.geometry import Polygon
from compas.geometry import earclip_polygon
from compas_model.scene import BlockObject


Expand Down
4 changes: 2 additions & 2 deletions src/compas_model/notebook/scene/modelobject.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import compas.datastructures # noqa: F401
import compas.geometry # noqa: F401
from compas_notebook.scene import ThreeSceneObject

import compas.datastructures # noqa: F401
import compas.geometry # noqa: F401
from compas_model.scene import ElementObject
from compas_model.scene import ModelObject

Expand Down
3 changes: 1 addition & 2 deletions src/compas_model/scene/elementobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
from __future__ import print_function

import compas.geometry # noqa: F401
import compas_model.elements # noqa: F401
from compas.colors import Color
from compas.scene import SceneObject
from compas.scene.descriptors.colordict import ColorDictAttribute

import compas_model.elements # noqa: F401


class ElementObject(SceneObject):
"""Base class for all element scene objects.
Expand Down
3 changes: 1 addition & 2 deletions src/compas_model/scene/modelobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from __future__ import print_function

import compas.geometry # noqa: F401
from compas.scene import SceneObject

import compas_model.models # noqa: F401
from compas.scene import SceneObject


class ModelObject(SceneObject):
Expand Down
13 changes: 8 additions & 5 deletions src/compas_model/viewers/blockmodelviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
from compas.datastructures import Mesh
from compas.geometry import Line
from compas.itertools import remap_values
from compas_viewer import Viewer
from compas_viewer.components import Button
from compas_viewer.components.slider import Slider
from compas_viewer.scene import GroupObject

from compas_model.elements import BlockElement
from compas_model.elements import BlockGeometry
from compas_model.interactions import ContactInterface
from compas_model.models import Model

try:
from compas_viewer import Viewer
from compas_viewer.components import Button
from compas_viewer.components.slider import Slider
from compas_viewer.scene import GroupObject
except ImportError:
print("compas_viewer not installed. Using compas.geometry.BrepFace instead.")


def toggle_supports():
viewer = BlockModelViewer()
Expand Down
Loading