Proposed algorithm for window added in wall, movement

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Evaggelos
Posts: 14
Joined: Mon Dec 28, 2020 4:55 pm
Location: Thessaloniki, Greece

Re: Proposed algorithm for window added in wall, movement

Post by Evaggelos »

Dear Paulle

Thank you for your interest in my proposal. Currently I am reading the topic you provided in your previous post ‘Intuitive Automatic Windows/Doors + Equipment Placement’.
I am also reading the topic carolpav provided in his post about experimental tools.
Both are deep matters! I would need some time to catch up to them…
My first assumption is that you are both way more experienced than me in implementing freecad code. I am hoping that with your experience you will guide me in my first steps to write actual freecad code.
My second assumption is you and I are dealing with different matters.
You are dealing with the matter of wall and window placement (among other things…)
I am dealing on how wall and window move – rotate together AFTER their creation and placement.
I assume that this design stage is already completed, in some way or another. Whatever the placement method was, I am suggesting that freecad should keep the wall’s first point as its reference point. Also it should keep the window bottom-left corner as its refence point.
The algorithm I am proposing is going to be incorporated inside the standard move and rotate functions of BIM workbench.
Maybe my ideas can prove helpful at your effort, but I need some time to give you an answer.
But I promise that I will do that!
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

Re: Proposed algorithm for window added in wall, movement

Post by paullee »

Thanks, some quick response for your reference :)

Evaggelos wrote: Wed Dec 30, 2020 11:05 am My first assumption is that you are both way more experienced than me in implementing freecad code. I am hoping that with your experience you will guide me in my first steps to write actual freecad code.
I was trained and practised as an architect, not really any kind of programmer, just python beginner and attempt to do some basic thing that seem work better for the workflow think fit :D I can see @carlopav is far more experienced and advanced in programming !

Evaggelos wrote: Wed Dec 30, 2020 11:05 am My second assumption is you and I are dealing with different matters.
You are dealing with the matter of wall and window placement (among other things…)

I am dealing on how wall and window move – rotate together AFTER their creation and placement.
Quite a large part of issues overlaps to my understanding - you try to move Wall / Windows as a whole, and articulating the logic to what portion (of the whole 'assembly') to move. In my experiment, I do not have any thought about Draft Move though. I try to do basically 2 things.

One is doing 'attachment' and 'after attachment', the whole 'assembly' would move / rotate altogether - e.g. move the Wall, Window will follow. This is basically part of your issue. But the 'parent-child' thinking behind is not as elaborated as you are conceiving, but maybe somehow close. So, say 4 chairs attached to a Table as a group, then the Table attach to a Room / Wall, you move the Room / Wall, all Table and Chairs move together. But you just change the Table disposition relative to the Room/Wall, just the Chairs move together.

Another thing is a more 'intuitive parameters' of placement. Instead of a possible abstract coordinate (x,y,z) of a window to attach to a point of a Wall, I try introducing a numbers of parameters, so whenever the Wall segment is, the Window is told to be placed e.g. 1m from end of this Wall, at a Height of 1m. Even after the Wall is moved to another place, the 'absolute' coordinate of Wall/Window will change, it is just the same e.g. '1m from end of this Wall....'

Evaggelos wrote: Wed Dec 30, 2020 11:05 am ... Whatever the placement method was, I am suggesting that freecad should keep the wall’s first point as its reference point. Also it should keep the window bottom-left corner as its refence point.
The algorithm I am proposing is going to be incorporated inside the standard move and rotate functions of BIM workbench.
I am not sure I understand exactly the idea about Wall first point as its reference point - @carlopav experimental ArchWall seem have same concept.

But in my experiment using Sketch as Base, the Sketch can be so complex - e.g. a floor plan of the Villa Savoye, so the concept seems not apply here ?

