Hatch patterns on Draft objects

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!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Hatch patterns on Draft objects

Post by microelly2 »

I have the problem that hatching only works when the face is parallel to the xy-ground.

I have created facebinder objects from faces of my part and I can add a hatch only to these special faces.
in the other cases i get z-parallel lines (like projections from the xy-pattern down the z-axis)
they do not change when rotate the facebinders down to the xy-plane.

the problem is reconstructable with a simple cube.
Attachments
bn_520.png
bn_520.png (33.62 KiB) Viewed 4380 times
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Hatch patterns on Draft objects

Post by yorik »

Interesting... I never tried applying patterns on non-horizontal (XY) objects... I'll have a look, maybe there is sometihng to tweak in the mapping.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Hatch patterns on Draft objects

Post by microelly2 »

Hello Yorik,

can you tell me how fast you can investigate this

if you say this is fixed in 2 weeks that is okay.
if there is no time or too difficult - it is okay too. i will make a workaround - create a simple copy of a face, place it right and put a texture on it.
and when the master part changes i repeat the procedure with a script.
i only want to avoid parallel work.
thanks for a short feedback..
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Hatch patterns on Draft objects

Post by yorik »

I cannot tell you when I'll have the time to do this unfortunately, sorry.
If you want to try for yourself, you must try to add textures to objects with pivy, and find the way to apply a different mapping until it works. The code that does this is in Draft.py in _ViewProviderDraft.onChanged() (line 3140)

Other people already played with pivy and textures too, there should be more here on the forum.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Hatch patterns on Draft objects

Post by bernd »

yorik wrote:Other people already played with pivy and textures too, there should be more here on the forum.
ahh that was me: viewtopic.php?f=23&t=7216 I did not have the problem with the planes described here.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Hatch patterns on Draft objects

Post by microelly2 »

thank you all for the feedback, I was some days backcountry in the snow of austria. tomorrow I will start my try to iron the pattern to the oblique faces.
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Hatch patterns on Draft objects

Post by yorik »

In any case, patterns work for non-XY objects, but only 2D objects. Indeed facebinder objects have never been tested... I guess for 3D objects the mapping works differently.
draft-hatches.jpg
draft-hatches.jpg (43.31 KiB) Viewed 4178 times
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Hatch patterns on Draft objects

Post by microelly2 »

I have changed the scaling of the SoTextureCoordinatePlane

Code: Select all

                                               self.texcoords.directionS.setValue(s,0,0)
                                                self.texcoords.directionT.setValue(0,s,0)
                                                # hack line 3187
                                                self.texcoords.directionS.setValue(s,0, s)
                                                self.texcoords.directionT.setValue(0,s, s)
 
the result is for facebinder planes parallel to xy the same as the original code,
for the other planes the results are acceptable for me.
there is still an other problem: the attach method is <EDIT: NOT called automaticly after opening the file , so I have to run the onChanged manually to get the correct presentation.
Attachments
m0_pattern_vorlage.fcstd
the test file
(13.88 KiB) Downloaded 116 times
the faces without hack
the faces without hack
bn_525.png (7.88 KiB) Viewed 4152 times
the faces of a cube with all pattern with hack
the faces of a cube with all pattern with hack
bn_527.png (23.1 KiB) Viewed 4152 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Hatch patterns on Draft objects

Post by Kunda1 »

xposting thread Progress on PAT Compatible Hatching viewtopic.php?f=8&t=19897
wandererfan wrote:I've made some progress towards PAT compatible hatching:
FirstCrosshatch.png

These hatches are exportable to Svg:
FirstHatchSvgExport.png

Does anybody know what units the intervals between lines are in? I'm using mm since that seems most natural to FC.
Haven't tried to implement dashed lines yet. No performance tests yet either.

Will let you know how I make out.

wf
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Hatch patterns on Draft objects

Post by wandererfan »

Kunda1 wrote:xposting thread Progress on PAT Compatible Hatching viewtopic.php?f=8&t=19897
These are only vaguely related. PAT hatching only applies to TechDraw drawings, while "Hatch patterns on Draft objects" refers mainly to the 3D view.
Post Reply