FreeCAD icon indicating copy to clipboard operation
FreeCAD copied to clipboard

BIM: add Offset input to wall creation task panel

Open furgo16 opened this issue 7 months ago • 7 comments

When creating a wall via the Task panel, add the ability to enter a value for the Offset property.

Offset input is disabled when Align is set to Center. This is simply for visual purposes and user awareness, since it is possible to enter an Offset with Align set to Center in the Property Editor, yet the offset will be ignored in this case.

This PR does a small refactor of variable names used for creating the Task panel widget that is not strictly necessary for the feature. However, it was applied to improve readability and it's contained within a small set of local variables inside the taskBox() method.

Notes:

  • A new WallOffset parameter is added, which acts in the same way as other parameters related to wall dimensions, such as WallHeight. For the user, it enables saving the state of the Offset value across different invocations of the new wall Task panel
  • The workflow to finish wall creation upon entering Enter on the wall Height input has been kept. But additionally, with the Offset input focused, pressing Enter will also create the wall.

Known issues:

  • This PR is functional, but it outputs a <class 'RuntimeError'> warning (without any additional context) the first time a wall is created. It does not seem to affect functionality. Update: this does not seem to be specific to this PR, though.

Issues

Fixes: #21032

Before and After Images

Before After
image image

After (input disabled when Alignment is set to Center) image

furgo16 avatar Apr 28 '25 13:04 furgo16

The functionality is there now. ~Leaving it as a draft PR for now until I figure out the warning listed under Known issues~. Update: it does not seem to be related to this PR. I'm getting the warning also on a fresh build from main.

I'm also thinking of changing the behaviour of pressing Enter when the Offset input box has focus, so that it creates the wall instead of keeping the Task panel open. @kaiwas, thoughts?

furgo16 avatar Apr 28 '25 22:04 furgo16

I'm also thinking of changing the behaviour of pressing Enter when the Offset input box has focus, so that it creates the wall instead of keeping the Task panel open. @kaiwas, thoughts?

I have no idea about that. It seems that Enter had previously confirmed the creation of a wall, some field was not in focus.

kaiwas avatar Apr 29 '25 05:04 kaiwas

Current behaviour

The way it worked previously (before this PR):

  1. Click on Arch_Wall command. The Task panel shows up
  2. Press the Tab key to navigate through the input fields with the keyboard, until you reach the Length field
  3. Once you're there, the sequence to create a wall with keyboard input is:

Length => optionally enter value, press Enter. The focus and cursor are set to the next field (Width) ↓ Width => optionally enter value, press Enter. The focus and cursor are set to the next field (Height) ↓ Height => optionally enter value, press Enter. The Task panel is closed and the wall is created. Alternatively, if Tab is pressed, the cursor is set to the next field (Alignment)

New behaviour

The way it works on this PR:

1 to 3. Same steps and behavior. On step 3, press Tab to switch to the Alignment field 4. On Alignment, optionally change value and press Tab to switch to the Offset field 5. On Offset, pressing Enter ~does not create the wall and close~ creates the wall and closes the Task panel.

~So I'm thinking that perhaps on step 5 pressing Enter should create the wall, in the same way it happens on the Height input field.~ Edit: this comment has been updated according to https://github.com/FreeCAD/FreeCAD/pull/21042#issuecomment-2849467180

furgo16 avatar Apr 29 '25 07:04 furgo16

So I'm thinking that perhaps on step 5 pressing Enter should create the wall, in the same way it happens on the Height input field.

It's all very confusing ) In my opinion, "wall parameters" (width/height, etc.) should be at the first stage. But this does not correspond to all other BIM/DRAFT tools. Despite the fact that coordinates are very important - most often we first have to adjust the wall parameters and only then place them in space.

But this is unlikely to concern the current issue. This task is conceptual and rather relates to design and usability issues.

You probably know that in other programs, wall parameters and their "placement" in space are separate actions. In FreeCAD, everything is mixed up in one heap with many input fields. Such a solution cannot be convenient.

More precisely, there is no indication of the coordinates of the first and second points)

