Arch Window on Non-Linear Wall?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
paullee
Posts: 2502
Joined: Wed May 04, 2016 3:58 pm

Arch Window on Non-Linear Wall?

Postby paullee » Mon Apr 24, 2017 5:17 pm

Hi there, I have used Arch Window for a while on straight wall without problem.

I am trying Arch Window on walls which are simply not straight but 1st attempt is not successful:-

1. Curve wall (Wall created from Dwire with Fillet for the curve wall section)
- Arch Window (osnap to nearest) adding is problematic, no opening and window alignment is weird in short (wall object created disappeared, underlying wall turned on w/o window) see screenshots, FCstd attached.
2. Curve wall (Sketcher to create arc) - similar problem (any different for Dwire/Arc?), see screenshot
3. Slanted wall - yet to be tested
4. Slanted / sloped curved wall - yet to be tested
5. Sloped roof - yet to be tested

Anyone has attempted the above with successful result and any hints?

Thanks!
Screenshot from 2017-04-25 00-49-14.png
Screenshot from 2017-04-25 00-49-14.png (172.62 KiB) Viewed 1801 times
Screenshot from 2017-04-25 00-49-54.png
Screenshot from 2017-04-25 00-49-54.png (179.22 KiB) Viewed 1801 times
Screenshot from 2017-04-25 01-07-06.png
Screenshot from 2017-04-25 01-07-06.png (180.07 KiB) Viewed 1801 times
Screenshot from 2017-04-25 01-07-23.png
Screenshot from 2017-04-25 01-07-23.png (185.93 KiB) Viewed 1801 times
Attachments
Test _ Non-linear Wall - Arch Window.fcstd
(55.9 KiB) Downloaded 39 times
User avatar
yorik
Site Admin
Posts: 11978
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Arch Window on Non-Linear Wall?

Postby yorik » Tue Apr 25, 2017 3:25 pm

Placing a window correctly on such a curved surface will be pretty hard.
I think I would try the following:
- create your window without inserting it in any wall (just in the air)
- turn it off and turn its base sketch on
- position the sketch precisely, tangentially to the curved wall. The sketch doesn't need to touch the wall, what is important is that its axis is at the correct position. I would do that with Draft move and Draft Rotate, maybe you'll need a couple of helper lines
- turn the sketch off, and the window back on
- Subtract the window from the wall with Arch Del button
paullee
Posts: 2502
Joined: Wed May 04, 2016 3:58 pm

Re: Arch Window on Non-Linear Wall?

Postby paullee » Tue Apr 25, 2017 6:16 pm

yorik wrote:Placing a window correctly on such a curved surface will be pretty hard.
I think I would try the following:
- create your window without inserting it in any wall (just in the air)
- turn it off and turn its base sketch on
- position the sketch precisely, tangentially to the curved wall. The sketch doesn't need to touch the wall, what is important is that its axis is at the correct position. I would do that with Draft move and Draft Rotate, maybe you'll need a couple of helper lines
- turn the sketch off, and the window back on
- Subtract the window from the wall with Arch Del button
Thanks, I try your and other approach and have some progress and some other issues:-

- The window sketch is rotated to the correct 'axis' by helper lines
- However, the 'subtraction volume' created by the Arch Window object is still in original orientation (i.e. in this case Y=1)
- Guess need to fix the Axis x, y, z but haven't figure out how to 'mathematically' calculated / formulated
- However, with this approach, the 'subtraction volume' is rectangular (i.e. not edges on sides direction not radial to the curvature....see below) which is sometime fit for the purpose and other not...
- (rotating the window object and underlying sketch will have the window further skewed...)

- Instead, created another wall object with an arc segment and the size of a window opening for subtraction will create opening with edges on sides direction radial)
- However, the creation of a window object with window frame matching the above will be problematic...(probably a series of window as ribbon windows)

Screenshot from 2017-04-26 01-47-54.png
Screenshot from 2017-04-26 01-47-54.png (197.72 KiB) Viewed 1758 times
Screenshot from 2017-04-26 01-45-35.png
Screenshot from 2017-04-26 01-45-35.png (150.37 KiB) Viewed 1758 times
Screenshot from 2017-04-26 02-01-18.png
Screenshot from 2017-04-26 02-01-18.png (206.57 KiB) Viewed 1758 times
Attachments
Test _ Non-linear Wall - Arch Window_ rev 2.fcstd
(83.8 KiB) Downloaded 36 times
User avatar
yorik
Site Admin
Posts: 11978
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Arch Window on Non-Linear Wall?

Postby yorik » Wed Apr 26, 2017 5:33 pm

The window object has a "Normal" property. If you leave that to (0,0,0), the normal direction is decided automatically, but it can fail sometimes. But you can set it to some vector, then it should work correctly.

If you select an edge, typing this short python code in the console will give you a vector that is parallel to the edge. So you could draw a line that is perpendicular to the window plane, and use it as the normal vector (the code below is one single line, not two):

Code: Select all

Gui.Selection.getSelectionEx()[0].SubObjects[0].Vertexes[-1].Point.sub(Gui.Selection.getSelectionEx()[0].SubObjects[0].Vertexes[0].Point).normalize()
paullee
Posts: 2502
Joined: Wed May 04, 2016 3:58 pm

