Arch: Bugfixes and hidden lines mode for section planes

This commit is contained in:
Yorik van Havre 2012-08-05 18:01:58 -03:00
parent eac9182ac9
commit aae9b17e32
6 changed files with 367 additions and 175 deletions

View File

@ -278,7 +278,7 @@ def getCutVolume(cutplane,shapes):
v = placement.Rotation.multVec(FreeCAD.Vector(0,1,0))
if not bb.isCutPlane(placement.Base,ax):
print "No objects are cut by the plane"
return None,None
return None,None,None
else:
corners = [FreeCAD.Vector(bb.XMin,bb.YMin,bb.ZMin),
FreeCAD.Vector(bb.XMin,bb.YMax,bb.ZMin),
@ -305,7 +305,9 @@ def getCutVolume(cutplane,shapes):
cutface.Placement = placement
cutnormal = DraftVecUtils.scaleTo(ax,wm)
cutvolume = cutface.extrude(cutnormal)
return cutface,cutvolume
cutnormal = DraftVecUtils.neg(cutnormal)
invcutvolume = cutface.extrude(cutnormal)
return cutface,cutvolume,invcutvolume
def meshToShape(obj,mark=True):
@ -428,8 +430,8 @@ def download(url):
else:
return filepath
def check(objectslist,includehidden=True):
"""check(objectslist,includehidden=True): checks if the given objects contain only solids"""
def check(objectslist,includehidden=False):
"""check(objectslist,includehidden=False): checks if the given objects contain only solids"""
objs = Draft.getGroupContents(objectslist)
if not includehidden:
objs = Draft.removeHidden(objs)
@ -439,11 +441,11 @@ def check(objectslist,includehidden=True):
bad.append([o,"is not a Part-based object"])
else:
s = o.Shape
if not s.isClosed():
if (not s.isClosed()) and (not (Draft.getType(o) == "Axis")):
bad.append([o,"is not closed"])
elif not s.isValid():
bad.append([o,"is not valid"])
elif not s.Solids:
elif (not s.Solids) and (not (Draft.getType(o) == "Axis")):
bad.append([o,"doesn't contain any solid"])
else:
f = 0

View File

@ -184,10 +184,12 @@ class _ArchDrawingView:
def __init__(self, obj):
obj.addProperty("App::PropertyLink","Source","Base","The linked object")
obj.addProperty("App::PropertyEnumeration","RenderingMode","Drawing View","The rendering mode to use")
obj.addProperty("App::PropertyBool","ShowCut","Drawing View","If cut geometry is shown or not")
obj.addProperty("App::PropertyFloat","LineWidth","Drawing View","The line width of the rendered objects")
obj.RenderingMode = ["Solid","Wireframe"]
obj.RenderingMode = "Wireframe"
obj.LineWidth = 0.35
obj.ShowCut = False
obj.Proxy = self
self.Type = "DrawingView"
@ -199,6 +201,22 @@ class _ArchDrawingView:
if prop in ["Source","RenderingMode"]:
obj.ViewResult = self.updateSVG(obj)
def __getstate__(self):
return None
def __setstate__(self,state):
return None
def getShape(self, obj):
"returns a flat shape representation of the view"
if hasattr(self,"baseshape"):
import Drawing
[V0,V1,H0,H1] = Drawing.project(self.baseshape,direction)
return V0.Edges+V1.Edges
else:
print "No shape has been computed yet"
return None
def updateSVG(self, obj,join=False):
"encapsulates a svg fragment into a transformation node"
import Part, DraftGeomUtils
@ -209,6 +227,9 @@ class _ArchDrawingView:
objs = Draft.removeHidden(objs)
svg = ''
st = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetFloat("CutLineThickness")
if not st: st = 2
# generating SVG
linewidth = obj.LineWidth/obj.Scale
if obj.RenderingMode == "Solid":
@ -217,29 +238,43 @@ class _ArchDrawingView:
render = ArchVRM.Renderer()
render.setWorkingPlane(obj.Source.Placement)
render.addObjects(Draft.getGroupContents(objs,walls=True))
render.cut(obj.Source.Shape)
render.cut(obj.Source.Shape,obj.ShowCut)
svg += render.getViewSVG(linewidth=linewidth)
svg += render.getSectionSVG(linewidth=linewidth*2)
svg += render.getSectionSVG(linewidth=linewidth*st)
if obj.ShowCut:
svg += render.getHiddenSVG(linewidth=linewidth)
# print render.info()
else:
# render using the Drawing module
import Drawing, Part
shapes = []
hshapes = []
sshapes = []
p = FreeCAD.Placement(obj.Source.Placement)
direction = p.Rotation.multVec(FreeCAD.Vector(0,0,1))
for o in objs:
if o.isDerivedFrom("Part::Feature"):
shapes.extend(o.Shape.Solids)
cutface,cutvolume = ArchCommands.getCutVolume(obj.Source.Shape.copy(),shapes)
if o.Shape.isValid():
shapes.extend(o.Shape.Solids)
else:
FreeCAD.Console.PrintWarning("Skipping invalid object: "+o.Name)
cutface,cutvolume,invcutvolume = ArchCommands.getCutVolume(obj.Source.Shape.copy(),shapes)
if cutvolume:
nsh = []
for sh in shapes:
for sol in sh.Solids:
c = sol.cut(cutvolume)
nsh.append(c)
s = sol.section(cutface)
sshapes.append(s)
if obj.ShowCut:
c = sol.cut(invcutvolume)
hshapes.append(c)
shapes = nsh
base = Part.makeCompound(shapes)
if shapes:
self.baseshape = Part.makeCompound(shapes)
svgf = Drawing.projectToSVG(self.baseshape,direction)
#if shapes:
# base = shapes.pop().copy()
#for sh in shapes:
@ -247,12 +282,36 @@ class _ArchDrawingView:
# base = base.fuse(sh)
# except:
# print "unable to fuse, passing..."
svgf = Drawing.projectToSVG(base,direction)
if svgf:
svgf = svgf.replace('stroke-width="0.35"','stroke-width="' + str(linewidth) + 'px"')
svgf = svgf.replace('stroke-width="1"','stroke-width="' + str(linewidth) + 'px"')
svgf = svgf.replace('stroke-width:0.01','stroke-width:' + str(linewidth) + 'px')
svg += svgf
svg += svgf
if hshapes:
hshapes = Part.makeCompound(hshapes)
svgh = Drawing.projectToSVG(hshapes,direction)
if svgh:
svgh = svgh.replace('stroke-width="0.35"','stroke-width="' + str(linewidth) + 'px"')
svgh = svgh.replace('stroke-width="1"','stroke-width="' + str(linewidth) + 'px"')
svgh = svgh.replace('stroke-width:0.01','stroke-width:' + str(linewidth) + 'px')
svgh = svgh.replace('fill="none"','fill="none"\nstroke-dasharray="0.09,0.05"')
svg += svgh
if sshapes:
edges = []
for s in sshapes:
edges.extend(s.Edges)
wires = DraftGeomUtils.findWires(edges)
faces = []
for w in wires:
if (w.ShapeType == "Wire") and w.isClosed():
faces.append(Part.Face(w))
sshapes = Part.makeCompound(faces)
svgs = Drawing.projectToSVG(sshapes,direction)
if svgs:
svgs = svgs.replace('stroke-width="0.35"','stroke-width="' + str(linewidth*st) + 'px"')
svgs = svgs.replace('stroke-width="1"','stroke-width="' + str(linewidth*st) + 'px"')
svgs = svgs.replace('stroke-width:0.01','stroke-width:' + str(linewidth*st) + 'px')
svg += svgs
result = ''
result += '<g id="' + obj.Name + '"'

View File

@ -25,12 +25,13 @@
import FreeCAD,math,Part,ArchCommands,DraftVecUtils,DraftGeomUtils
DEBUG = True # if we want debug messages
MAXLOOP = 10 # the max number of loop before abort
# WARNING: in this module, faces are lists whose first item is the actual OCC face, the
# other items being additional information such as color, etc.
DEBUG = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetBool("ShowVRMDebug")
class Renderer:
"A renderer object"
def __init__(self,wp=None):
@ -73,6 +74,7 @@ class Renderer:
self.iscut = False
self.joined = False
self.sections = []
self.hiddenEdges = []
def setWorkingPlane(self,wp):
"sets a Draft WorkingPlane or Placement for this renderer"
@ -151,6 +153,8 @@ class Renderer:
self.faces = [self.projectFace(f) for f in self.faces]
if self.sections:
self.sections = [self.projectFace(f) for f in self.sections]
if self.hiddenEdges:
self.hiddenEdges = [self.projectEdge(e) for e in self.hiddenEdges]
self.oriented = True
#print "VRM: end reorient"
@ -200,6 +204,14 @@ class Renderer:
#print "VRM: projectFace end: ",len(sh.Vertexes)," verts"
return [sh]+face[1:]
def projectEdge(self,edge):
"projects a single edge on the WP"
if len(edge.Vertexes) > 1:
v1 = self.wp.getLocalCoords(edge.Vertexes[0].Point)
v2 = self.wp.getLocalCoords(edge.Vertexes[-1].Point)
return Part.Line(v1,v2).toShape()
return edge
def flattenFace(self,face):
"Returns a face where all vertices have Z = 0"
wires = []
@ -219,7 +231,7 @@ class Renderer:
else:
return [sh]+face[1:]
def cut(self,cutplane):
def cut(self,cutplane,hidden=False):
"Cuts through the shapes with a given cut plane and builds section faces"
if DEBUG: print "\n\n======> Starting cut\n\n"
if self.iscut:
@ -231,7 +243,7 @@ class Renderer:
shps = []
for sh in self.shapes:
shps.append(sh[0])
cutface,cutvolume = ArchCommands.getCutVolume(cutplane,shps)
cutface,cutvolume,invcutvolume = ArchCommands.getCutVolume(cutplane,shps)
if cutface and cutvolume:
shapes = []
faces = []
@ -246,6 +258,9 @@ class Renderer:
if DraftGeomUtils.isCoplanar([f,cutface]):
print "COPLANAR"
sections.append([f,fill])
if hidden:
c = sol.cut(invcutvolume)
self.hiddenEdges.extend(c.Edges)
self.shapes = shapes
self.faces = faces
self.sections = sections
@ -555,7 +570,8 @@ class Renderer:
v = e.Vertexes[-1].Point
svg += 'A '+ tostr(r) + ' '+ tostr(r) +' 0 0 1 '+ tostr(v.x) +' '
svg += tostr(v.y) + ' '
svg += 'Z '
if len(edges) > 1:
svg += 'Z '
return svg
def getViewSVG(self,linewidth=0.01):
@ -608,4 +624,25 @@ class Renderer:
svg += 'fill-rule: evenodd'
svg += '"/>\n'
return svg
def getHiddenSVG(self,linewidth=0.02):
"Returns a SVG fragment from cut geometry"
if DEBUG: print "Printing ", len(self.sections), " hidden faces"
if not self.oriented:
self.reorient()
svg = ''
for e in self.hiddenEdges:
svg +='<path '
svg += 'd="'
svg += self.getPathData(e)
svg += '" '
svg += 'stroke="#000000" '
svg += 'stroke-width="' + str(linewidth) + '" '
svg += 'style="stroke-width:' + str(linewidth) + ';'
svg += 'stroke-miterlimit:1;'
svg += 'stroke-linejoin:round;'
svg += 'stroke-dasharray:0.09,0.05;'
svg += 'fill:none;'
svg += '"/>\n'
return svg

View File

@ -2,8 +2,8 @@
# Resource object code
#
# Created: Sun Jul 22 16:38:54 2012
# by: The Resource Compiler for PyQt (Qt v4.8.1)
# Created: Sun Aug 5 16:52:51 2012
# by: The Resource Compiler for PyQt (Qt v4.8.2)
#
# WARNING! All changes made in this file will be lost!
@ -6042,85 +6042,100 @@ qt_resource_data = "\
\x00\x00\x00\x12\x00\x57\x00\x65\x00\x72\x00\x6b\x00\x7a\x00\x65\
\x00\x75\x00\x67\x00\x65\x08\x00\x00\x00\x00\x06\x00\x00\x00\x05\
\x54\x6f\x6f\x6c\x73\x07\x00\x00\x00\x04\x61\x72\x63\x68\x01\
\x00\x00\x04\xd0\
\x00\x00\x05\xb5\
\x00\
\x00\x1e\xaa\x78\x9c\xed\x59\x6d\x6f\xdb\x36\x10\xfe\x9e\x5f\x41\
\xe8\xd3\x06\x6c\x95\xed\xd8\x6e\x13\xc8\x2a\xd6\x74\x79\x01\x5a\
\x2c\x81\xd3\xe6\xe3\x20\x4b\x67\x8b\xab\x24\x7a\x24\x95\xd8\xfd\
\xf5\x3d\x92\x92\x65\xbd\x58\x89\x63\x27\x01\x82\x00\x31\x22\xf2\
\x4e\xc7\xe3\xc3\xe3\xa3\x3b\xd2\xf9\xb8\x88\x23\x72\x0b\x5c\x50\
\x96\x8c\xac\xee\xbb\x8e\x45\x20\xf1\x59\x40\x93\xd9\xc8\xfa\x76\
\x7d\xfa\xe7\x07\xeb\xa3\x7b\xe0\xa4\xb4\x50\xea\xa3\x92\x7b\x40\
\x1c\x3f\xf2\x84\x70\xcf\x52\x7a\x7c\xfc\x99\x7a\x11\x9b\xe1\xff\
\x68\x36\x06\x29\xf1\x65\xf1\x17\xf7\x43\xc7\x36\x3a\xa8\x7c\x47\
\x83\x19\x48\xa2\xdb\x23\xeb\xea\x46\x37\x2d\x92\x78\x31\x8c\xac\
\x36\x1b\x6a\x28\xe2\xcc\x39\x9b\x03\x97\xcb\xec\x85\x19\xb0\x18\
\x24\x5f\x6a\x21\x71\x38\xf8\x52\x3f\x11\x67\xe1\x76\x1c\x7b\x91\
\x35\x96\xaa\xb1\xcc\x1a\xe8\x81\x0c\xdd\xc1\xfb\x81\x63\x9b\x47\
\xd3\x1d\x02\x9d\x85\xd2\x1d\xf6\x8e\x1c\x3b\x7b\xd6\x36\xed\xdc\
\xa8\x63\xe7\x83\x37\x79\x72\x47\x93\x80\xdd\x5d\x53\x19\x41\xe6\
\x8c\x90\x1c\x7d\x77\xcf\x20\x01\xee\x45\x44\x64\x73\x71\xec\x4c\
\x50\x37\x19\x79\x4b\x96\x16\xd8\x7c\xff\xc4\x16\x5f\x74\x57\x66\
\xb1\x32\xa4\x98\x7b\x3e\x1a\xb2\xb2\x09\x24\x69\x3c\x01\xee\x0e\
\x1d\x3b\x7b\x32\xee\xaf\x8f\x50\x33\x11\x7b\x7c\x46\x93\x8a\x85\
\xa3\x56\x0b\x54\x42\x5c\x20\xb9\xbe\x96\x67\x9c\xa5\x73\xf4\x39\
\x5f\xcd\x59\xde\x36\xea\xb5\xc1\x65\x01\x56\x03\x5e\x6a\xcd\xc9\
\xb8\x01\xb4\xba\x4f\xad\xd0\x65\x83\x61\xd4\x4a\xea\x7b\x91\xe9\
\xfd\xb7\x57\x8c\x5b\x4c\xa8\xc1\xd0\x79\xcd\x50\xc8\x38\xfd\xc9\
\x12\xd9\x60\xaa\x6a\xac\x0e\xd1\x17\x6f\x02\x51\x6e\x29\x52\x8d\
\xd2\xeb\x0d\x18\xc1\x42\x96\x14\x56\x38\x7d\x86\xa9\x97\x46\x68\
\x9a\x45\x8c\x93\x29\xfe\xee\xbc\x28\xaa\x22\xd5\x0c\x97\xe9\x34\
\xbe\xad\x39\x6f\x97\xbd\xaf\x4d\x46\x05\x1c\xf0\x1a\x0e\x63\xdd\
\xdd\x3a\x0d\xd4\x05\x54\x95\xc8\x1b\x95\xd9\x00\x86\x9a\x7b\x25\
\x8f\x8f\xcf\x57\xf6\x1c\x5b\x77\xde\x37\x81\xfa\x7e\xa0\x3f\xe1\
\x9c\x26\xb8\x52\x42\x06\xb8\xdd\x46\x56\xa7\x0a\x1d\x6a\x94\x7a\
\x72\x36\xe8\x77\x4a\x64\xb0\x92\x66\x44\xd0\xeb\x94\x38\xa1\x70\
\xab\x6a\x70\x03\xd2\x06\xb8\x2d\x90\x2e\x87\x8d\xa6\xc5\x4b\x0e\
\xd3\x13\xb5\xd6\x9f\x52\x29\x11\xc6\x7c\x93\x29\xd9\x1c\x65\x3a\
\x0e\x26\x46\xd6\x1a\x51\x8c\x45\xd7\x74\xde\x1c\x54\xd7\x21\x15\
\x04\xff\x64\x08\x24\xa8\x05\x58\x02\x77\xe4\x06\x83\x8c\xb0\xc9\
\x7f\x48\x8a\x0f\x8f\xb5\x9a\x13\xda\x66\xc5\x05\xdd\x57\xc1\x9f\
\x43\xe0\xf6\x06\x03\x45\xc2\x41\x45\x34\xe3\x00\x89\xdb\x3d\xc2\
\xa5\x31\x8f\x65\xf1\x24\x4a\xc1\xed\xbe\x47\xa9\x7e\x2a\x2f\x5b\
\x6d\xa8\x87\x79\xad\x60\xfe\x3b\x51\x9f\x9b\x8d\x11\xe6\x67\x88\
\x28\x98\xf4\x6a\xe1\x60\x8f\x05\x49\x0d\x77\xe9\xc9\xf0\xfe\xd1\
\xbe\xb2\xc0\xce\xbe\xb3\xfb\xda\xfd\x8e\x6d\x98\x70\x45\x93\x25\
\xf1\xae\xa4\xb9\x13\x65\xee\x8d\x30\x51\x90\xfa\x32\xe5\xf0\x72\
\xac\x79\x0f\xfd\xbf\xf1\xe6\x73\xf2\xe6\x7d\xdf\xe2\xdd\x98\x73\
\x9c\x47\xdb\xf3\xd2\x67\x77\xd0\x69\xa1\xcf\xe1\x51\x1b\x7d\x7e\
\x18\xbe\x10\x7d\xae\xb0\x7a\xe3\xd0\xcd\x89\xe7\x70\xb7\xc4\x73\
\xb0\xbf\xc4\x53\xd7\x3e\x2f\x48\xa2\xfd\x37\x12\xdd\x8c\xf5\x73\
\x93\xe8\x61\xeb\x62\x6c\x43\x5d\x83\xa3\x16\xe6\x3a\xec\xb5\x31\
\x57\xff\xa5\x98\xeb\x46\xef\x85\xd7\x4b\x5b\x65\x61\xc9\xd6\x9a\
\xde\x23\x4e\x09\x8a\x8f\xef\xc3\xce\x09\x2e\x4e\x4f\x08\x8d\xe7\
\x8c\xcb\x7d\x1f\x0e\xec\xef\x68\x60\xf0\x70\x86\x2e\xb6\x59\x08\
\xfe\x8f\x75\x7c\x56\x7b\x4c\x09\x26\xc5\x71\x4a\x33\x56\x6d\x39\
\xca\xc5\x14\xd3\x13\x93\xa6\x68\x63\x10\xfc\xa1\xf3\x15\x84\xf2\
\x9f\x39\x24\xe3\x10\xb0\xb6\x33\x98\x82\x62\x75\x6c\x4d\x80\xa4\
\x42\xe9\x61\x3d\xc3\x90\xe7\x67\x44\xb2\x4c\x85\xc4\x8c\xeb\x77\
\x89\x5c\xce\xb7\x48\xa1\xb7\xf8\xd4\x7c\x13\x55\xe7\xa6\xc4\xbb\
\xf5\x28\x7e\xc0\x22\x78\xfc\x80\x5b\x6c\x67\x9c\xfc\xc5\xd4\x5f\
\x39\xf0\x2a\xb7\xf4\xee\x71\x7e\xf8\x14\x71\xbe\x4b\x36\x7e\xc2\
\xc1\x93\x20\x88\x26\x17\xa1\x93\x14\xf0\xfc\xd0\x1c\x2a\x9a\xf4\
\x5b\x47\xed\x53\x04\xad\x26\x38\xcc\x8e\x70\x93\x24\x98\x77\x08\
\x32\x59\xee\xba\x43\xb6\x08\x58\x5f\xcf\x1c\x63\x56\xbb\x21\xde\
\x02\xb6\x31\x60\xfb\x4f\x12\xb0\xed\x99\xcf\xe6\x88\xb9\x30\x7c\
\x3a\x4d\x79\x42\x75\x81\xf8\x9b\xef\x25\x24\xf6\x7e\x80\xa6\xe7\
\x98\x05\x10\x91\x10\xbc\xdb\xe5\xef\xcf\x12\x43\x86\xdf\x31\x86\
\x4e\x73\x8f\x5e\x65\x18\x6d\x9f\xca\x94\xaa\x90\x3c\x69\x28\x1f\
\x7f\x3f\xa4\xf8\x28\xea\x8e\xef\x99\x8d\x52\xd5\x51\x4f\x60\xb6\
\xa8\x35\xca\x65\x46\x56\x61\xf4\x6a\x15\x46\x5e\x5c\xf4\x6b\xc5\
\x45\xa9\xae\xa8\xba\x52\xaa\x26\x0a\x90\xd6\x90\x5c\x83\x31\xdb\
\x97\xf9\x69\x48\x76\x5d\x35\xb2\x86\x16\x31\xf7\x4e\x23\xab\xdb\
\xb5\x6c\xa5\x39\xa7\x8b\xd8\x9b\x4f\xd3\xc4\x57\x40\xb9\xff\x5f\
\xea\xf6\x29\x67\xf1\x57\x1a\xc3\x98\xa5\xdc\xc7\x18\xac\x68\xa9\
\xab\xc7\x54\x48\x16\x9b\x11\x85\xf6\x64\xbd\xc7\x78\xb9\x76\x3d\
\xb9\x56\xc2\x14\x57\x92\x6a\x3d\x16\x12\x92\x40\xb8\x57\x97\xa9\
\x08\x73\x79\xde\x79\x60\xe0\xf2\x02\x9c\x36\x5a\xb1\xcd\x95\xa5\
\x78\x17\x2a\xe4\x74\xaf\x46\xa0\x3a\x70\xbb\x27\x95\x82\xaa\xd1\
\x9b\xba\xcb\x9b\x5c\x52\xd6\xf6\xe7\x56\xc6\x73\xcd\x08\x15\xd2\
\xdd\x9d\x29\x77\xe8\xeb\x61\x0e\x42\x2f\xb6\xd0\x61\xe1\xb3\x24\
\x01\xbd\xd8\xaa\xed\xd8\x29\x75\x0f\x7e\x01\x09\x6b\xe1\xfc\
\x00\x27\xfd\x78\x9c\xed\x5a\x6d\x4f\xe3\x38\x10\xfe\xce\xaf\xb0\
\xf2\xe9\x4e\xba\x23\xa5\x50\x58\x50\x9a\xd5\x2d\x1c\x0b\xd2\xae\
\x8e\xbd\xb2\xbb\x1f\x4f\x69\x32\x6d\x7c\x9b\xd8\x39\xc7\xa1\xed\
\xfe\xfa\x1b\xdb\x49\xd3\xbc\x34\x50\x5a\x40\x42\x20\x10\xb1\xc7\
\x9d\x19\x3f\x9e\x79\x3c\x76\xe3\xbc\x9f\xc7\x11\xb9\x03\x91\x52\
\xce\x86\xd6\xc1\x7e\xcf\x22\xc0\x7c\x1e\x50\x36\x1d\x5a\x5f\x6f\
\x2f\x7f\x7f\x67\xbd\x77\xf7\x9c\x8c\x96\x83\x8e\x70\x90\xbb\x47\
\x1c\x3f\xf2\xd2\xd4\xfd\x98\xd1\xb3\xb3\x0b\xea\x45\x7c\x8a\xff\
\xa3\xe9\x08\xa4\xc4\x0f\xa7\x7f\x08\x3f\x74\x6c\x33\x06\x07\xcf\
\x68\x30\x05\x49\x74\x7b\x68\x7d\xf9\xae\x9b\x16\x61\x5e\x0c\x43\
\xab\x4b\x87\x32\x45\x9c\x44\xf0\x04\x84\x5c\xe4\x1f\x98\x02\x8f\
\x41\x8a\x85\x16\x12\x47\x80\x2f\xf5\x13\x71\xe6\x6e\xcf\xb1\xe7\
\x79\x63\xa1\x1a\x8b\xbc\x81\x1e\xc8\xd0\x1d\x9c\x0c\x1c\xdb\x3c\
\x9a\xee\x10\xe8\x34\x94\xee\x71\xff\xd4\xb1\xf3\x67\xad\xd3\x2e\
\x94\x3a\x76\x61\xbc\xcd\x93\x19\x65\x01\x9f\xdd\x52\x19\x41\xee\
\x4c\x2a\x05\xfa\xee\x7e\x04\x06\xc2\x8b\x48\x9a\xcf\xc5\xb1\x73\
\x41\x53\x65\xe4\x2d\x78\x56\x62\xf3\xed\x03\x9f\x7f\xd2\x5d\xb9\
\xc6\x9a\xc9\x34\xf1\x7c\x54\x64\xe5\x13\x60\x59\x3c\x06\xe1\x1e\
\x3b\x76\xfe\x64\xdc\x5f\xb5\xd0\x50\x11\x7b\x62\x4a\x59\x4d\xc3\
\x69\xa7\x06\x2a\x21\x2e\x91\x5c\x5d\xcb\x8f\x82\x67\x09\xfa\x5c\
\xac\xe6\xb4\x68\x9b\xe1\x0d\xe3\xb2\x04\xab\x05\x2f\xb5\xe6\x64\
\xd4\x02\x5a\xd3\xa7\x4e\xe8\x72\x63\x18\xb5\x92\xfa\x5e\x64\x7a\
\xff\xe9\x97\x76\xcb\x09\xb5\x28\xba\x6a\x28\x0a\xb9\xa0\x3f\x39\
\x93\x2d\xaa\xea\xca\x9a\x10\x7d\xf2\xc6\x10\x15\x9a\x22\xd5\xa8\
\x7c\xbc\x05\x23\x98\xcb\xca\x80\x25\x4e\x17\x30\xf1\xb2\x08\x55\
\xf3\x88\x0b\x32\xc1\xbf\x99\x17\x45\x75\xa4\xda\xe1\x32\x9d\xc6\
\xb7\x15\xe7\xed\xaa\xf7\x8d\xc9\xa8\x80\x03\xd1\xc0\x61\xa4\xbb\
\x3b\xa7\x81\x63\x01\x87\x4a\xe4\x8d\xda\x6c\x00\x43\xcd\xfd\x22\
\xcf\xce\xae\x96\xfa\x1c\x5b\x77\xde\x37\x81\x66\x3e\xd0\x9f\x70\
\x45\x19\xae\x54\x2a\x03\x4c\xb7\xa1\xd5\xab\x43\x87\x23\x2a\x3d\
\x05\x1b\x1c\xf5\x2a\x64\xb0\x94\xe6\x44\xd0\xef\x55\x38\xa1\x74\
\xab\xae\x70\x0d\xd2\x06\xb8\x0d\x90\xae\x86\x8d\xa6\xc5\x1b\x01\
\x93\x73\xb5\xd6\x1f\x32\x29\x11\xc6\x22\xc9\x94\x2c\x41\x99\x8e\
\x83\xb1\x91\x75\x46\x14\xe7\xd1\x2d\x4d\xda\x83\xea\x36\xa4\x29\
\xc1\x5f\x19\x02\x09\x1a\x01\xc6\x60\x46\xbe\x63\x90\x11\x3e\xfe\
\x17\x49\xf1\xe1\xb1\xd6\x70\x42\xeb\xac\xb9\xa0\xfb\x6a\xf8\x0b\
\x08\xdc\xfe\x60\xa0\x48\x38\xa8\x89\xa6\x02\x80\xb9\x07\xa7\xb8\
\x34\xe6\xb1\x2a\x1e\x47\x19\xb8\x07\x27\x28\xd5\x4f\xd5\x65\x6b\
\x98\x7a\x98\xd7\x0a\xe6\x3f\x99\xda\x6e\xd6\x46\x98\x9f\x23\xa2\
\x60\xd2\xab\x85\xc6\x1e\x0b\x92\x32\x77\xe3\xc9\xf0\x7e\x6b\x9f\
\x79\x60\xe7\xfb\xec\xae\xb2\xdf\xb1\x0d\x13\x2e\x69\xb2\x22\xde\
\x96\x34\xb7\xa2\xcc\x9d\x11\x26\x0a\x32\x5f\x66\x02\x5e\x8e\x35\
\xef\xa1\xff\x37\xde\x7c\x4e\xde\xbc\x6f\x2f\xde\x8e\x39\x47\x45\
\xb4\x3d\x2f\x7d\x1e\x0c\x7a\x1d\xf4\x79\x7c\xda\x45\x9f\xef\x8e\
\x5f\x88\x3e\x97\x58\xbd\x71\xe8\xfa\xc2\xf3\x78\xbb\xc2\x73\xb0\
\xbb\xc2\x53\x9f\x7d\x5e\x90\x44\x8f\xde\x48\x74\x3d\xd6\xcf\x4d\
\xa2\x87\x9d\x8b\xb1\x09\x75\x0d\x4e\x3b\x98\xeb\xb0\xdf\xc5\x5c\
\x47\x2f\xc5\x5c\xdf\x75\x2e\xbc\x5e\xda\xaa\x0a\x2b\xba\x56\xc6\
\x3d\xe2\x96\xa0\xdc\x7c\x1f\x76\x4f\x70\x7d\x79\x4e\x68\x9c\x70\
\x21\x77\x7d\x39\xb0\xbb\xab\x81\xc1\xc3\x19\xba\x4c\xb3\x10\xfc\
\x1f\xab\xf8\x2c\x73\x4c\x09\xc6\xe5\x75\x4a\x3b\x56\x5d\x35\xca\
\xf5\x04\xcb\x13\x53\xa6\x68\x65\x10\xfc\xa6\xeb\x15\x84\xf2\xaf\
\x04\xd8\x28\x04\x3c\xdb\x19\x4c\x41\xb1\x3a\xb6\xc6\x40\xb2\x54\
\x8d\xc3\xf3\x0c\x47\x9e\x9f\x12\xc9\xf3\x21\x24\xe6\x42\x7f\x96\
\xc8\x45\xb2\x41\x09\xbd\xc1\x56\xf3\x35\xad\x3b\x37\x21\xde\x9d\
\x47\x71\x03\x8b\xe0\xf1\x06\x37\x48\x67\x9c\xfc\xf5\xc4\x5f\x3a\
\xf0\x2a\x53\x7a\xfb\x38\x3f\x7c\x8a\x38\xdf\xa6\x1a\x3f\x17\xe0\
\x49\x48\x89\x26\x97\x54\x17\x29\xe0\xf9\xa1\xb9\x54\x34\xe5\xb7\
\x8e\xda\xa7\x08\x5a\x4d\x70\x58\x1d\x61\x92\x30\xac\x3b\x52\x32\
\x5e\x6c\x9b\x21\x1b\x04\xac\xaf\x67\x8e\x31\xab\xdd\x48\xdf\x02\
\xb6\x35\x60\x8f\x9e\x24\x60\xbb\x2b\x9f\xf5\x11\x73\x6d\xf8\x74\
\x92\x09\x46\xf5\x01\xf1\x17\xdf\x63\x24\xf6\x7e\x80\xa6\xe7\x98\
\x07\x10\x91\x10\xbc\xbb\xc5\xaf\xcf\x12\x43\x86\xdf\x31\x86\x2e\
\x0b\x8f\x5e\x65\x18\x3d\x5d\x29\x73\xb8\x59\x29\xd3\xbf\x20\x02\
\x58\x00\xaa\xb1\xf3\x6f\x3a\x0e\x77\x57\xce\x9c\x3c\x49\xd6\x74\
\x1f\xde\x3a\x69\x7e\x14\xf2\x19\x09\x60\x9c\x4d\x09\x65\x48\xf2\
\xb1\x3e\xe4\x91\x20\x53\x52\xd2\x01\xeb\x06\xf1\xbb\x3e\x6d\xb5\
\x75\x63\x01\xcb\x25\xe3\x46\x0c\x69\xea\x4d\x9f\x89\xeb\x95\x03\
\xdf\xfe\xfe\x7c\xa1\x2c\xbf\xca\x0c\xdd\x3e\x64\xdf\x6d\x77\x47\
\xf2\x58\x46\x3f\x47\x2f\x3d\xdc\x89\x53\x12\x51\xa6\x58\x9c\xfa\
\x3f\x18\x86\x06\x11\x2a\x42\x5f\xee\xa2\xa4\x7b\x3e\x6f\x17\x25\
\x3b\xb9\x28\xb9\xe0\x19\x1e\x4f\x46\x09\x65\x6d\xbc\x17\x68\x69\
\x8a\xd2\xad\xce\x72\xa3\x04\x7c\x3a\xa1\x58\xe3\x2a\x16\x8a\x3d\
\x86\x45\x26\x45\xf6\xd1\x15\xc3\x1d\x85\x19\x04\xf5\xd8\x8b\xb3\
\x54\xaa\x03\x9d\x97\x24\x11\x45\x31\x9e\xe4\x7c\x8c\x53\x35\x6a\
\x0b\xbe\xba\xf3\xa2\x0c\x6a\x3e\x9a\x39\xba\xfd\xfd\x5e\xf5\xc7\
\xb1\x73\xc9\x53\xb2\x22\xe6\xde\x27\x9c\xd2\x6d\x31\xef\x57\xc9\
\x8c\x9b\xd7\x2e\x15\x62\x28\x6a\x84\xea\x57\xf7\x0f\xe1\x83\x92\
\x0a\xbe\xe5\x3a\x2a\x44\xd0\xac\x57\x36\x48\xff\x6a\xe6\xe7\x49\
\xdf\x6f\x24\x7d\x91\xef\x47\x8d\x7c\xaf\xa4\x7a\xdd\x95\x4a\x82\
\x97\x20\xad\x20\xb9\x02\x63\xbe\xd5\x14\xdf\xe4\xe4\xaf\xda\x0c\
\xad\x63\x8b\x98\x77\x66\x86\xd6\xc1\x81\x65\xab\x91\x09\x9d\xc7\
\x5e\x32\xc9\x98\xaf\x80\x72\xff\xbb\xd1\xed\x4b\xc1\xe3\xcf\x98\
\x90\x23\x9e\x09\x1f\xeb\xe7\xda\x28\xf5\xda\x14\xa6\x23\x8f\x8d\
\xc5\x54\x7b\xb2\xda\x63\xbc\x5c\x79\xb5\x6a\xe5\xfa\xb5\x7c\x9d\
\x4a\xad\xc7\x5c\x62\x09\x92\xba\x5f\x6e\xb2\x34\x2c\xe4\x45\xe7\
\x9e\x81\xcb\xc3\x12\x45\x69\xb1\xcd\xeb\x56\xe9\x7e\xa8\x90\xd3\
\xbd\x1a\x81\xba\xe1\x6e\x4f\x6a\x97\xc1\xad\xde\x34\x5d\x5e\xe7\
\x92\xd2\xb6\x3b\xb7\xf2\x6a\xb3\x1d\xa1\x52\xfa\x2c\xce\x54\xf6\
\x81\x76\x8f\x6a\x43\xb6\x77\xab\xda\xa1\xdf\xb8\x13\x90\xea\x18\
\x4c\x75\xb4\xfa\x9c\x31\xd0\x31\xa8\xda\x8e\x9d\x51\x77\xef\x7f\
\xd6\x19\x97\xf4\
\x00\x00\x07\x4c\
\x00\
\x00\x29\xd1\x78\x9c\xed\x59\x5b\x8f\xe2\x46\x16\x7e\xef\x5f\xe1\
@ -11371,35 +11386,35 @@ qt_resource_struct = "\
\x00\x00\x01\x8a\x00\x00\x00\x00\x00\x01\x00\x01\x1d\x6e\
\x00\x00\x00\xba\x00\x00\x00\x00\x00\x01\x00\x00\x6c\x7e\
\x00\x00\x00\x38\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x05\x6e\x00\x01\x00\x00\x00\x01\x00\x02\x52\xde\
\x00\x00\x04\x7a\x00\x00\x00\x00\x00\x01\x00\x02\x15\x0f\
\x00\x00\x03\x16\x00\x00\x00\x00\x00\x01\x00\x01\xb7\x13\
\x00\x00\x06\x9e\x00\x01\x00\x00\x00\x01\x00\x02\xa9\x48\
\x00\x00\x05\x40\x00\x01\x00\x00\x00\x01\x00\x02\x4c\x0c\
\x00\x00\x03\x50\x00\x01\x00\x00\x00\x01\x00\x01\xc5\x82\
\x00\x00\x03\xa2\x00\x01\x00\x00\x00\x01\x00\x01\xd9\x09\
\x00\x00\x02\xba\x00\x01\x00\x00\x00\x01\x00\x01\x9c\x71\
\x00\x00\x06\x38\x00\x00\x00\x00\x00\x01\x00\x02\x86\x04\
\x00\x00\x04\xba\x00\x00\x00\x00\x00\x01\x00\x02\x2e\xe9\
\x00\x00\x04\x5a\x00\x01\x00\x00\x00\x01\x00\x02\x0d\x47\
\x00\x00\x02\x98\x00\x01\x00\x00\x00\x01\x00\x01\x93\x78\
\x00\x00\x06\x0e\x00\x01\x00\x00\x00\x01\x00\x02\x7e\x6f\
\x00\x00\x03\x7e\x00\x01\x00\x00\x00\x01\x00\x01\xce\xda\
\x00\x00\x02\x4e\x00\x01\x00\x00\x00\x01\x00\x01\x82\xd0\
\x00\x00\x02\x78\x00\x01\x00\x00\x00\x01\x00\x01\x8c\x78\
\x00\x00\x04\xea\x00\x01\x00\x00\x00\x01\x00\x02\x3e\x57\
\x00\x00\x04\x0e\x00\x00\x00\x00\x00\x01\x00\x01\xf5\x04\
\x00\x00\x05\x18\x00\x01\x00\x00\x00\x01\x00\x02\x43\xa7\
\x00\x00\x04\x38\x00\x01\x00\x00\x00\x01\x00\x02\x05\x85\
\x00\x00\x05\x98\x00\x00\x00\x00\x00\x01\x00\x02\x59\xb8\
\x00\x00\x03\xc6\x00\x01\x00\x00\x00\x01\x00\x01\xde\x20\
\x00\x00\x05\xe2\x00\x01\x00\x00\x00\x01\x00\x02\x75\xf5\
\x00\x00\x05\xc2\x00\x01\x00\x00\x00\x01\x00\x02\x6b\xbb\
\x00\x00\x04\x9a\x00\x01\x00\x00\x00\x01\x00\x02\x28\xd1\
\x00\x00\x06\x64\x00\x00\x00\x00\x00\x01\x00\x02\x97\xd3\
\x00\x00\x02\xec\x00\x00\x00\x00\x00\x01\x00\x01\xa4\xb3\
\x00\x00\x03\xf0\x00\x00\x00\x00\x00\x01\x00\x01\xe6\x08\
\x00\x00\x02\x1a\x00\x01\x00\x00\x00\x01\x00\x01\x7b\x80\
\x00\x00\x05\x6e\x00\x01\x00\x00\x00\x01\x00\x02\x53\xc3\
\x00\x00\x04\x7a\x00\x00\x00\x00\x00\x01\x00\x02\x15\xf4\
\x00\x00\x03\x16\x00\x00\x00\x00\x00\x01\x00\x01\xb7\xf8\
\x00\x00\x06\x9e\x00\x01\x00\x00\x00\x01\x00\x02\xaa\x2d\
\x00\x00\x05\x40\x00\x01\x00\x00\x00\x01\x00\x02\x4c\xf1\
\x00\x00\x03\x50\x00\x01\x00\x00\x00\x01\x00\x01\xc6\x67\
\x00\x00\x03\xa2\x00\x01\x00\x00\x00\x01\x00\x01\xd9\xee\
\x00\x00\x02\xba\x00\x01\x00\x00\x00\x01\x00\x01\x9d\x56\
\x00\x00\x06\x38\x00\x00\x00\x00\x00\x01\x00\x02\x86\xe9\
\x00\x00\x04\xba\x00\x00\x00\x00\x00\x01\x00\x02\x2f\xce\
\x00\x00\x04\x5a\x00\x01\x00\x00\x00\x01\x00\x02\x0e\x2c\
\x00\x00\x02\x98\x00\x01\x00\x00\x00\x01\x00\x01\x94\x5d\
\x00\x00\x06\x0e\x00\x01\x00\x00\x00\x01\x00\x02\x7f\x54\
\x00\x00\x03\x7e\x00\x01\x00\x00\x00\x01\x00\x01\xcf\xbf\
\x00\x00\x02\x4e\x00\x01\x00\x00\x00\x01\x00\x01\x83\xb5\
\x00\x00\x02\x78\x00\x01\x00\x00\x00\x01\x00\x01\x8d\x5d\
\x00\x00\x04\xea\x00\x01\x00\x00\x00\x01\x00\x02\x3f\x3c\
\x00\x00\x04\x0e\x00\x00\x00\x00\x00\x01\x00\x01\xf5\xe9\
\x00\x00\x05\x18\x00\x01\x00\x00\x00\x01\x00\x02\x44\x8c\
\x00\x00\x04\x38\x00\x01\x00\x00\x00\x01\x00\x02\x06\x6a\
\x00\x00\x05\x98\x00\x00\x00\x00\x00\x01\x00\x02\x5a\x9d\
\x00\x00\x03\xc6\x00\x01\x00\x00\x00\x01\x00\x01\xdf\x05\
\x00\x00\x05\xe2\x00\x01\x00\x00\x00\x01\x00\x02\x76\xda\
\x00\x00\x05\xc2\x00\x01\x00\x00\x00\x01\x00\x02\x6c\xa0\
\x00\x00\x04\x9a\x00\x01\x00\x00\x00\x01\x00\x02\x29\xb6\
\x00\x00\x06\x64\x00\x00\x00\x00\x00\x01\x00\x02\x98\xb8\
\x00\x00\x02\xec\x00\x00\x00\x00\x00\x01\x00\x01\xa5\x98\
\x00\x00\x03\xf0\x00\x00\x00\x00\x00\x01\x00\x01\xe6\xed\
\x00\x00\x02\x1a\x00\x01\x00\x00\x00\x01\x00\x01\x7c\x65\
\x00\x00\x01\xf2\x00\x01\x00\x00\x00\x01\x00\x01\x76\xac\
"

View File

@ -224,6 +224,75 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>2D rendering</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_4">
<property name="toolTip">
<string>Show debug information during 2D rendering</string>
</property>
<property name="text">
<string>Show renderer debug messages</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowVRMDebug</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Cut areas line thickness ratio</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Gui::PrefDoubleSpinBox" name="gui::prefdoublespinbox">
<property name="toolTip">
<string>Specifies how many times the viewed line thickness must be applied to cut lines</string>
</property>
<property name="value">
<double>2.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>CutLineThickness</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -257,6 +326,11 @@
<extends>QCheckBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View File

@ -539,57 +539,62 @@ def sortEdges(lEdges, aVertex=None):
def findWires(edgeslist):
'''finds connected wires in the given list of edges'''
'''finds connected wires in the given list of edges'''
def touches(e1,e2):
if len(e1.Vertexes) < 2:
return False
if len(e2.Vertexes) < 2:
return False
if DraftVecUtils.equals(e1.Vertexes[0].Point,e2.Vertexes[0].Point):
return True
if DraftVecUtils.equals(e1.Vertexes[0].Point,e2.Vertexes[-1].Point):
return True
if DraftVecUtils.equals(e1.Vertexes[-1].Point,e2.Vertexes[0].Point):
return True
if DraftVecUtils.equals(e1.Vertexes[-1].Point,e2.Vertexes[-1].Point):
return True
return False
edges = edgeslist[:]
wires = []
lost = []
while edges:
e = edges[0]
if not wires:
# create first group
edges.remove(e)
wires.append([e])
def touches(e1,e2):
if len(e1.Vertexes) < 2:
return False
if len(e2.Vertexes) < 2:
return False
if DraftVecUtils.equals(e1.Vertexes[0].Point,e2.Vertexes[0].Point):
return True
if DraftVecUtils.equals(e1.Vertexes[0].Point,e2.Vertexes[-1].Point):
return True
if DraftVecUtils.equals(e1.Vertexes[-1].Point,e2.Vertexes[0].Point):
return True
if DraftVecUtils.equals(e1.Vertexes[-1].Point,e2.Vertexes[-1].Point):
return True
return False
edges = edgeslist[:]
wires = []
lost = []
while edges:
e = edges[0]
if not wires:
# create first group
edges.remove(e)
wires.append([e])
else:
found = False
for w in wires:
if not found:
for we in w:
if touches(e,we):
edges.remove(e)
w.append(e)
found = True
break
if not found:
if e in lost:
# we already tried this edge, and still nothing
edges.remove(e)
wires.append([e])
lost = []
else:
found = False
for w in wires:
if not found:
for we in w:
if touches(e,we):
edges.remove(e)
w.append(e)
found = True
break
if not found:
if e in lost:
# we already tried this edge, and still nothing
edges.remove(e)
wires.append([e])
lost = []
else:
# put to the end of the list
edges.remove(e)
edges.append(e)
lost.append(e)
nwires = []
for w in wires:
nwires.append(Part.Wire(w))
return nwires
# put to the end of the list
edges.remove(e)
edges.append(e)
lost.append(e)
nwires = []
for w in wires:
try:
wi = Part.Wire(w)
except:
print "couldn't join some edges"
else:
nwires.append(wi)
return nwires
def superWire(edgeslist,closed=False):
'''superWire(edges,[closed]): forces a wire between edges that don't necessarily