Arch: Fixed Arch example - fixes #1789

This commit is contained in:
Yorik van Havre 2014-12-31 14:42:22 -02:00
parent cb5a807990
commit 3f607d73a4
3 changed files with 17 additions and 0 deletions

Binary file not shown.

View File

@ -110,6 +110,10 @@ class _SectionPlane:
if hasattr(obj.ViewObject,"DisplayLength"): if hasattr(obj.ViewObject,"DisplayLength"):
l = obj.ViewObject.DisplayLength.Value l = obj.ViewObject.DisplayLength.Value
h = obj.ViewObject.DisplayHeight.Value h = obj.ViewObject.DisplayHeight.Value
elif hasattr(obj.ViewObject,"DisplaySize"):
# old objects
l = obj.ViewObject.DisplaySize.Value
h = obj.ViewObject.DisplaySize.Value
else: else:
l = 1 l = 1
h = 1 h = 1
@ -213,6 +217,10 @@ class _ViewProviderSectionPlane:
if hasattr(vobj,"DisplayLength"): if hasattr(vobj,"DisplayLength"):
ld = vobj.DisplayLength.Value/2 ld = vobj.DisplayLength.Value/2
hd = vobj.DisplayHeight.Value/2 hd = vobj.DisplayHeight.Value/2
elif hasattr(vobj,"DisplaySize"):
# old objects
ld = vobj.DisplaySize.Value/2
hd = vobj.DisplaySize.Value/2
else: else:
ld = 1 ld = 1
hd = 1 hd = 1
@ -273,6 +281,9 @@ class _ArchDrawingView:
self.onChanged(obj,"Source") self.onChanged(obj,"Source")
if not hasattr(self,"svg"): if not hasattr(self,"svg"):
return '' return ''
if not hasattr(self,"direction"):
p = FreeCAD.Placement(obj.Source.Placement)
self.direction = p.Rotation.multVec(FreeCAD.Vector(0,0,1))
linewidth = obj.LineWidth/obj.Scale linewidth = obj.LineWidth/obj.Scale
st = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetFloat("CutLineThickness",2) st = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetFloat("CutLineThickness",2)
da = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetString("archHiddenPattern","30,10") da = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetString("archHiddenPattern","30,10")

View File

@ -275,6 +275,9 @@ class Renderer:
def isInside(self,vert,face): def isInside(self,vert,face):
"Returns True if the vert is inside the face in Z projection" "Returns True if the vert is inside the face in Z projection"
if not face:
return False
# http://paulbourke.net/geometry/insidepoly/ # http://paulbourke.net/geometry/insidepoly/
count = 0 count = 0
p = self.wp.getLocalCoords(vert.Point) p = self.wp.getLocalCoords(vert.Point)
@ -298,6 +301,9 @@ class Renderer:
face1 = self.flattenFace(face1) face1 = self.flattenFace(face1)
face2 = self.flattenFace(face2) face2 = self.flattenFace(face2)
if (not face1) or (not face2):
return False
# first we check if one of the verts is inside the other face # first we check if one of the verts is inside the other face
for v in face1[0].Vertexes: for v in face1[0].Vertexes:
if self.isInside(v,face2): if self.isInside(v,face2):