Skip to content
Open
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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ Then, create your `main.py` to test your specs locally

```py
# main.py
import maple as mp
from maple.base import Maple

# Use the project and model id of one of your projects
mp=Maple(project_id="24fa0ed1c3", model_id="2696b4a381")

def spec_a():
mp.it("checks window height is greater than 2600 mm")
Expand All @@ -39,8 +42,6 @@ def spec_a():
.its('Height')\
.should('be.greater', 2600)

# Use the project and model id of one of your projects
mp.init_model(project_id="24fa0ed1c3", model_id="2696b4a381")
mp.run(spec_a)
```
For this to work out of the box, you should have the [Speckle Manager](https://speckle.systems/download/)
Expand Down
32 changes: 32 additions & 0 deletions examples/federated_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from maple.base import Maple
from maple.utils import print_results
import logging

logging.basicConfig(level=logging.INFO)

arch_model = "045cdb6d44"
str_model = "df3fa4e97d"
mp = Maple(
project_id="566869f9e6",
model_ids=[arch_model, str_model],
)


def clash():
mp.it("Clash detection between multiple models")
windows = mp.from_model(arch_model).get("properties.ifcType", "IfcWindow")
walls = mp.from_model(str_model).get("ifcType", "IfcColumn")

mp.detect_collision(windows, walls)


def other_test():
mp.it("other test")
windows = mp.from_model(arch_model).get("properties.ifcType", "IfcWindow")
windows.its("properties.ifcType").should("have.value", "ifcWindow")

columns = mp.from_model(str_model).get("ifcType", "IfcColumn")
columns.its("ifcType").should("have.value", "ifcColumn")


mp.run(other_test, clash)
14 changes: 9 additions & 5 deletions examples/single_spec.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import setup # noqa
import maple as mp
import logging

from maple.base import Maple

mp = Maple(model_id="53db0711db", project_id="1471fed2c0")

logging.basicConfig(level=logging.INFO)


def main():
mp.init_model(project_id="1471fed2c0", model_id="53db0711db")
mp.set_logging(True)
mp.run(test_check_door_height)
mp.generate_report(output_path="/tmp/")
# mp.generate_report(output_path="/tmp/")


def test_check_door_height():
mp.it("Checks that the door height its at least 2.0 m")

mp.get("ifcType", "IFCSPATIALZONE").its("ownerId").should("be.equal", 1)
mp.get("ifcType", "IFCSPATIALZONE").its("ownerId").should("be.equal", 2)


if __name__ == "__main__":
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ build-backend = "setuptools.build_meta"

[project]
name = "maple-spec"
version = "0.1.6"
version = "0.2"
authors = [
{ name="Gizem Demirhan", email="gizemdemirhaan@gmail.com" },
{ name="Andres Buitrago", email="andrsbtrg@gmail.com" }
]
description = "A testing library for Speckle models"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.11"
dependencies = ["specklepy>=3", "importlib-metadata", "jinja2", "python-dotenv", "acers"]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent"
]

Expand Down
Loading