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

Add element #276

Merged
merged 2 commits into from
Sep 10, 2024
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Fixed missing input parameter in `SurfaceModelOptions` GH Component.
* Fixed error with tolerances for `SurfaceModel`s modeled in meters.
* Renamed `beam` to `element` in different locations to make it more generic.
* Fixed `AttributeError` in `SurfaceModel`.
* Updated example scripts.
* Calling `process_joinery` in `SurfaceModel`.

### Removed

Expand Down
8 changes: 5 additions & 3 deletions examples/model/0001_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@


HERE = os.path.dirname(__file__)
LINES = os.path.join(HERE, 'lines.json')
LINES = os.path.join(HERE, "lines.json")


def create_viewer():
viewer = Viewer()
viewer.renderer.camera.far = 1000000.0
viewer.renderer.camera.position = [10000.0, 10000.0, 10000.0]
viewer.renderer.camera.pan_delta = 5.0
viewer.renderer.camera.pandelta = 5.0
viewer.renderer.rendermode = "ghosted"
return viewer

Expand All @@ -32,7 +32,7 @@ def create_viewer():
HEIGHT = 120
WIDTH = 60
for line in lines:
model.add_beam(Beam.from_centerline(centerline=line, height=HEIGHT, width=WIDTH))
model.add_element(Beam.from_centerline(centerline=line, height=HEIGHT, width=WIDTH))

beams = model.beams

Expand All @@ -51,6 +51,8 @@ def create_viewer():
TButtJoint.create(model, beams[1], beams[3])
TButtJoint.create(model, beams[2], beams[4])

model.process_joinery()

viewer = create_viewer()

for beam in model.beams:
Expand Down
9 changes: 6 additions & 3 deletions examples/model/0002_stand.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@


HERE = os.path.dirname(__file__)
LINES = os.path.join(HERE, 'stand.json')
LINES = os.path.join(HERE, "stand.json")


def create_viewer():
# draw inflated centerlines
viewer = Viewer()
viewer.renderer.camera.far = 1000000.0
viewer.renderer.camera.position = [10000.0, 10000.0, 10000.0]
viewer.renderer.camera.pan_delta = 5.0
viewer.renderer.camera.pandelta = 5.0
viewer.renderer.rendermode = "ghosted"
return viewer


# Load centerlines from file
lines = json_load(LINES)

Expand All @@ -46,7 +47,7 @@ def create_viewer():
normal = NORMAL_VERTICALS if category == "verticals" else None
beam = Beam.from_centerline(centerline=line, height=height, width=width, z_vector=normal)
beam.attributes["category"] = category
model.add_beam(beam)
model.add_element(beam)

# create topology to joint type mapping
topo_connection = {JointTopology.TOPO_L: LButtJoint, JointTopology.TOPO_T: TButtJoint}
Expand All @@ -66,6 +67,8 @@ def create_viewer():
if joint_cls is not None:
joint_cls.create(model, beam_a, beam_b)

model.process_joinery()

# setup the viewer
viewer = create_viewer()

Expand Down
5 changes: 3 additions & 2 deletions examples/model/0003_wall.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ def create_viewer():
viewer = Viewer()
viewer.renderer.camera.far = 1000000.0
viewer.renderer.camera.position = [10000.0, 10000.0, 10000.0]
viewer.renderer.camera.pan_delta = 5.0
viewer.renderer.camera.pandelta = 5.0
viewer.renderer.rendermode = "ghosted"
return viewer


model = TimberModel()

# Add beams to model
Expand All @@ -24,7 +25,7 @@ def create_viewer():

wall_frame = Frame.worldXY()
model = TimberModel()
model.add_wall(Wall(wall_frame, 3000, 140, 2000))
model.add_element(Wall(wall_frame, 3000, 140, 2000))

# setup the viewer
viewer = create_viewer()
Expand Down
2 changes: 1 addition & 1 deletion src/compas_timber/design/wall_from_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def centerlines(self):
def create_model(self):
model = TimberModel()
for beam in self.beams:
model.add_beam(beam)
model.add_element(beam)
topologies = []
solver = ConnectionSolver()
found_pairs = solver.find_intersecting_pairs(model.beams, rtree=True, max_distance=self.dist_tolerance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def RunScript(self, surface, stud_spacing, beam_width, frame_depth, z_axis, opti
debug_info = DebugInfomation()
scene = Scene()
model = surface_model.create_model()
model.process_joinery()
if CreateGeometry:
for element in model.beams:
scene.add(element.geometry)
Expand Down
Loading