Then the Window Bottom-left Corner as its Reference Point ( or attachment origin in other discussion ) - I have some assumption also as it is the way @Yorik make default Window / Door etc. But @cyclonit suggested that origin should be able to change for better workflow as shown in other apps, so I am trying to implement a very rudimentary and manual Origin Offset to test with that idea see [ Comments Request ] Intuitive Automatic Windows/Doors + Equipment Placement . So it is possible e.g. the centerline of the Window be placed at centerline of a Wall.
Evaggelos
Posts: 14
Joined: Mon Dec 28, 2020 4:55 pm
Location: Thessaloniki, Greece

Re: Proposed algorithm for window added in wall, movement

Post by Evaggelos »

Let me further explain the notion of reference points:
A wall can be fully defined in model space by these properties:
- Its reference point coordinates [Xr, Yr, Zr]
- Its Length, Width and Height [L, W, H]
- Its inclinations about the three world axis [θx, θy, θz]
Knowing the above numbers the computer can calculate the coordinates of the wall’s four vertices and draw it on screen.
Evaggelos
Posts: 14
Joined: Mon Dec 28, 2020 4:55 pm
Location: Thessaloniki, Greece

Re: Proposed algorithm for window added in wall, movement

Post by Evaggelos »

For example we draw a wall (WALL1) witch starts at the [Xr1, Yr1, Zr1] = [1,1,0] (it is first point we click on screen), in its properties we define [L1, W1, H1] = [6.00, 0.5, 3.00] and by the coordinates of the second point we clicked on screen the computer deduces the [θx1, θy1, θz1] = [90, 90, 0]
Lets also define the host – guest properties of WALL1:
Host1 = []
Guest1 = []

Now lets draw a second wall (WALL2):
[Xr2, Yr2, Zr2] = [8.20, 2.20, 0.00]
[L2, W2, H2] = [4.00, 0.5, 3.00]
[θx2, θy2, θz2] = [90, 90, 90]
Host2 = []
Guest2 = []
The two wall are unaware of one the other.
Attachments
model.PNG
model.PNG (10.83 KiB) Viewed 675 times
Evaggelos
Posts: 14
Joined: Mon Dec 28, 2020 4:55 pm
Location: Thessaloniki, Greece

Re: Proposed algorithm for window added in wall, movement

Post by Evaggelos »

Now lets move WALL2:
We click on the MOVE tool, select WALL2, using end snap we select the first point M1 and then point M2. What the computer does is:
A) It calculates the coordinates of point M1:
XM1 = Xr2 – W2 = 8.20 – 0.20 = 8.00
YM1 = Yr2 = 2.20
ZM1 = Zr2 = 0.00
b) It calculates the coordinates of point M2:
XM2 = Xr1 + L1 = 1.00 + 6.00 = 7.00
YM2 = Yr1 = 1.00
ZM2 = Zr1 = 0.00
c) It calculates the relative distance of the two points M2 and M1:
RX = XM1 – XM2 = 7.00 – 8.00 = -1.00
RY = YM1 – YM2 = 1.00 – 2.20 = -1.20
RZ = ZM1 – ZM2 = 0.00 – 0.00 = 0.00
d)Calculates the new coordinates of the point M1:
XM1’ = XM1 + RX = 8.00 – 1.00 = 7.00
YM1’ = YM1 + RY = 2.20 -1.20 = 1.00
ZM1’ = ZM1 + RZ = 0.00 +0.00 =0.00
e) It calculates the new coordinates of the refence point of WALL2:
Xs2' = XM1' + W2 = 7.00 + 0.20 = 7.20
Ys2' = YM1' = 1.00
Zs2' = ZM1' = 0.00
The computer goes thru the Guest2 list, finds it empty and ends the MOVE function.
The two walls remain unaware of one the other, it just happens that two of their vertices coincide in the model space.
The new state of the model is:
[Xr1, Yr1, Zr1] = [1.00, 1.00, 0.00]
[L1, W1, H1] = [6.00, 0.5, 3.00]
[θx1, θy1, θz1] = [90, 90, 0]
Host1 = []
Guest1 = []
[Xr2, Yr2, Zr2] = [7.20, 1.00, 0.00]
[L2, W2, H2] = [4.00, 0.5, 3.00]
[θx2, θy2, θz2] = [90, 90, 90]
Host2 = []
Guest2 = []
The computer redraws the walls in the screen.
Last edited by Evaggelos on Wed Dec 30, 2020 9:05 pm, edited 5 times in total.
Evaggelos
Posts: 14
Joined: Mon Dec 28, 2020 4:55 pm
Location: Thessaloniki, Greece

