Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/FreeCAD/FreeCAD
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 4, 2015
2 parents 16f8132 + fa550f0 commit 1fa67d0
Show file tree
Hide file tree
Showing 19 changed files with 63 additions and 94 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Arch/ArchCommands.py
Expand Up @@ -321,7 +321,7 @@ def closeHole(shape):
for e in shape.Edges:
if lut[e.hashCode()] == 1:
bound.append(e)
bound = DraftGeomUtils.sortEdges(bound)
bound = Part.__sortEdges__(bound)
try:
nface = Part.Face(Part.Wire(bound))
shell = Part.makeShell(shape.Faces+[nface])
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Arch/ArchComponent.py
Expand Up @@ -423,7 +423,7 @@ def getProfiles(self,obj,noplacement=False):
dvec2 = DraftVecUtils.scaleTo(dvec,obj.Offset.Value)
wire = DraftGeomUtils.offsetWire(wire,dvec2)
w2 = DraftGeomUtils.offsetWire(wire,dvec)
w1 = Part.Wire(DraftGeomUtils.sortEdges(wire.Edges))
w1 = Part.Wire(Part.__sortEdges__(wire.Edges))
sh = DraftGeomUtils.bind(w1,w2)
elif obj.Align == "Right":
dvec.multiply(w)
Expand All @@ -433,7 +433,7 @@ def getProfiles(self,obj,noplacement=False):
dvec2 = DraftVecUtils.scaleTo(dvec,obj.Offset.Value)
wire = DraftGeomUtils.offsetWire(wire,dvec2)
w2 = DraftGeomUtils.offsetWire(wire,dvec)
w1 = Part.Wire(DraftGeomUtils.sortEdges(wire.Edges))
w1 = Part.Wire(Part.__sortEdges__(wire.Edges))
sh = DraftGeomUtils.bind(w1,w2)
elif obj.Align == "Center":
dvec.multiply(w/2)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Arch/ArchFrame.py
Expand Up @@ -139,7 +139,7 @@ def execute(self,obj):
profile = baseprofile.copy()
#basepoint = profile.Placement.Base
if hasattr(obj,"BasePoint"):
edges = DraftGeomUtils.sortEdges(profile.Edges)
edges = Part.__sortEdges__(profile.Edges)
basepointliste = [profile.CenterOfMass]
for edge in edges:
basepointliste.append(DraftGeomUtils.findMidpoint(edge))
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Arch/ArchRoof.py
Expand Up @@ -63,7 +63,7 @@ def makeRoof(baseobj=None,facenr=0, angles=[45.,], run = [], idrel = [0,],thickn
w = obj.Base.Shape.Wires[0]
if w:
if w.isClosed():
edges = DraftGeomUtils.sortEdges(w.Edges)
edges = Part.__sortEdges__(w.Edges)
l = len(edges)

la = len(angles)
Expand Down Expand Up @@ -545,7 +545,7 @@ def execute(self,obj):
self.shps = []
self.subVolshps = []
heights = []
edges = DraftGeomUtils.sortEdges(w.Edges)
edges = Part.__sortEdges__(w.Edges)
l = len(edges)
print("le contour contient "+str(l)+" aretes")
for i in range(l):
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Arch/ArchSectionPlane.py
Expand Up @@ -149,9 +149,9 @@ def __init__(self,vobj):
vobj.addProperty("App::PropertyFloat","LineWidth","Base","")
vobj.addProperty("App::PropertyColor","LineColor","Base","")
vobj.addProperty("App::PropertyBool","CutView","Arch",translate("Arch","Show the cut in the 3D view"))
vobj.DisplayLength = 1
vobj.DisplayHeight = 1
vobj.ArrowSize = 1
vobj.DisplayLength = 1000
vobj.DisplayHeight = 1000
vobj.ArrowSize = 50
vobj.Transparency = 85
vobj.LineWidth = 1
vobj.LineColor = (0.0,0.0,0.4,1.0)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Arch/ArchSpace.py
Expand Up @@ -341,7 +341,7 @@ def getArea(self,obj):
sh = obj.Shape.copy()
cutplane,v1,v2 = ArchCommands.getCutVolume(pl,sh)
e = sh.section(cutplane)
e = DraftGeomUtils.sortEdges(e.Edges)
e = Part.__sortEdges__(e.Edges)
w = Part.Wire(e)
f = Part.Face(w)
return f.Area
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Arch/ArchVRM.py
Expand Up @@ -180,7 +180,7 @@ def projectFace(self,face):
norm = face[0].normalAt(0,0)
for w in face[0].Wires:
verts = []
edges = DraftGeomUtils.sortEdges(w.Edges)
edges = Part.__sortEdges__(w.Edges)
#print len(edges)," edges after sorting"
for e in edges:
v = e.Vertexes[0].Point
Expand Down Expand Up @@ -217,7 +217,7 @@ def flattenFace(self,face):
wires = []
for w in face[0].Wires:
verts = []
edges = DraftGeomUtils.sortEdges(w.Edges)
edges = Part.__sortEdges__(w.Edges)
for e in edges:
v = e.Vertexes[0].Point
verts.append(FreeCAD.Vector(v.x,v.y,0))
Expand Down Expand Up @@ -568,7 +568,7 @@ def getPathData(self,w):
"Returns a SVG path data string from a 2D wire"
def tostr(val):
return str(round(val,DraftVecUtils.precision()))
edges = DraftGeomUtils.sortEdges(w.Edges)
edges = Part.__sortEdges__(w.Edges)
v = edges[0].Vertexes[0].Point
svg = 'M '+ tostr(v.x) +' '+ tostr(v.y) + ' '
for e in edges:
Expand Down
10 changes: 0 additions & 10 deletions src/Mod/Arch/ArchWall.py
Expand Up @@ -499,16 +499,6 @@ def getIcon(self):
return ":/icons/Arch_Wall_Tree_Assembly.svg"
return ":/icons/Arch_Wall_Tree.svg"

def getDisplayModes(self,vobj):
return ArchComponent.ViewProviderComponent.getDisplayModes(self,vobj)+["Flat 2D"]

def setDisplayMode(self,mode):
self.Object.Proxy.execute(self.Object)
if mode == "Flat 2D":
return "Flat Lines"
else:
return ArchComponent.ViewProviderComponent.setDisplayMode(self,mode)

def attach(self,vobj):
self.Object = vobj.Object
return
Expand Down
8 changes: 4 additions & 4 deletions src/Mod/Arch/importIFC.py
Expand Up @@ -1081,15 +1081,15 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess

# extruded polyline
if not curves:
w = Part.Wire(DraftGeomUtils.sortEdges(p.Edges))
w = Part.Wire(Part.__sortEdges__(p.Edges))
pts = [ifcfile.createIfcCartesianPoint(tuple(v.Point)[:2]) for v in w.Vertexes+[w.Vertexes[0]]]
pol = ifcfile.createIfcPolyline(pts)

# extruded composite curve
else:
segments = []
last = None
edges = DraftGeomUtils.sortEdges(p.Edges)
edges = Part.__sortEdges__(p.Edges)
for e in edges:
if isinstance(e.Curve,Part.Circle):
follow = True
Expand Down Expand Up @@ -1195,7 +1195,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess
shapetype = "brep"
for fcface in fcsolid.Faces:
loops = []
verts = [v.Point for v in Part.Wire(DraftGeomUtils.sortEdges(fcface.OuterWire.Edges)).Vertexes]
verts = [v.Point for v in Part.Wire(Part.__sortEdges__(fcface.OuterWire.Edges)).Vertexes]
c = fcface.CenterOfMass
v1 = verts[0].sub(c)
v2 = verts[1].sub(c)
Expand All @@ -1208,7 +1208,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess
loops.append(bound)
for wire in fcface.Wires:
if wire.hashCode() != fcface.OuterWire.hashCode():
verts = [v.Point for v in Part.Wire(DraftGeomUtils.sortEdges(wire.Edges)).Vertexes]
verts = [v.Point for v in Part.Wire(Part.__sortEdges__(wire.Edges)).Vertexes]
v1 = verts[0].sub(c)
v2 = verts[1].sub(c)
if DraftVecUtils.angle(v2,v1,DraftVecUtils.neg(n)) >= 0:
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Arch/importIFClegacy.py
Expand Up @@ -1198,7 +1198,7 @@ def getTuples(data,scale=1,placement=None,normal=None,close=True):
t = []
if len(data.Wires) == 1:
import Part,DraftGeomUtils
data = Part.Wire(DraftGeomUtils.sortEdges(data.Wires[0].Edges))
data = Part.Wire(Part.__sortEdges__(data.Wires[0].Edges))
verts = data.Vertexes
try:
c = data.CenterOfMass
Expand Down Expand Up @@ -1274,7 +1274,7 @@ def getIfcExtrusionData(obj,scale=1,nosubs=False):
ecurves = []
last = None
import DraftGeomUtils
edges = DraftGeomUtils.sortEdges(p.Edges)
edges = Part.__sortEdges__(p.Edges)
for e in edges:
if isinstance(e.Curve,Part.Circle):
import math
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Arch/importOBJ.py
Expand Up @@ -84,7 +84,7 @@ def getIndices(shape,offset):
else:
fi = ""
# OCC vertices are unsorted. We need to sort in the right order...
edges = DraftGeomUtils.sortEdges(f.OuterWire.Edges)
edges = Part.__sortEdges__(f.OuterWire.Edges)
#print edges
for e in edges:
#print e.Vertexes[0].Point,e.Vertexes[1].Point
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Arch/importWebGL.py
Expand Up @@ -171,7 +171,7 @@ def getObjectData(obj,wireframeMode=wireframeStyle):
result += tab+"geom.faces.push( new THREE.Face3"+str(f)+" );\n"
for f in obj.Shape.Faces:
for w in f.Wires:
wo = Part.Wire(DraftGeomUtils.sortEdges(w.Edges))
wo = Part.Wire(Part.__sortEdges__(w.Edges))
wires.append(wo.discretize(QuasiDeflection=0.1))

elif obj.isDerivedFrom("Mesh::Feature"):
Expand Down
14 changes: 7 additions & 7 deletions src/Mod/Draft/Draft.py
Expand Up @@ -785,7 +785,7 @@ def makeWire(pointslist,closed=False,placement=None,face=True,support=None):
import DraftGeomUtils, Part
if not isinstance(pointslist,list):
e = pointslist.Wires[0].Edges
pointslist = Part.Wire(DraftGeomUtils.sortEdges(e))
pointslist = Part.Wire(Part.__sortEdges__(e))
nlist = []
for v in pointslist.Vertexes:
nlist.append(v.Point)
Expand Down Expand Up @@ -1760,13 +1760,13 @@ def getPath(edges=[],wires=[],pathname=None):
svg += 'id="%s" ' % pathname
svg += ' d="'
if not wires:
egroups = (DraftGeomUtils.sortEdges(edges),)
egroups = (Part.__sortEdges__(edges),)
else:
egroups = []
for w in wires:
w1=w.copy()
w1.fixWire()
egroups.append(DraftGeomUtils.sortEdges(w1.Edges))
egroups.append(Part.__sortEdges__(w1.Edges))
for egroupindex, edges in enumerate(egroups):
vs=() #skipped for the first edge
for edgeindex,e in enumerate(edges):
Expand Down Expand Up @@ -2648,7 +2648,7 @@ def closeWire(obj):
newobj.Shape = f
else:
edges.append(Part.Line(p1,p0).toShape())
w = Part.Wire(DraftGeomUtils.sortEdges(edges))
w = Part.Wire(Part.__sortEdges__(edges))
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature","Wire")
newobj.Shape = w
addList.append(newobj)
Expand Down Expand Up @@ -2751,7 +2751,7 @@ def makeWires(objectslist):
for e in o.Shape.Edges:
edges.append(e)
try:
nedges = DraftGeomUtils.sortEdges(edges[:])
nedges = Part.__sortEdges__(edges[:])
# for e in nedges: print("debug: ",e.Curve,e.Vertexes[0].Point,e.Vertexes[-1].Point)
w = Part.Wire(nedges)
except Part.OCCError:
Expand Down Expand Up @@ -4678,7 +4678,7 @@ def execute(self,obj):
c = sh.section(cutp)
if (obj.ProjectionMode == "Cutfaces") and (sh.ShapeType == "Solid"):
try:
c = Part.Wire(DraftGeomUtils.sortEdges(c.Edges))
c = Part.Wire(Part.__sortEdges__(c.Edges))
except Part.OCCError:
pass
else:
Expand Down Expand Up @@ -4949,7 +4949,7 @@ def pathArray(self,shape,pathwire,count,xlate,align):
import DraftGeomUtils
closedpath = DraftGeomUtils.isReallyClosed(pathwire)
normal = DraftGeomUtils.getNormal(pathwire)
path = DraftGeomUtils.sortEdges(pathwire.Edges)
path = Part.__sortEdges__(pathwire.Edges)
ends = []
cdist = 0
for e in path: # find cumulative edge end distance
Expand Down

0 comments on commit 1fa67d0

Please sign in to comment.