Skip to content

Conversation

@petrasvestartas
Copy link
Collaborator

Elements: beam, column, plate and interactions types: contact, collision, modifier.

What type of change is this?

  • Bug fix in a backwards-compatible manner.
  • New feature in a backwards-compatible manner.
  • Breaking change: bug fix or new feature that involve incompatible API changes.
  • Other (e.g. doc update, configuration, etc)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I added a line to the CHANGELOG.md file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
  • I ran all tests on my computer and it's all green (i.e. invoke test).
  • I ran lint on my computer and there are no errors (i.e. invoke lint).
  • I added new functions/classes and made them available on a second-level import, e.g. compas.datastructures.Mesh.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

Copy link
Collaborator

@tomvanmele tomvanmele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • geometric definition of simple elements seems unnecessarily complicated (why not use a box to define the base geometry of a beam and column?)
  • aabb, obb, collision mesh are expected to be in model geometry
  • please use a formatter

raise ValueError("Modifier type is not defined, please define a modifier type e.g. SlicerModfier.")

if issubclass(modifier_type, BooleanModifier):
return BooleanModifier(self.elementgeometry.transformed(self.modeltransformation))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is self.elementgeometry.transformed(self.modeltransformation) not the same as self.modelgeometry?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not want here to trigger the cache.

Comment on lines 210 to 236
def _create_slicer_modifier(self, target_element: "BeamElement") -> Modifier:
mesh = self.elementgeometry.transformed(self.modeltransformation)
center_line = target_element.center_line.transformed(target_element.modeltransformation)

p0 = center_line.start
p1 = center_line.end

closest_distance_to_end_point = float("inf")
closest_face = 0
for face in self.elementgeometry.faces():
polygon = mesh.face_polygon(face)
frame = polygon.frame
result = intersection_line_plane(center_line, Plane.from_frame(frame))
if result:
point = Point(*result)
xform = Transformation.from_frame_to_frame(frame, Frame.worldXY())
point = point.transformed(xform)
polygon = polygon.transformed(xform)
if is_point_in_polygon_xy(point, polygon):
d = max(p0.distance_to_point(point), p1.distance_to_point(point))
if d < closest_distance_to_end_point:
closest_distance_to_end_point = d
closest_face = face

plane = Plane.from_frame(mesh.face_polygon(closest_face).frame)
plane = Plane(plane.point, -plane.normal)
return SlicerModifier(plane)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you not just define the cutting plane using the box frame in model coordinates and the information about the connectivity about the beams?

Copy link
Collaborator Author

@petrasvestartas petrasvestartas Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to do Mesh and Ray (center-line) collision here, to use it for inclined cases too.

@tomvanmele tomvanmele merged commit 5310b89 into main Jan 21, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants