Skip to content

Commit

Permalink
Merge branch 'misc-typos' of https://github.com/luzpaz/FreeCAD into l…
Browse files Browse the repository at this point in the history
…uzpaz-misc-typos
  • Loading branch information
yorikvanhavre committed Aug 9, 2019
2 parents 3e11cc5 + 6d64c2b commit 2a139a8
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Mod/Arch/OfflineRenderingUtils.py
Expand Up @@ -297,7 +297,7 @@ def render(outputfile,scene=None,camera=None,zoom=False,width=400,height=300,bac
the given coin camera (ortho or perspective). If zoom is True the camera will be resized to fit all
objects. The outputfile must be a file path to save a png image. Optionally a light direction as a (x,y,z)
tuple can be given. In this case, a directional light will be added and shadows will
be turned on. This might not work with soem 3D drivers."""
be turned on. This might not work with some 3D drivers."""

# On Linux, the X server must have indirect rendering enabled in order to be able to do offline
# PNG rendering. Unfortunately, this is turned off by default on most recent distros. The easiest
Expand Down Expand Up @@ -428,7 +428,7 @@ def viewer(scene=None,background=(1.0,1.0,1.0),lightdir=None):
a standalone coin viewer with the contents of the given scene. You can
give a background color, and optionally a light direction as a (x,y,z)
tuple. In this case, a directional light will be added and shadows will
be turned on. This might not work with soem 3D drivers."""
be turned on. This might not work with some 3D drivers."""

# Initialize Coin. This returns a main window to use
from pivy import sogui
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Arch/importIFC.py
Expand Up @@ -1235,7 +1235,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
if mdict:
mat.Material = mdict
fcmats[mat.Name] = mat
# fill material attribut of the objects
# fill material attribute of the objects
for o,m in mattable.items():
if m == material.id():
if o in objects:
Expand Down
87 changes: 85 additions & 2 deletions src/Mod/Draft/importSVG.py
Expand Up @@ -7,7 +7,7 @@
This module provides support for importing and exporting SVG files. It
enables importing/exporting objects directly to/from the 3D document, but
doesn't handle the SVG output from the Drawng and TechDraw modules.
doesn't handle the SVG output from the Drawing and TechDraw modules.
Currently it only reads the following entities:
* paths, lines, circular arcs, rects, circles, ellipses, polygons, polylines.
Expand Down Expand Up @@ -49,7 +49,7 @@
# handle image element (external references and inline base64)
# debug Problem with 'Sans' font from Inkscape
# debug Problem with fill color
# implement inherting fill style from group
# implement inheriting fill style from group
# handle relative units

import xml.sax, FreeCAD, os, math, re, Draft, DraftVecUtils
Expand Down Expand Up @@ -743,13 +743,96 @@ def startElement(self, name, attrs):
ret = msgBox.exec_()
if ret == QtGui.QMessageBox.Yes:
self.svgdpi = 96.0
<<<<<<< HEAD
else:
self.svgdpi = 90.0
if ret:
FCC.PrintMessage(translate("ImportSVG", _msg) + "\n")
FCC.PrintMessage(translate("ImportSVG", _qst) + "\n")
FCC.PrintMessage("*** User specified "
+ str(self.svgdpi) + " dpi ***\n")
=======
if 'style' in data:
if not data['style']:
pass#empty style attribute stops inheriting from parent
else:
content = data['style'].replace(' ','')
content = content.split(';')
for i in content:
pair = i.split(':')
if len(pair)>1: data[pair[0]]=pair[1]

for k in ['x','y','x1','y1','x2','y2','r','rx','ry','cx','cy','width','height']:
if k in data:
data[k] = getsize(data[k][0],'css'+str(self.svgdpi))

for k in ['fill','stroke','stroke-width','font-size']:
if k in data:
if isinstance(data[k],list):
if data[k][0].lower().startswith("rgb("):
data[k] = ",".join(data[k])
else:
data[k]=data[k][0]

# extracting style info

self.fill = None
self.color = None
self.width = None
self.text = None

if name == 'svg':
m=FreeCAD.Matrix()
if not self.disableUnitScaling:
if 'width' in data and 'height' in data and \
'viewBox' in data:
vbw=float(data['viewBox'][2])
vbh=float(data['viewBox'][3])
w=attrs.getValue('width')
h=attrs.getValue('height')
self.viewbox=(vbw,vbh)
if len(self.grouptransform)==0:
unitmode='mm'+str(self.svgdpi)
else: #nested svg element
unitmode='css'+str(self.svgdpi)
abw = getsize(w,unitmode)
abh = getsize(h,unitmode)
sx=abw/vbw
sy=abh/vbh
preservearstr=' '.join(data.get('preserveAspectRatio',[])).lower()
uniformscaling = round(sx/sy,5) == 1
if uniformscaling:
m.scale(Vector(sx,sy,1))
else:
FreeCAD.Console.PrintWarning('Scaling Factors do not match!!!\n')
if preservearstr.startswith('none'):
m.scale(Vector(sx,sy,1))
else: #preserve the aspect ratio
if preservearstr.endswith('slice'):
sxy=max(sx,sy)
else:
sxy=min(sx,sy)
m.scale(Vector(sxy,sxy,1))
elif len(self.grouptransform)==0:
#fallback to current dpi
m.scale(Vector(25.4/self.svgdpi,25.4/self.svgdpi,1))
self.grouptransform.append(m)
if 'fill' in data:
if data['fill'][0] != 'none':
self.fill = getcolor(data['fill'])
if 'stroke' in data:
if data['stroke'][0] != 'none':
self.color = getcolor(data['stroke'])
if 'stroke-width' in data:
if data['stroke-width'] != 'none':
self.width = getsize(data['stroke-width'],'css'+str(self.svgdpi))
if 'transform' in data:
m = self.getMatrix(attrs.getValue('transform'))
if name == "g":
self.grouptransform.append(m)
else:
self.transform = m
>>>>>>> 6d64c2b2c6bc64ce21e7c2f4ed7e1ab2c8991f8e
else:
self.svgdpi = 96.0
FCC.PrintMessage(_msg + "\n")
Expand Down
8 changes: 4 additions & 4 deletions src/Mod/Mesh/App/Core/Evaluation.cpp
Expand Up @@ -840,7 +840,7 @@ bool MeshEvalNeighbourhood::Evaluate ()
}
else {
// we handle only the cases for 1 and 2, for all higher
// values we have a non-manifold that is ignorned here
// values we have a non-manifold that is ignored here
if (count == 2) {
const MeshFacet& rFace0 = rclFAry[f0];
const MeshFacet& rFace1 = rclFAry[f1];
Expand Down Expand Up @@ -906,7 +906,7 @@ std::vector<unsigned long> MeshEvalNeighbourhood::GetIndices() const
}
else {
// we handle only the cases for 1 and 2, for all higher
// values we have a non-manifold that is ignorned here
// values we have a non-manifold that is ignored here
if (count == 2) {
const MeshFacet& rFace0 = rclFAry[f0];
const MeshFacet& rFace1 = rclFAry[f1];
Expand Down Expand Up @@ -982,7 +982,7 @@ void MeshKernel::RebuildNeighbours (unsigned long index)
}
else {
// we handle only the cases for 1 and 2, for all higher
// values we have a non-manifold that is ignorned here
// values we have a non-manifold that is ignored here
if (count == 2) {
MeshFacet& rFace0 = this->_aclFacetArray[f0];
MeshFacet& rFace1 = this->_aclFacetArray[f1];
Expand All @@ -1005,7 +1005,7 @@ void MeshKernel::RebuildNeighbours (unsigned long index)
}

// we handle only the cases for 1 and 2, for all higher
// values we have a non-manifold that is ignorned here
// values we have a non-manifold that is ignored here
if (count == 2) {
MeshFacet& rFace0 = this->_aclFacetArray[f0];
MeshFacet& rFace1 = this->_aclFacetArray[f1];
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/OpenSCAD/OpenSCAD2Dgeom.py
Expand Up @@ -413,7 +413,7 @@ def superWireReverse(debuglist,closed=False):
'''superWireReverse(debuglist,[closed]): forces a wire between edges
that don't necessarily have coincident endpoints. If closed=True, wire
will always be closed. debuglist has a tuple for every edge.The first
entry is the edge, the second is the flag 'does not nedd to be inverted'
entry is the edge, the second is the flag 'does not need to be inverted'
'''
#taken from draftlibs
def median(v1,v2):
Expand Down
5 changes: 1 addition & 4 deletions src/Tools/fcinfo
Expand Up @@ -130,7 +130,7 @@ class FreeCADFileHandler(xml.sax.ContentHandler):

elif tag == "Property":
self.prop = None
# skip "internal" properties, unuseful for a diff
# skip "internal" properties, useless for a diff
if attributes["name"] not in ["Symbol","AttacherType","MapMode","MapPathParameter","MapReversed",
"AttachmentOffset","SelectionStyle","TightGrid","GridSize","GridSnap",
"GridStyle","Lighting","Deviation","AngularDeflection","BoundingBox",
Expand Down Expand Up @@ -252,6 +252,3 @@ if __name__ == '__main__':
print("Document: "+sys.argv[-1]+" ("+s+")")
print(" SHA1: "+str(hashlib.sha1(open(sys.argv[-1],'rb').read()).hexdigest()))
xml.sax.parseString(doc,FreeCADFileHandler(zfile,short))



0 comments on commit 2a139a8

Please sign in to comment.