Skip to content
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: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,5 @@ graphviz = [
dev = [
"black>=25.1.0",
"ipykernel>=6.30.1",
"pygraphviz>=1.14",
"pytest-check>=2.5.4",
]
14 changes: 6 additions & 8 deletions src/papermodels/datatypes/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,12 @@ def get_collector_extents(self, relative: bool = True) -> dict[str, tuple]:
extent_polygon=self.extent_polygon,
)
except (geom_ops.GeometryError, AssertionError, ValueError, TypeError):
support_intersections = (
f"{GeometryCollection(ordered_support_geoms).intersection(self.geometry).wkt=}"
support_intersections = f"{GeometryCollection(ordered_support_geoms).intersection(self.geometry).wkt=}"
geometry = f"{self.geometry.wkt=}"
tag = f"{self.tag=}"
raise geom_ops.GeometryError(
f"Debug information:{tag=}\n{geometry=}\n{support_intersections=}"
)
geometry = (f"{self.geometry.wkt=}")
tag = (f"{self.tag=}")
raise geom_ops.GeometryError(f"Debug information:{tag=}\n{geometry=}\n{support_intersections=}")
tagged_extents = {}
for idx, extent in enumerate(extents):
support_geom = ordered_support_geoms[idx]
Expand Down Expand Up @@ -1373,9 +1373,7 @@ def trim_cantilevers(element: Element, abs_tol: Optional[float] = 0.02):
try:
new_geometry = LineString([start_point, end_point]) # type: ignore
except TypeError:
raise geom_ops.GeometryError(
f"{element=}"
)
raise geom_ops.GeometryError(f"{element=}")
new_element.geometry = new_geometry
intersection_checks = [
new_geometry.intersects(ib.other_geometry)
Expand Down
23 changes: 16 additions & 7 deletions src/papermodels/datatypes/geometry_graph.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations
from typing import Optional, TypeAlias, Callable
from collections import Counter
from copy import deepcopy
from decimal import Decimal
import pathlib
Expand Down Expand Up @@ -386,7 +387,6 @@ def remove_excess_correspondent_load_paths(self):
if (
element.geometry.geom_type == "LineString"
and intersection_points_in_polygon_below

):
inters_below_set = set(intersection_points_in_polygon_below)
for edge in inters_below_set:
Expand All @@ -398,16 +398,15 @@ def remove_excess_correspondent_load_paths(self):
and element.reaction_type == "linear"
and "intersection" in edge_properties
):
center_line = geom.get_rectangle_centerline(
element.geometry
)
center_line = geom.get_rectangle_centerline(element.geometry)
for idx, dep in enumerate(dependents):
dep_geom = self.nodes[dep]["element"].geometry
if dep_geom.geom_type == "LineString":
is_roughly_parallel = geom.check_2d_linestring_parallel(center_line, dep_geom, tol=0.01)
is_roughly_parallel = geom.check_2d_linestring_parallel(
center_line, dep_geom, tol=0.01
)
if not is_roughly_parallel:
self.remove_edge(element.tag, dep)


def add_intersection_indexes_below(self):
sorted_nodes = nx.topological_sort(self)
Expand Down Expand Up @@ -1060,6 +1059,7 @@ def from_annotations(
structural_element_entries = {}
parsed_annotations_acc = {}
raw_annotations_acc = {}
tag_checker = []
for annots_in_page in annots_by_page:
if scale is not None:
scaled_annots_in_page = scale_annotations(annots_in_page, scale)
Expand All @@ -1074,18 +1074,27 @@ def from_annotations(
parsed_annotations_acc = parsed_annotations | parsed_annotations_acc
raw_annotations_acc = raw_annotations | raw_annotations_acc
for annot, annot_attrs in parsed_annotations.items():
tag = annot_attrs["tag"]
if "occupancy" in annot_attrs:
load_entries.update({annot: annot_attrs})
elif "trib area" in annot_attrs.get("type", "").lower():
trib_area_entries.update({annot: annot_attrs})
elif "extent" in annot_attrs.get("type", "").lower():
extent_entries.update({annot: annot_attrs})
else:
tag_checker.append(tag)
structural_element_entries.update({annot: annot_attrs})
structural_element_entries = correlate_extents(
structural_element_entries, extent_entries
)

tag_counter = Counter(tag_checker)
tag_counter.pop(None) # Exclude None tags from the check
duplicate_tags = [tag for tag in tag_counter if tag_counter[tag] > 1]
if duplicate_tags:
raise ValueError(
"Geometry graph could not be built because the following"
f" duplicate tags were found: {duplicate_tags}"
)
if not structural_element_entries and not legend_entries:
raise ValueError(
"No structural element entities were found.\n"
Expand Down
10 changes: 8 additions & 2 deletions src/papermodels/datatypes/joist_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,12 +639,18 @@ def generate_joist_geom(self, index: int):
end_a = support_a_loc = self._extents[0][0]
end_b = support_b_loc = self._extents[-1][0]
# stand-in values for so that the variable intersecting_supports exists
intersecting_supports = [0, 1] # bug: These allow joists to exist beyond the edge of the support for start and end joists
intersecting_supports = [
0,
1,
] # bug: These allow joists to exist beyond the edge of the support for start and end joists
elif index == len(self.joist_locations) - 1:
end_a = support_a_loc = self._extents[0][1]
end_b = support_b_loc = self._extents[-1][1]
# stand-in values for so that the variable intersecting_supports exists
intersecting_supports = [0, 1] # bug: These allow joists to exist beyond the edge of the support for start and end joists
intersecting_supports = [
0,
1,
] # bug: These allow joists to exist beyond the edge of the support for start and end joists

cant_a = self._cantilevers["A"]
cant_b = self._cantilevers["B"]
Expand Down
4 changes: 3 additions & 1 deletion src/papermodels/geometry/geom_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,9 @@ def get_joist_locations(
if initial_offset:
joist_locs.append(initial_offset)
distance_remaining -= initial_offset
while distance_remaining > 1.5 * spacing: # Use 1.5*spacing instead of 1.0*spacing to prevent "sliver joists" at the end
while (
distance_remaining > 1.5 * spacing
): # Use 1.5*spacing instead of 1.0*spacing to prevent "sliver joists" at the end
distance_remaining -= spacing
joist_locs.append(distance - distance_remaining)
else:
Expand Down
4 changes: 2 additions & 2 deletions src/papermodels/paper/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def pike_annotation_to_pm_annotation(
a = (x2 - x1) / 2
b = (y2 - y1) / 2
n = 16
x_vertices = float(h) + float(a) * np.cos(np.linspace(0, 2*np.pi, n))
y_vertices = float(k) + float(b) * np.sin(np.linspace(0, 2*np.pi, n))
x_vertices = float(h) + float(a) * np.cos(np.linspace(0, 2 * np.pi, n))
y_vertices = float(k) + float(b) * np.sin(np.linspace(0, 2 * np.pi, n))
vertices = []
for idx, x_vertex in enumerate(x_vertices):
vertices.append(Decimal(x_vertex))
Expand Down
44 changes: 33 additions & 11 deletions src/papermodels/scales.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,47 @@ def __repr__(self):
Decimal("1") / Decimal("72") * Decimal("2") / Decimal("3"), '3/2" = 1\'-0"'
)

SCALE_32ND_INCH_M = Scale(Decimal("1") / Decimal("72") * Decimal("32") * Decimal("0.3048"), '1/32" = 1\'-0" IN METERS')
SCALE_16TH_INCH_M = Scale(Decimal("1") / Decimal("72") * Decimal("16") * Decimal("0.3048"), '1/16" = 1\'-0" IN METERS')
SCALE_EIGHTH_INCH_M = Scale(Decimal("1") / Decimal("72") * Decimal("8") * Decimal("0.3048"), '1/8" = 1\'-0" IN METERS')
SCALE_QUARTER_INCH_M = Scale(Decimal("1") / Decimal("72") * Decimal("4") * Decimal("0.3048"), '1/4" = 1\'-0" IN METERS')
SCALE_HALF_INCH_M = Scale(Decimal("1") / Decimal("72") * Decimal("2") * Decimal("0.3048"), '1/2" = 1\'-0" IN METERS')
SCALE_ONE_INCH_M = Scale(Decimal("1") / Decimal("72") * Decimal("0.3048"), '1" = 1\'-0"')
SCALE_32ND_INCH_M = Scale(
Decimal("1") / Decimal("72") * Decimal("32") * Decimal("0.3048"),
'1/32" = 1\'-0" IN METERS',
)
SCALE_16TH_INCH_M = Scale(
Decimal("1") / Decimal("72") * Decimal("16") * Decimal("0.3048"),
'1/16" = 1\'-0" IN METERS',
)
SCALE_EIGHTH_INCH_M = Scale(
Decimal("1") / Decimal("72") * Decimal("8") * Decimal("0.3048"),
'1/8" = 1\'-0" IN METERS',
)
SCALE_QUARTER_INCH_M = Scale(
Decimal("1") / Decimal("72") * Decimal("4") * Decimal("0.3048"),
'1/4" = 1\'-0" IN METERS',
)
SCALE_HALF_INCH_M = Scale(
Decimal("1") / Decimal("72") * Decimal("2") * Decimal("0.3048"),
'1/2" = 1\'-0" IN METERS',
)
SCALE_ONE_INCH_M = Scale(
Decimal("1") / Decimal("72") * Decimal("0.3048"), '1" = 1\'-0"'
)

SCALE_3_32ND_INCH_M = Scale(
Decimal("1") / Decimal("72") * Decimal("32") / Decimal("3") * Decimal("0.3048"), '3/32" = 1\'-0" IN METERS'
Decimal("1") / Decimal("72") * Decimal("32") / Decimal("3") * Decimal("0.3048"),
'3/32" = 1\'-0" IN METERS',
)
SCALE_3_16TH_INCH_M = Scale(
Decimal("1") / Decimal("72") * Decimal("16") / Decimal("3") * Decimal("0.3048"), '3/16" = 1\'-0" IN METERS'
Decimal("1") / Decimal("72") * Decimal("16") / Decimal("3") * Decimal("0.3048"),
'3/16" = 1\'-0" IN METERS',
)
SCALE_3_EIGHTH_INCH_M = Scale(
Decimal("1") / Decimal("72") * Decimal("8") / Decimal("3") * Decimal("0.3048"), '3/8" = 1\'-0" IN METERS'
Decimal("1") / Decimal("72") * Decimal("8") / Decimal("3") * Decimal("0.3048"),
'3/8" = 1\'-0" IN METERS',
)
SCALE_3_QUARTER_INCH_M = Scale(
Decimal("1") / Decimal("72") * Decimal("4") / Decimal("3") * Decimal("0.3048"), '3/4" = 1\'-0" IN METERS'
Decimal("1") / Decimal("72") * Decimal("4") / Decimal("3") * Decimal("0.3048"),
'3/4" = 1\'-0" IN METERS',
)
SCALE_3_HALF_INCH_M = Scale(
Decimal("1") / Decimal("72") * Decimal("2") / Decimal("3") * Decimal("0.3048"), '3/2" = 1\'-0" IN METERS'
Decimal("1") / Decimal("72") * Decimal("2") / Decimal("3") * Decimal("0.3048"),
'3/2" = 1\'-0" IN METERS',
)
Loading