kaiwas avatar Apr 29 '25 08:04 kaiwas

1 to 3. Same steps and behavior. On step 3, press Tab to switch to the Alignment field 4. On Alignment, optionally change value and press Tab to switch to the Offset field 5. On Offset, pressing Enter does not create the wall and close the Task panel.

So I'm thinking that perhaps on step 5 pressing Enter should create the wall, in the same way it happens on the Height input field.

I agree with your proposal. It seems consistent with the current workflow.

markkomartin avatar Apr 29 '25 13:04 markkomartin

It's all very confusing ) In my opinion, "wall parameters" (width/height, etc.) should be at the first stage. But this does not correspond to all other BIM/DRAFT tools. Despite the fact that coordinates are very important - most often we first have to adjust the wall parameters and only then place them in space.

But this is unlikely to concern the current issue. This task is conceptual and rather relates to design and usability issues.

You probably know that in other programs, wall parameters and their "placement" in space are separate actions. In FreeCAD, everything is mixed up in one heap with many input fields. Such a solution cannot be convenient.

More precisely, there is no indication of the coordinates of the first and second points)

It would be interesting to open a thread on the forum to discuss about design and usability of wall tool . But maybe I would wait for Yorik's refactor ( Redesign the wall tool to by default work without a baseline ) .

Separating the wall parameters from their "positioning" in space would make everything much simpler.

Actually, even in Freecad we can already use this workflow. I create sketch or line in draft workbench and then I create the wall. The problem arises when I have to edit and then search for the wall parameters among all the properties. Being able to activate the wall options tool of an existing wall would be awesome.

markkomartin avatar Apr 29 '25 13:04 markkomartin

I've changed the behaviour so that in addition to pressing Enter when the Height input has the focus, pressing Enter when the Offset input has the focus will also create the wall.

furgo16 avatar May 04 '25 22:05 furgo16

@furgo16 PR has a conflict. @FreeCAD/design-working-group FYI

maxwxyz avatar May 11 '25 15:05 maxwxyz

It's fine for me. Waiting for DWG

yorikvanhavre avatar May 12 '25 16:05 yorikvanhavre

Nice feature, thanks! Would it be possible for the wireframe preview to represent the correct placement of the wall when the Offset distance is > 0? Currently, the wireframe preview is moved to the right or left depending on the Alignment option, but not offset, the wall is correctly offset after creation:

bim_wall

marcuspollio avatar May 13 '25 10:05 marcuspollio

Would it be possible for the wireframe preview to represent the correct placement of the wall when the Offset distance is > 0? Currently, the wireframe preview is moved to the right or left depending on the Alignment option, but not offset, the wall is correctly offset after creation:

Thanks for the review and nice catch! I'd be happy to look into it, but perhaps as a follow-up PR to this one. I'll need to find out how the wireframe preview is created first. @yorikvanhavre would you have any pointers for where to look at?

furgo16 avatar May 13 '25 10:05 furgo16

That wireframe visualisation is a Draft box tracker (in Draft/draftguitools/gui_trackers.py) Here it's probably just a matter of taking the offset into account when updating the tracker start/endpoints under https://github.com/FreeCAD/FreeCAD/blob/main/src/Mod/BIM/bimcommands/BimWall.py#L256

yorikvanhavre avatar May 13 '25 10:05 yorikvanhavre

@yorikvanhavre @furgo16 I want to mention that the beam (concrete) preview is also incorrect. Maybe it's worth fixing this everywhere? Снимок экрана_20250513_135236 Снимок экрана_20250513_135247

kaiwas avatar May 13 '25 10:05 kaiwas

@kaiwas yes, that's https://github.com/FreeCAD/FreeCAD/issues/16331 and it's a more serious issue in my opinion. It was on my mind when I saw @marcuspollio's remark, but I'm not yet sure whether it's beyond my skills to tackle it.

furgo16 avatar May 13 '25 11:05 furgo16

Indeed the precast elements were never really made to have a preview... It's probably a bit more work

yorikvanhavre avatar May 14 '25 07:05 yorikvanhavre