Rectangle mode for the polyline slab, wall and profile tools (closes #9326) - #9327
Open
theoryshaw wants to merge 2 commits into
Open
Rectangle mode for the polyline slab, wall and profile tools (closes #9326)#9327theoryshaw wants to merge 2 commits into
theoryshaw wants to merge 2 commits into
Conversation
Press R while drawing a slab to switch between the free form polyline and a rectangle defined by two opposite corners. Picking the second corner creates the slab, so a rectangular slab takes two clicks. The provisional corners are written to the insertion polyline itself (with the first corner repeated to close the shape), so the slab preview, the side dimensions and the total length keep working as they are, and the distance/angle/coordinate inputs stay relative to the first corner. The rectangle is aligned to the custom transform orientation when there is one, and increment snapping rounds the sides of the rectangle instead of the diagonal that goes to the mouse, so rectangles drawn with the mouse get round dimensions. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The modal handling is now shared by `PolylineOperator.handle_rectangle_drawing`, which finishes the shape through a `finish` method that each of the three operators implements. Walls and profiles are generated from the 4 segments of the rectangle and, as the shape is closed, they are joined into a loop, the same as closing a polyline by hand. The rectangle is now built on the plane the tool is working on, since the profile tool can draw on XZ and YZ as well, and it always takes the coordinate of the axis it doesn't span from the first corner, so a rectangle stays planar even when the profile tool picks two corners that aren't. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #9326.
Adds a rectangle mode to the three polyline insertion tools. Press
Rwhile the tool is running to toggle it, then pick two opposite corners — the second pick completes the shape, so a rectangular slab is two clicks instead of four plus a confirmation.bim.draw_polyline_slabbim.draw_polyline_wallbim.draw_polyline_profileThe status bar shows
Rectangle: ON/OFF, the mode is remembered between invocations so a series of rectangles doesn't needRevery time,Backspacerestarts the rectangle andEsccancels the tool. Typed input still works: the distance/angle and X/Y inputs place the opposite corner, so an exact rectangle can be typed rather than drawn.Implementation notes
The provisional corners are written into
insertion_polylineitself, with the first corner repeated at the end so the shape reads as closed. That is what lets the existingProductDecoratorpreview, the per-side dimension labels and the total length keep working without any decorator changes, and it means walls and profiles are generated and joined by the same code path as closing a polyline by hand.Because the polyline then holds more than one point while the second corner is still being picked,
calculate_distance_and_angleandcalculate_x_y_and_zskip their "second to last point" reference whenrectangle_modeis set, so typed distance and angle stay relative to the first corner.Two details worth a look during review:
The shared modal flow lives in
PolylineOperator.handle_rectangle_drawing, which finishes the shape through afinishmethod each of the three operators implements. Each modal gained three lines: the toggle, the instruction and status entries, and the handler call.Testing
test/tool/test_polyline.pycovering the corner math, the XZ/YZ planes, the planarity rule, snapping the sides, and rebuilding the preview in place (12 pass in the file).make test-modal MODULE=rectangle, driving each of the three tools through real events: slab footprint rectangular, 4 walls at 4 corners, 4 coplanar beams.