Skip to content

Commit

Permalink
Merge pull request FreeCAD#6420 from marioalexis84/draft-drawing_tech…
Browse files Browse the repository at this point in the history
…draw

Arch: Replace Drawing functions with TechDraw functions
  • Loading branch information
yorikvanhavre authored Feb 24, 2022
2 parents 86c91d7 + aec0ae2 commit ed031b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Mod/Arch/ArchComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ def computeAreas(self,obj):
obj.PerimeterLength = 0
return

import Drawing,Part
import TechDraw, Part
fmax = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetInt("MaxComputeAreas",20)
if len(obj.Shape.Faces) > fmax:
obj.VerticalArea = 0
Expand Down Expand Up @@ -1008,7 +1008,7 @@ def computeAreas(self,obj):
pset.append(f)
else:
try:
pf = Part.Face(Part.Wire(Drawing.project(f,FreeCAD.Vector(0,0,1))[0].Edges))
pf = Part.Face(Part.Wire(TechDraw.project(f,FreeCAD.Vector(0,0,1))[0].Edges))
except Part.OCCError:
# error in computing the areas. Better set them to zero than show a wrong value
if obj.HorizontalArea.Value != 0:
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Arch/ArchPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,11 +869,11 @@ def execute(self, obj):
if hasattr(obj.Source.Proxy,"BaseProfile"):
p = obj.Source.Proxy.BaseProfile
n = obj.Source.Proxy.ExtrusionVector
import Drawing
import TechDraw
svg1 = ""
svg2 = ""
result = ""
svg1 = Drawing.projectToSVG(p,DraftVecUtils.neg(n))
svg1 = TechDraw.projectToSVG(p,DraftVecUtils.neg(n))
if svg1:
w = str(obj.LineWidth/obj.Scale) #don't let linewidth be influenced by the scale...
svg1 = svg1.replace('stroke-width="0.35"','stroke-width="'+w+'"')
Expand Down
16 changes: 8 additions & 8 deletions src/Mod/Arch/ArchSectionPlane.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,12 @@ def getSVG(source,
if should_update_svg_cache:
svgcache = ""
# render using the Drawing module
import Drawing, Part
import TechDraw, Part
if vshapes:
baseshape = Part.makeCompound(vshapes)
style = {'stroke': "SVGLINECOLOR",
'stroke-width': "SVGLINEWIDTH"}
svgcache += Drawing.projectToSVG(
svgcache += TechDraw.projectToSVG(
baseshape, direction,
hStyle=style, h0Style=style, h1Style=style,
vStyle=style, v0Style=style, v1Style=style)
Expand All @@ -497,7 +497,7 @@ def getSVG(source,
style = {'stroke': "SVGLINECOLOR",
'stroke-width': "SVGLINEWIDTH",
'stroke-dasharray': "SVGHIDDENPATTERN"}
svgcache += Drawing.projectToSVG(
svgcache += TechDraw.projectToSVG(
hshapes, direction,
hStyle=style, h0Style=style, h1Style=style,
vStyle=style, v0Style=style, v1Style=style)
Expand All @@ -524,7 +524,7 @@ def getSVG(source,
sshapes = Part.makeCompound(sshapes)
style = {'stroke': "SVGLINECOLOR",
'stroke-width': "SVGCUTLINEWIDTH"}
svgcache += Drawing.projectToSVG(
svgcache += TechDraw.projectToSVG(
sshapes, direction,
hStyle=style, h0Style=style, h1Style=style,
vStyle=style, v0Style=style, v1Style=style)
Expand Down Expand Up @@ -629,7 +629,7 @@ def getDXF(obj):
elif hasattr(obj,"showHidden"):
showHidden = obj.showHidden
result = []
import Drawing,Part
import TechDraw, Part
if not obj.Source:
return result
source = obj.Source
Expand All @@ -641,11 +641,11 @@ def getDXF(obj):
objs = [o for o in objs if ((not(Draft.getType(o) in ["Space","Dimension","Annotation"])) and (not (o.isDerivedFrom("Part::Part2DObject"))))]
vshapes,hshapes,sshapes,cutface,cutvolume,invcutvolume = getCutShapes(objs,cutplane,onlySolids,clip,False,showHidden)
if vshapes:
result.append(Drawing.projectToDXF(Part.makeCompound(vshapes),direction))
result.append(TechDraw.projectToDXF(Part.makeCompound(vshapes),direction))
if sshapes:
result.append(Drawing.projectToDXF(Part.makeCompound(sshapes),direction))
result.append(TechDraw.projectToDXF(Part.makeCompound(sshapes),direction))
if hshapes:
result.append(Drawing.projectToDXF(Part.makeCompound(hshapes),direction))
result.append(TechDraw.projectToDXF(Part.makeCompound(hshapes),direction))
return result


Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Arch/ArchSite.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,11 +749,11 @@ def computeAreas(self,obj):
if f.normalAt(0,0).getAngle(FreeCAD.Vector(0,0,1)) < 1.5707:
fset.append(f)
if fset:
import Drawing,Part
import TechDraw, Part
pset = []
for f in fset:
try:
pf = Part.Face(Part.Wire(Drawing.project(f,FreeCAD.Vector(0,0,1))[0].Edges))
pf = Part.Face(Part.Wire(TechDraw.project(f,FreeCAD.Vector(0,0,1))[0].Edges))
except Part.OCCError:
# error in computing the area. Better set it to zero than show a wrong value
if obj.ProjectedArea.Value != 0:
Expand Down

0 comments on commit ed031b5

Please sign in to comment.