+ fixed bug #473 - Precision value in Draft

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5092 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
yorikvanhavre 2011-11-05 14:28:29 +00:00
parent e21cb403f5
commit e64a9efc92
3 changed files with 18 additions and 15 deletions

View File

@ -2,7 +2,7 @@
# Resource object code
#
# Created: Fri Oct 14 17:10:38 2011
# Created: Sat Nov 5 12:13:05 2011
# by: The Resource Compiler for PyQt (Qt v4.7.3)
#
# WARNING! All changes made in this file will be lost!
@ -30418,7 +30418,7 @@ qt_resource_data = "\
\x22\x3e\x0a\x20\x20\x20\x3c\x72\x65\x63\x74\x3e\x0a\x20\x20\x20\
\x20\x3c\x78\x3e\x30\x3c\x2f\x78\x3e\x0a\x20\x20\x20\x20\x3c\x79\
\x3e\x30\x3c\x2f\x79\x3e\x0a\x20\x20\x20\x20\x3c\x77\x69\x64\x74\
\x68\x3e\x35\x37\x35\x3c\x2f\x77\x69\x64\x74\x68\x3e\x0a\x20\x20\
\x68\x3e\x35\x39\x30\x3c\x2f\x77\x69\x64\x74\x68\x3e\x0a\x20\x20\
\x20\x20\x3c\x68\x65\x69\x67\x68\x74\x3e\x36\x32\x39\x3c\x2f\x68\
\x65\x69\x67\x68\x74\x3e\x0a\x20\x20\x20\x3c\x2f\x72\x65\x63\x74\
\x3e\x0a\x20\x20\x3c\x2f\x70\x72\x6f\x70\x65\x72\x74\x79\x3e\x0a\
@ -31592,7 +31592,7 @@ qt_resource_data = "\
\x20\x20\x20\x20\x20\x20\x3c\x70\x72\x6f\x70\x65\x72\x74\x79\x20\
\x6e\x61\x6d\x65\x3d\x22\x76\x61\x6c\x75\x65\x22\x3e\x0a\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x6e\x75\x6d\x62\x65\x72\
\x3e\x33\x3c\x2f\x6e\x75\x6d\x62\x65\x72\x3e\x0a\x20\x20\x20\x20\
\x3e\x36\x3c\x2f\x6e\x75\x6d\x62\x65\x72\x3e\x0a\x20\x20\x20\x20\
\x20\x20\x20\x20\x20\x20\x3c\x2f\x70\x72\x6f\x70\x65\x72\x74\x79\
\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x70\x72\x6f\
\x70\x65\x72\x74\x79\x20\x6e\x61\x6d\x65\x3d\x22\x70\x72\x65\x66\

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>575</width>
<width>590</width>
<height>629</height>
</rect>
</property>
@ -583,7 +583,7 @@
<string>The number of decimals in internal coordinates operations (for ex. 3 = 0.001)</string>
</property>
<property name="value">
<number>3</number>
<number>6</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>precision</cstring>

View File

@ -53,7 +53,10 @@ try: draftui = FreeCADGui.draftToolBar
except: draftui = None
pythonopen = open # to distinguish python built-in open function from the one declared here
prec = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("precision")
def prec():
"returns the current Draft precision level"
return Draft.getParam("precision")
def decodeName(name):
"decodes encoded strings"
@ -270,7 +273,7 @@ class fcformat:
def vec(pt):
"returns a rounded Vector from a dxf point"
return FreeCAD.Vector(round(pt[0],prec),round(pt[1],prec),round(pt[2],prec))
return FreeCAD.Vector(round(pt[0],prec()),round(pt[1],prec()),round(pt[2],prec()))
def drawLine(line,shapemode=False):
"returns a Part shape from a dxf line"
@ -296,8 +299,8 @@ def drawPolyline(polyline,shapemode=False):
for p in range(len(polyline.points)-1):
p1 = polyline.points[p]
p2 = polyline.points[p+1]
v1 = FreeCAD.Vector(round(p1[0],prec),round(p1[1],prec),round(p2[2],prec))
v2 = FreeCAD.Vector(round(p2[0],prec),round(p2[1],prec),round(p2[2],prec))
v1 = vec(p1)
v2 = vec(p2)
verts.append(v1)
if not fcvec.equals(v1,v2):
if polyline.points[p].bulge:
@ -316,8 +319,8 @@ def drawPolyline(polyline,shapemode=False):
if polyline.closed:
p1 = polyline.points[len(polyline.points)-1]
p2 = polyline.points[0]
v1 = FreeCAD.Vector(round(p1[0],prec),round(p1[1],prec),round(p1[2],prec))
v2 = FreeCAD.Vector(round(p2[0],prec),round(p2[1],prec),round(p2[2],prec))
v1 = vec(p1)
v2 = vec(p2)
cv = calcBulge(v1,polyline.points[-1].bulge,v2)
if not fcvec.equals(v1,v2):
if fcvec.isColinear([v1,cv,v2]):
@ -345,11 +348,11 @@ def drawPolyline(polyline,shapemode=False):
def drawArc(arc,shapemode=False):
"returns a Part shape from a dxf arc"
v=vec(arc.loc)
firstangle=round(arc.start_angle,prec)
lastangle=round(arc.end_angle,prec)
firstangle=round(arc.start_angle,prec())
lastangle=round(arc.end_angle,prec())
circle=Part.Circle()
circle.Center=v
circle.Radius=round(arc.radius,prec)
circle.Radius=round(arc.radius,prec())
try:
if (fmt.paramstyle == 4) and (not fmt.makeBlocks) and (not shapemode):
pl = FreeCAD.Placement()
@ -365,7 +368,7 @@ def drawCircle(circle,shapemode=False):
"returns a Part shape from a dxf circle"
v = vec(circle.loc)
curve = Part.Circle()
curve.Radius = round(circle.radius,prec)
curve.Radius = round(circle.radius,prec())
curve.Center = v
try:
if (fmt.paramstyle == 4) and (not fmt.makeBlocks) and (not shapemode):