Re: Proposed algorithm for window added in wall, movement

Post by Evaggelos »

Now lets make WALL1 the host of WALL2:
The new state of the model is:
[Xr1, Yr1, Zr1] = [1.00, 1.00, 0.00]
[L1, W1, H1] = [6.00, 0.5, 3.00]
[θx1, θy1, θz1] = [90, 90, 0]
Host1 = []
Guest1 = [WALL2]
[Xr2, Yr2, Zr2] = [7.00, 1.00, 0.00]
[L2, W2, H2] = [4.00, 0.5, 3.00]
[θx2, θy2, θz2] = [90, 90, 90]
Host2 = [WALL1]
Guest2 = []
Last edited by Evaggelos on Wed Dec 30, 2020 9:07 pm, edited 1 time in total.
Evaggelos
Posts: 14
Joined: Mon Dec 28, 2020 4:55 pm
Location: Thessaloniki, Greece

Re: Proposed algorithm for window added in wall, movement

Post by Evaggelos »

Now lets move WALL1:
We click on the MOVE tool, select WALL1, click the first point and then click the second point.
The computer repeats the process described above:
Calculates the coordinates of the first and second point, calculates the relative distance of the two points, calculates the new coordinates of WALL1 reference point, goes thru the Guest1 list, finds WALL2 inside it, and uses the MOVE function to move the reference point of WALL2 for the same relative distance.
Evaggelos
Posts: 14
Joined: Mon Dec 28, 2020 4:55 pm
Location: Thessaloniki, Greece

Re: Proposed algorithm for window added in wall, movement

Post by Evaggelos »

From what you see, using this approach the computer stores very few data to describe the model and performs very few calculations. Mechanical engineers who design complex moving parts may find this approach unacceptably simplistic and prefer the parametric design approach, even at the cost of using more computer resources. But for the scope of architectural design I find this approach sufficient.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Proposed algorithm for window added in wall, movement

Post by carlopav »

I appreciate your effort, and I think other devs also do. but mind the Arch_Wall is a very complex object under the hood, it allows the user to model with a lot of freedom (2 points sketch, from : complex sketch, from edge, from face, from solid, etc). And this freedom comes with some drawbacks: what you encountered while trying to move windows together with the wall is one of them. If you want to be able to base a wall on another object you have the problem of the multiplied placement (wall position = BaseObject.Placement.multiply(WallObject.Placement) , that's not exact, but it's to exemplify). Base object changes on Placement are not detected by the wall object, cause Wall.Placement doesn't change, also if the "visual representation" of the wall changes.
Also: in FreeCAD there are many ways to change an object placement, and your method only seem to rely on one move command. Mind that you will not be allowed to change other move function directly, cause they are in the core, or in other workbenches.

I suggest you to check this and this: this is where the magic is supposed to happen, but is buggy. Maybe you just need to fix that, because it works less or more as you described ;)
follow my experiments on BIM modelling for architecture design
Evaggelos
Posts: 14
Joined: Mon Dec 28, 2020 4:55 pm
Location: Thessaloniki, Greece

Re: Proposed algorithm for window added in wall, movement

Post by Evaggelos »

I’m beginning to understand that in order to make any valuable contribution to Freecad’s source code I first need to cover a lot of ground. So I will take my time to study things from ground up and maybe if I ever become proficient I will try to solve the problems in the links you provided. On a first glance they seem to do what I’m describing.
Post Reply