TechDraw GeometricHatch: Difference between revisions

From FreeCAD Documentation
m (limit image size)
(Added "solid color fill" note.)
 
(27 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>

<!--T:19-->
<!--T:19-->
{{Docnav
{{Docnav
|[[TechDraw_Hatch|Hatch Face using Image File]]
|[[TechDraw_Hatch|Hatch]]
|[[TechDraw_Symbol|Insert SVG Symbol]]
|[[TechDraw_Symbol|Symbol]]
|[[TechDraw_Module|TechDraw]]
|[[TechDraw_Workbench|TechDraw]]
|IconL=TechDraw_Hatch.svg
|IconL=TechDraw_Hatch.svg
|IconC=Workbench_TechDraw.svg
|IconR=TechDraw_Symbol.svg
|IconR=TechDraw_Symbol.svg
|IconC=Workbench_TechDraw.svg
}}
}}


Line 14: Line 15:
{{GuiCommand
{{GuiCommand
|Name=TechDraw GeometricHatch
|Name=TechDraw GeometricHatch
|MenuLocation=TechDraw → Apply Geometric Hatch to Face
|MenuLocation=TechDraw → Hatching → Apply Geometric Hatch to Face
|Workbenches=[[TechDraw Module|TechDraw]]
|Workbenches=[[TechDraw_Workbench|TechDraw]]
|SeeAlso=[[TechDraw_Hatch|Hatch Face using Image File]], [[TechDraw_Hatching|TechDraw Hatching]]
|SeeAlso=[[TechDraw_Hatch|TechDraw Hatch]], [[TechDraw_Hatching|TechDraw Hatching]]
}}
}}


Line 22: Line 23:


<!--T:8-->
<!--T:8-->
The GeometricHatch tool fills a closed region in a View with a pattern based on an AutoDesk PAT hatching specification. '''Alternatively''', the [[TechDraw_Hatch|Hatch]] tool uses an [[SVG|SVG]] or [[bitmap|bitmap]] file as hatch pattern, see [[TechDraw_Hatching|Hatching]] for details.
The '''TechDraw GeometricHatch''' tool fills a closed region in a View with a pattern based on an AutoDesk PAT hatching specification. Alternatively the [[Image:TechDraw_Hatch.svg|16px]] [[TechDraw_Hatch|TechDraw Hatch]] tool uses SVG based hatch patterns. See [[TechDraw_Hatching|Hatching]] for details.


</translate>
</translate>
Line 33: Line 34:


<!--T:10-->
<!--T:10-->
# Select an closed region in a View. The region will turn green.
# Select a closed region in a View.
# There are several ways to invoke the tool:
# Press the {{Button|[[Image:TechDraw_GeometricHatch.svg|16px]] [[TechDraw_GeometricHatch|Apply Geometric Hatch to Face]]}} button
#* Press the {{Button|[[Image:TechDraw_GeometricHatch.svg|16px]] [[TechDraw_GeometricHatch|TechDraw GeometricHatch]]}} button.
# a dialog will open where you may select your pattern, a scale for the pattern and a line weight.
#* Select the {{MenuCommand|TechDraw → Hatching → [[Image:TechDraw_GeometricHatch.svg|16px]] Apply Geometric Hatch to Face}} option from the menu.
# You may need to press {{Button|[[Image:Std_Refresh.svg|16px]] [[Std_Refresh|Refresh]]}} and/or {{Button|[[Image:TechDraw RedrawPage.svg|16px]] [[TechDraw_RedrawPage|Redraw Page]]}} to get the pattern to update.
# The {{MenuCommand|Apply Geometric Hatch to Face}} task panel opens.
# Optionally change the {{MenuCommand|Pattern File}}, the {{MenuCommand|Pattern Name}}, the {{MenuCommand|Pattern Scale}}, the {{MenuCommand|Line Weight}} and the {{MenuCommand|Line Color}}.
# Press the {{Button|OK}} button.


== Notes == <!--T:7-->
== Notes == <!--T:7-->


<!--T:11-->
<!--T:11-->
* For a solid color fill use [[TechDraw_Hatch|TechDraw Hatch]] instead and select {{FileName|solid.svg}} as the '''Pattern File'''.
* Hatching objects are vulnerable to "[[Topological naming problem|topological naming]]" issues. See the information in the {{Button|[[Image:TechDraw_Dimension_Length.png|16px]] [[TechDraw Dimension Length|TechDraw Dimension Length]]}} tool for more information. It is recommended that hatching be one of the last steps in your drawing process.
* Hatching objects are vulnerable to the "[[Topological_naming_problem|topological naming problem]]". See [[TechDraw_LengthDimension|TechDraw LengthDimension]] for more information. It is recommended that hatching be one of the last steps in your drawing process.
* Unlike the [[TechDraw_Hatch|Hatch ]] tool, geometric hatch patterns are included when a drawing page is saved as an [[SVG|SVG]] file.
* A small set of sample patterns are available in:

<!--T:12-->
A small set of sample patterns are available in:

</translate>
</translate>
{{Code|code=
: {{Code|code=
$INSTALL_DIR/Mod/TechDraw/PAT/FCPAT.pat
$INSTALL_DIR/data/Mod/TechDraw/PAT/FCPAT.pat
}}
}}
<translate>
<translate>

<!--T:13-->
<!--T:13-->
{{incode|$INSTALL_DIR}} is the directory where FreeCAD was installed, for example
: Where {{incode|$INSTALL_DIR}} is the directory where FreeCAD was installed, for example:

</translate>
</translate>
{{Code|code=
: {{Code|code=
/usr/share/freecad/Mod/TechDraw/PAT/FCPAT.pat
/usr/share/freecad/data/Mod/TechDraw/PAT/FCPAT.pat
}}
}}
<translate>
<translate>
Line 75: Line 74:


<!--T:15-->
<!--T:15-->
{{Emphasis|See also:}} [[TechDraw API]] and [[FreeCAD Scripting Basics]].
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation] and [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].


