Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code

This commit is contained in:
Yorik van Havre 2015-01-20 20:04:54 -02:00
commit cb0fc8cd8e
2 changed files with 27 additions and 6 deletions

View File

@ -78,7 +78,8 @@ void FileDialog::accept()
if (!files.isEmpty()) {
QString ext = this->defaultSuffix();
QString file = files.front();
if (!ext.isEmpty() && !file.endsWith(ext, Qt::CaseInsensitive)) {
QFileInfo fi(file);
if (!ext.isEmpty() && fi.suffix().isEmpty()) {
file = QString::fromLatin1("%1.%2").arg(file).arg(ext);
// That's the built-in line edit
QLineEdit* fileNameEdit = this->findChild<QLineEdit*>(QString::fromLatin1("fileNameEdit"));

View File

@ -621,7 +621,7 @@ as there is currently no Draft premitive to handle splines the result is a
non-parametric curve"""
flags = rawValue(spline,70)
closed = (flags & 1) != 0
periodic = (flags & 2) != 0
periodic = (flags & 2) != 0 and False # workaround
rational = (flags & 4) != 0
planar = (flags & 8) != 0
linear = (flags & 16) != 0
@ -694,11 +694,31 @@ non-parametric curve"""
previousknot = knotvalue
knotvector.append(knotvalue)
multvector.append(mult)
# check if the multiplicities are valid
innermults = multvector[:] if periodic else multvector[1:-1]
if any(m>degree for m in innermults):
#raise ValueError('Invalid multiplicities')
#warn('polygon fallback on %s' %spline)
return drawSplineIterpolation(controlpoints,closed=closed,\
if any(m>degree for m in innermults): #invalid
if all(m == degree+1 for m in multvector):
if not forceShape and weights is None:
points=controlpoints[:]
del points[degree+1::degree+1]
return Draft.makeBezCurve(points,Degree=degree)
else:
poles=controlpoints[:]
edges=[]
while len(poles) >= degree+1:
#bezier segments
bzseg=Part.BezierCurve()
bzseg.increase(degree)
bzseg.setPoles(poles[0:degree+1])
poles=poles[degree+1:]
if weights is not None:
bzseg.setWeights(weights[0:degree+1])
weights=weights[degree+1:]
edges.append(bzseg.toShape())
return Part.Wire(edges)
else:
warn('polygon fallback on %s' %spline)
return drawSplineIterpolation(controlpoints,closed=closed,\
forceShape=forceShape,alwaysDiscretize=True)
try:
bspline=Part.BSplineCurve()