Merge pull request #6406 from marioalexis84/draft-drawing_techdraw

Draft: Replace Drawing functions with TechDraw functions
This commit is contained in:
Yorik van Havre
2022-02-21 11:10:36 +01:00
committed by GitHub
5 changed files with 13 additions and 29 deletions

View File

@@ -21,11 +21,6 @@
# * *
# ***************************************************************************
"""Provides functions to return the DXF representation of various shapes.
Warning: this still uses the `Drawing.projectToDXF` method to provide
the DXF representation of certain objects.
Therefore, even if the Drawing Workbench is obsolete, the `Drawing` module
may not be removed completely yet. This must be checked.
"""
## @package dxf
# \ingroup draftfunctions
@@ -43,7 +38,7 @@ from draftutils.messages import _wrn
# Delay import of module until first use because it is heavy
Part = lz.LazyLoader("Part", globals(), "Part")
DraftGeomUtils = lz.LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils")
Drawing = lz.LazyLoader("Drawing", globals(), "Drawing")
TechDraw = lz.LazyLoader("TechDraw", globals(), "TechDraw")
## \addtogroup draftfunctions
@@ -119,7 +114,7 @@ def get_dxf(obj, direction=None):
direction = App.Vector(0, 0, -1)
try:
d = Drawing.projectToDXF(obj.Shape, direction)
d = TechDraw.projectToDXF(obj.Shape, direction)
except Exception:
# TODO: trap only specific exception.
# Impossible to generate DXF from Shape? Which exception is throw?

View File

@@ -22,11 +22,6 @@
# * *
# ***************************************************************************
"""Provides functions to return the SVG representation of various shapes.
Warning: this still uses the `Drawing.projectToSVG` method to provide
the SVG representation of certain objects.
Therefore, even if the Drawing Workbench is obsolete, the `Drawing` module
may not be removed completely yet. This must be checked.
"""
## @package svg
# \ingroup draftfunctions
@@ -48,7 +43,6 @@ from draftutils.messages import _wrn, _err
# Delay import of module until first use because it is heavy
Part = lz.LazyLoader("Part", globals(), "Part")
DraftGeomUtils = lz.LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils")
# Drawing = lz.LazyLoader("Drawing", globals(), "Drawing")
## \addtogroup draftfunctions

View File

@@ -22,11 +22,6 @@
# * *
# ***************************************************************************
"""Provides functions to return the SVG representation of some shapes.
Warning: this still uses the `Drawing.projectToSVG` method to provide
the SVG representation of certain objects.
Therefore, even if the Drawing Workbench is obsolete, the `Drawing` module
may not be removed completely yet. This must be checked.
"""
## @package svgshapes
# \ingroup draftfunctions
@@ -45,7 +40,7 @@ from draftutils.messages import _msg, _wrn
# Delay import of module until first use because it is heavy
Part = lz.LazyLoader("Part", globals(), "Part")
DraftGeomUtils = lz.LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils")
Drawing = lz.LazyLoader("Drawing", globals(), "Drawing")
TechDraw = lz.LazyLoader("TechDraw", globals(), "TechDraw")
## \addtogroup draftfunctions
# @{
@@ -151,7 +146,7 @@ def _get_path_circ_ellipse(plane, edge, vertex, edata,
done = False
if int(occversion[0]) >= 7 and int(occversion[1]) >= 1:
# if using occ >= 7.1, use HLR algorithm
snip = Drawing.projectToSVG(edge, drawing_plane_normal)
snip = TechDraw.projectToSVG(edge, drawing_plane_normal)
if snip:
try: