Draft Hatch

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
User avatar
yorik
Site Admin
Posts: 12315
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

Draft Hatch

Postby yorik » Wed Sep 08, 2021 11:35 am

Screenshot from 2021-09-08 13-32-59.png
Screenshot from 2021-09-08 13-32-59.png (132.97 KiB) Viewed 1589 times
There is now a new Hatch tool in the Draft WB for you to test! ( I still need to iron out some bugs, and need to write the doc once it's "stabilized" ). But basically:

- You select an existing object containing faces, click the tool, and the faces get filled with a hatch pattern. If the base object changes, so does the hatching.
- It produces a standard Part shape, so it works everywhere (TechDraw, DXF export,booleans,...)
- It uses the TechDraw patterns code. By default it uses the included PAT file of TD, but I would recommend googling for an acad.pat out there and use that instead ;) Changing the default PAT file in TD preferences will affect both TD and this tool.
- The PAT file used by this tool is recorded in the object, so you can have several objects using different PAT files. Opening that file on a computer without the appropriate PAT files will open fine, but the hatch objects won't be modifiable. The PAT file itself is not included in the saved file.
- The TD system doesn't handle well dashed patterns yet. So for now stick with patterns that have continuous lines (anyone up to trying to solve this? ;) I guess in https://github.com/FreeCAD/FreeCAD/blob ... chLine.cpp )
- The TD algo only works in the XY plane. So the Draft Hatch code translates all faces to the XY plane, calculates the hatch, and moves the hatch back to the face location. This is still buggy sometimes, so there is a Translate property that can be turned off, so it doesn't perform this relocation. If your base faces are in the XY plane, that option can be safely turned off. Here too, if someone wants to help me to look into the relocatin bug... :mrgreen: https://github.com/FreeCAD/FreeCAD/blob ... ch.py#L103

Tell me what you think!
paullee
Posts: 3732
Joined: Wed May 04, 2016 3:58 pm

Re: Draft Hatch

Postby paullee » Wed Sep 08, 2021 2:35 pm

Looks great for another new feature :D

Compile or wait for coming weekly-build right?
User avatar
HenriqueReis
Posts: 5
Joined: Tue Mar 23, 2021 4:57 pm
Location: São Paulo - SP
Contact:

Re: Draft Hatch

Postby HenriqueReis » Wed Sep 08, 2021 2:59 pm

In my view it is a great resource, I believe a lot in the potential of the tool and the workbench, mainly. I would like to understand better is that this tool is already available for testing or it will come in a future update... another point is how with the symbology libraries.
carlopav
Posts: 1915
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Hatch

Postby carlopav » Wed Sep 08, 2021 6:07 pm

running:

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.25678 (Git)
Build type: Release
Branch: master
Hash: 48c1738a533ac63527cf46018c773f0ebb03adfd
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: Italian/Italy (it_IT)
I get the following error when running the command:

Code: Select all

20:05:29  Running the Python command 'Draft_Hatch' failed:
Traceback (most recent call last):
  File "C:\Users\carlo\Documents\FreeCAD-Source\FreeCAD_compiled\Mod\Draft\draftguitools\gui_hatch.py", line 46, in Activated
    FreeCADGui.Control.showDialog(Draft_Hatch_TaskPanel(FreeCADGui.Selection.getSelection()[0]))
  File "C:\Users\carlo\Documents\FreeCAD-Source\FreeCAD_compiled\Mod\Draft\draftguitools\gui_hatch.py", line 61, in __init__
    self.form = FreeCADGui.PySideUic.loadUi(":/ui/dialogHatch.ui")
  File "<string>", line 4, in <module>

Cannot open file
I Guess it's because of windoz..
Also the icon is not displayed.
Hope it helps
follow my experiments on BIM modelling for architecture design
User avatar
yorik
Site Admin
Posts: 12315
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

Re: Draft Hatch

Postby yorik » Thu Sep 09, 2021 8:19 am

hmm the qt resources are not updated (the icon and the dialog are missing). you recompiled freecad yourself, right? probably you need to touch Draft/Resources/Draft.qrc to trigger recompiling it. But i don't think win has a "touch" command, not sure how that is done
User avatar
ragohix769
Posts: 239
Joined: Sat Jul 18, 2020 7:04 am
Location: Rome - Italy

Re: Draft Hatch

Postby ragohix769 » Thu Sep 09, 2021 9:33 am

Hello Yorik,

I tried Hatch tool for Draft, and it's AMAZING!!!
Really helpful, and sometimes it avoid hatching in TD that for now it's not very handy.

Some bugs problem found in this teaser (in order of importance):

1) if you use the angle rotation, the hatch it's coming out of the face (see my attachement image here)
2) sometime if you import the object in TD the hatch it's not visible (it's all black)
3) changing scale or value in angle for the hatch, it's *really* slow in calculation, especially for some type of hatching (diamond, IE), and it's not usable (i tried to on a 6 core 12 thread Ryzen system with 32 GB of ram, so it's not an HW problem)

Rather then that, it's an incredible idea to create an hatching tool in draft, so we can draw directly in draft/arch and then export it in TD, that for now, as said, sadly it's not very handy for some workflow (even with the new beautiful and increbile TD tools script).

[Especially section plane cut imported in TD cannot make any dimensioning measure in TD, it's dramatic problem limitation of TD, IMHO]

It's very interesting too (in the future) to imagene the creation of a tool to manage and control the *.pat library and/or to create new patterns easily via an SVG file (like in Inkscape). IE for Arch should be inserted some basic roof patterns, with angle/direction.

Thanks again Yorik!!
Attachments
weps.png
weps.png (364.89 KiB) Viewed 1222 times
carlopav
Posts: 1915
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Draft Hatch

Postby carlopav » Thu Sep 09, 2021 8:47 pm

It was Draft.qrc indeed! Really nice tool... bravo!

I can confirm the problem with the angle reported by ragohix769
follow my experiments on BIM modelling for architecture design
User avatar
Roy_043
Posts: 3610
Joined: Thu Dec 27, 2018 12:28 pm

Re: Draft Hatch

Postby Roy_043 » Sun Sep 12, 2021 7:58 am

Maybe a minor detail, but the function in make_hatch.py should be called make_hatch. The name makeHatch should not be used at all as it follows the old, now obsolete, naming scheme. Or is the new scheme being abandoned?

The name of the class: Draft_Hatch_Object also seems strange to me when compared to other class names. If you follow the pattern of other classes you would expect just Hatch.
User avatar
yorik
Site Admin
Posts: 12315
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

Re: Draft Hatch

Postby yorik » Thu Sep 16, 2021 11:30 am

There are indeed issues with the positioning. Not only the rotation, but also if you apply a hatch on non-XY faces. But I couldn't yet figure out if it comes from my code or the TD algorithm.

About function/class names, indeed I might not have cared too scrupulously about python good practices, sorry... Will have a look next time I touch that code (feel free to PR too ;) )