Re: Arch Window on Non-Linear Wall?

Postby paullee » Wed Apr 26, 2017 7:58 pm

yorik wrote:The window object has a "Normal" property. If you leave that to (0,0,0), the normal direction is decided automatically, but it can fail sometimes. But you can set it to some vector, then it should work correctly.

If you select an edge, typing this short python code in the console will give you a vector that is parallel to the edge. So you could draw a line that is perpendicular to the window plane, and use it as the normal vector (the code below is one single line, not two):

Code: Select all

Gui.Selection.getSelectionEx()[0].SubObjects[0].Vertexes[-1].Point.sub(Gui.Selection.getSelectionEx()[0].SubObjects[0].Vertexes[0].Point).normalize()

Thanks again!

I am exploring if any formula could be used to 'refer' the Normal x,y,z? (Trying sketch005.shape....???? but in vain, can't find document to read further)

Setting [0,0,0] turns out works! in 0.16.6707.glibc2.17-x86_64 AppImage on Fedora. (The one in screenshot on the right)

Setting any numbers in 0.17_pre take forever to complete / crash (git 10807 przemof-FreeCAD.repo for Fedora details in below)


Regards


OS: Linux
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10807 (Git)
Build type: Unknown
Branch: master
Hash: b32e9806e1b075c745c0c9692e81aea1dcab81e4
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 6.8.0.oce-0.17

Screenshot from 2017-04-27 03-37-53.png
Screenshot from 2017-04-27 03-37-53.png (194.08 KiB) Viewed 1704 times
User avatar
yorik
Site Admin
Posts: 11978
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Arch Window on Non-Linear Wall?

Postby yorik » Thu Apr 27, 2017 12:06 am

obtaining a normal depends on your shape. In DraftGeomUtils module there is a getNormal() function that tries to obtain a normal from any shape you give to it. Better be it a flat shape, otherwise the result can be not what you want. But for something flat (face or wire(s)) it works well. This will get a normal for a selected object:

import DraftGeomUtils
DraftGeomUtils.getNormal(Gui.Selection.getSelection()[0].Shape)
paullee
Posts: 2502
Joined: Wed May 04, 2016 3:58 pm

Re: Arch Window on Non-Linear Wall?

Postby paullee » Sun Apr 30, 2017 6:28 pm

yorik wrote:obtaining a normal depends on your shape. In DraftGeomUtils module there is a getNormal() function that tries to obtain a normal from any shape you give to it. Better be it a flat shape, otherwise the result can be not what you want. But for something flat (face or wire(s)) it works well. This will get a normal for a selected object:

import DraftGeomUtils
DraftGeomUtils.getNormal(Gui.Selection.getSelection()[0].Shape)
The functions all gives information as indicated, thanks! Yet I need to read more to know how to forward these data in to the required fields in the window object properties. In the meantime, I use a formula expression (similar to that I experiment for 'parametric' mirror line) in the Normal x,y,z fields to get the job done.


I just want to report that in some git version, normal (0,0,0) give exact result I expect as i reported above earlier; whilst in some git (probably the latest Przemof version) this setting result in direction to the opposite (That's why I can't rely on 0,0,0 and develop the formula expression above!)

(I reported earlier that e.g. Y=1 give the desirable direction in ArchWall or ArchStructure, whilst sometime in another git or randomly upon opening the same file, Y=-1 is needed!?)

Hope it helps on debugging.
User avatar
yorik
Site Admin
Posts: 11978
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Arch Window on Non-Linear Wall?

Postby yorik » Mon May 01, 2017 3:58 am

paullee wrote:Yet I need to read more to know how to forward these data in to the required fields in the window object properties.
It's pretty easy, each property is available under its very name (removing the spaces, if any), so for ex. to access the Normal property of an object called "myWindow"):

Code: Select all

obj = FreeCAD.ActiveDocument.getObject("myWindow") # or more simply: FreeCAD.ActiveDocument.myWindow
print obj.Normal
obj.Normal = FreeCAD.Vector(1,2,0)
paullee
Posts: 2502
Joined: Wed May 04, 2016 3:58 pm

Re: Arch Window on Non-Linear Wall?

Postby paullee » Mon May 01, 2017 9:44 am

yorik wrote:

Code: Select all

obj = FreeCAD.ActiveDocument.getObject("myWindow") # or more simply: FreeCAD.ActiveDocument.myWindow
print obj.Normal
obj.Normal = FreeCAD.Vector(1,2,0)
Thanks again providing the steps! I would like to explore later (currently testing the Display Mode - Hi-Res property) to see if the vector obtained by your code earlier could be passed in the code above to avoid hardcoding the vector in.
User avatar
yorik
Site Admin
Posts: 11978
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Arch Window on Non-Linear Wall?

Postby yorik » Mon May 01, 2017 8:10 pm

Note that the code that I gave you, summing up all the steps, is exactly what the window does internally when its Normal property is at (0,0,0): It uses DraftGeomUtils.findNormal on the underlying wire/sketch, and then uses that value as the normal. But on any given planar shape that has no faces, there can be two normals (if there is a face, then the face gives the normal direction). There is no way to tell which one is the one that the user wants. So inevitably sometimes it will fail.