<!--T:16-->
<!--T:16-->
The GeometricHatch tool can be used in [[macros]] and from the [[Python]] console by using the following functions:
A GeometricHatch can be created with [[Macros|macros]] and from the [[Python|Python]] console by using the following functions:


</translate>
</translate>
{{Code|code=
{{Code|code=
hatch = FreeCAD.ActiveDocument.addObject('TechDraw::DrawGeomHatch','GeomHatch')
hatch = FreeCAD.ActiveDocument.addObject("TechDraw::DrawGeomHatch", "GeomHatch")
hatch.Source = (view1,["Face0"])
hatch.Source = (view1, ["Face0"])
hatch.FilePattern = "path/to/myPATfile.pat"
hatch.FilePattern = "path/to/myPATfile.pat"
hatch.NamePattern = "Diamond"
hatch.NamePattern = "Diamond"
rc = page.addView(hatch)
page.addView(hatch)
}}
<translate>

<!--T:21-->
It is also possible to use TechDraw's geometric hatch engine to produce a compound object in the 3D space. One must take care that the base face lies on the XY plane, as the algorithm is not tailored yet for other cases:

</translate>
{{Code|code=
import TechDraw
face = Part.makePlane(10, 10)
patfile = "path/to/myPATfile.pat"
pattern = "Diamond"
scale = 10
hatch = TechDraw.makeGeomHatch(face, scale, pattern, patfile)
Part.show(hatch)
}}
}}
<translate>
<translate>
Line 93: Line 107:
<!--T:20-->
<!--T:20-->
{{Docnav
{{Docnav
|[[TechDraw_Hatch|Hatch Face using Image File]]
|[[TechDraw_Hatch|Hatch]]
|[[TechDraw_Symbol|Insert SVG Symbol]]
|[[TechDraw_Symbol|Symbol]]
|[[TechDraw_Module|TechDraw]]
|[[TechDraw_Workbench|TechDraw]]
|IconL=TechDraw_Hatch.svg
|IconL=TechDraw_Hatch.svg
|IconC=Workbench_TechDraw.svg
|IconR=TechDraw_Symbol.svg
|IconR=TechDraw_Symbol.svg
|IconC=Workbench_TechDraw.svg
}}
}}


<!--T:17-->
{{TechDraw Tools navi}}

<!--T:18-->
{{Userdocnavi}}
</translate>
</translate>
{{TechDraw Tools navi{{#translation:}}}}
{{clear}}
{{Userdocnavi{{#translation:}}}}

Latest revision as of 07:57, 1 August 2023

TechDraw GeometricHatch

Menu location
TechDraw → Hatching → Apply Geometric Hatch to Face
Workbenches
TechDraw
Default shortcut
None
Introduced in version
-
See also
TechDraw Hatch, TechDraw Hatching

Description

The TechDraw GeometricHatch tool fills a closed region in a View with a pattern based on an AutoDesk PAT hatching specification. Alternatively the TechDraw Hatch tool uses SVG based hatch patterns. See Hatching for details.

Geometric hatch pattern on a face

Usage

  1. Select a closed region in a View.
  2. There are several ways to invoke the tool:
    • Press the TechDraw GeometricHatch button.
    • Select the TechDraw → Hatching → Apply Geometric Hatch to Face option from the menu.
  3. The Apply Geometric Hatch to Face task panel opens.
  4. Optionally change the Pattern File, the Pattern Name, the Pattern Scale, the Line Weight and the Line Color.
  5. Press the OK button.

Notes

  • For a solid color fill use TechDraw Hatch instead and select solid.svg as the Pattern File.
  • Hatching objects are vulnerable to the "topological naming problem". See TechDraw LengthDimension for more information. It is recommended that hatching be one of the last steps in your drawing process.
  • A small set of sample patterns are available in:
$INSTALL_DIR/data/Mod/TechDraw/PAT/FCPAT.pat
Where $INSTALL_DIR is the directory where FreeCAD was installed, for example:
/usr/share/freecad/data/Mod/TechDraw/PAT/FCPAT.pat

Properties

  • DataSource: The View and Face to receive the hatch pattern.
  • DataFile Pattern: The location of the PAT file to use.
  • DataName Pattern: The name of the PAT specification within File Pattern.
  • DataScale Pattern: The scale to be applied to the pattern (must be > 0.0).
  • ViewWeight Pattern: The thickness of the pattern lines.
  • ViewColor Pattern: The color for the pattern lines.

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

A GeometricHatch can be created with macros and from the Python console by using the following functions:

hatch = FreeCAD.ActiveDocument.addObject("TechDraw::DrawGeomHatch", "GeomHatch")
hatch.Source = (view1, ["Face0"])
hatch.FilePattern = "path/to/myPATfile.pat"
hatch.NamePattern = "Diamond"
page.addView(hatch)

It is also possible to use TechDraw's geometric hatch engine to produce a compound object in the 3D space. One must take care that the base face lies on the XY plane, as the algorithm is not tailored yet for other cases:

import TechDraw
face = Part.makePlane(10, 10)
patfile = "path/to/myPATfile.pat"
pattern = "Diamond"
scale = 10
hatch = TechDraw.makeGeomHatch(face, scale, pattern, patfile)
Part.show(hatch)