Draft: Update Draft example file (#23284)

* Draft: Update Draft example file

Fixes #23198

I have added osifont-lgpl3fe.ttf to the example folder. The ShapeString in draft_test_objects.FCStd references it using a
relative path. I am not sure if including the font here is allowed though.

Additionally: The example file showed up an error in view_wire.py. It is also used for fillets (which do not have a Points property).

* Updated

* Also use a relative path for the PAT file.
* Subfolder for the PAT and TTF files.

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt
This commit is contained in:
Roy-043
2025-09-25 14:21:12 +02:00
committed by GitHub
parent e13e2dace7
commit 9a722c7105
7 changed files with 40 additions and 5 deletions

View File

@@ -8,6 +8,9 @@ SET(Examples_Files
FEMExample.FCStd FEMExample.FCStd
AssemblyExample.FCStd AssemblyExample.FCStd
ArchDetail.FCStd ArchDetail.FCStd
draft_test_objects_files/FCPAT.pat
draft_test_objects_files/osifont.license
draft_test_objects_files/osifont-lgpl3fe.ttf
) )
ADD_CUSTOM_TARGET(Example_data ALL ADD_CUSTOM_TARGET(Example_data ALL
@@ -132,4 +135,3 @@ INSTALL(
DESTINATION DESTINATION
${CMAKE_INSTALL_DATADIR}/examples ${CMAKE_INSTALL_DATADIR}/examples
) )

View File

@@ -0,0 +1,23 @@
; standard PAT patterns
*Diamond, 45 diagonals L & R, Solid, 1.0 mm separation
45,0,0,0,1.0
-45,0,0,0,1.0
*Diamond2, 45 diagonals L & R, Solid, 2.0 mm separation
45,0,0,0,2.0
-45,0,0,0,2.0
*Diamond4, 45 diagonals L & R, Solid, 4.0 mm separation
45,0,0,0,4.0
-45,0,0,0,4.0
*Diagonal4, 45 diagonal R, Solid, 4.0 mm separation
45,0,0,0,4.0
*Diagonal5, 45 diagonal L, Solid, 4.0 mm separation
-45,0,0,0,4.0
*Square, square grid, Solid, 5.0 mm separation
90,1,1,0,5.0
0,0,0,1,5.0
*Horizontal5, horizontal lines, Solid 5.0 separation
0,0,0,0,5.0
*Vertical5, vertical lines, Solid, 5.0 separation
90,0,0,0,5.0

View File

@@ -0,0 +1,9 @@
osifont license:
osifont-lgpl3fe.ttf is used under one or more of the following licenses:
- GNU GPL licence version 3 with GPL font exception,
- GNU GPL licence version 2 with GPL font exception,
- GNU LGPL licence version 3 with GPL font exception.
https://github.com/hikikomori82/osifont/

View File

@@ -452,7 +452,7 @@ def _create_objects(doc=None,
# Circular array # Circular array
_msg(16 * "-") _msg(16 * "-")
_msg("Circular array") _msg("Circular array")
polygon = Draft.make_polygon(5, 30) polygon = Draft.make_polygon(3, 30)
polygon.Placement.Base = Vector(4250, 4250, 0) polygon.Placement.Base = Vector(4250, 4250, 0)
if App.GuiUp: if App.GuiUp:
polygon.ViewObject.Visibility = False polygon.ViewObject.Visibility = False
@@ -463,14 +463,14 @@ def _create_objects(doc=None,
3, 3,
1, 1,
Vector(0, 0, 1), Vector(0, 0, 1),
Vector(0, 0, 0), Vector(4250, 4250, 0),
use_link=False) use_link=False)
_set_text(["Circular array"], Vector(4000, 3800, 0)) _set_text(["Circular array"], Vector(4000, 3800, 0))
# Circular link array # Circular link array
_msg(16 * "-") _msg(16 * "-")
_msg("Circular link array") _msg("Circular link array")
polygon = Draft.make_polygon(6, 30) polygon = Draft.make_polygon(4, 30)
polygon.Placement.Base = Vector(5250, 4250, 0) polygon.Placement.Base = Vector(5250, 4250, 0)
if App.GuiUp: if App.GuiUp:
polygon.ViewObject.Visibility = False polygon.ViewObject.Visibility = False
@@ -481,7 +481,7 @@ def _create_objects(doc=None,
3, 3,
1, 1,
Vector(0, 0, 1), Vector(0, 0, 1),
Vector(0, 0, 0), Vector(5250, 4250, 0),
use_link=True) use_link=True)
_set_text(["Circular link array"], Vector(5000, 3800, 0)) _set_text(["Circular link array"], Vector(5000, 3800, 0))

View File

@@ -122,6 +122,7 @@ class ViewProviderWire(ViewProviderDraft):
def updateData(self, obj, prop): def updateData(self, obj, prop):
if prop == "Points" \ if prop == "Points" \
and hasattr(obj, "Points") \
and len(obj.Points) >= 2 \ and len(obj.Points) >= 2 \
and hasattr(self, "coords1") \ and hasattr(self, "coords1") \
and hasattr(self, "coords2"): and hasattr(self, "coords2"):