Merge branch 'misc-typos' of https://github.com/luzpaz/FreeCAD into luzpaz-misc-typos
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
@@ -49,7 +49,7 @@ __url__ = ["http://www.freecadweb.org"]
|
||||
# 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
|
||||
@@ -743,6 +743,7 @@ class svgHandler(xml.sax.ContentHandler):
|
||||
ret = msgBox.exec_()
|
||||
if ret == QtGui.QMessageBox.Yes:
|
||||
self.svgdpi = 96.0
|
||||
<<<<<<< HEAD
|
||||
else:
|
||||
self.svgdpi = 90.0
|
||||
if ret:
|
||||
@@ -750,6 +751,88 @@ class svgHandler(xml.sax.ContentHandler):
|
||||
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")
|
||||
|
||||
@@ -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];
|
||||
@@ -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];
|
||||
@@ -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];
|
||||
@@ -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];
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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",
|
||||
@@ -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))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user