BSpline curve : Knots interval values too close

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
bejant
Posts: 5953
Joined: Thu Jul 11, 2013 3:06 pm

BSpline curve : Knots interval values too close

Postby bejant » Sat Aug 17, 2013 10:58 pm

I wanted to check my model for errors so I switched from Part Design Workbench to OpenSCAD Workbench, and got the error message:
OpenSCAD executable not found
But I was still able to "Analyze geometry for errors"

Next I tried to refine a pad ("Pad001") I got this error message:
Traceback (most recent call last):
File "C:\Program Files\FreeCAD0.13\Mod\OpenSCAD\OpenSCADFeatures.py", line 280, in execute
fp.Shape=sh.transformGeometry(sh.Placement.toMatrix())
<type 'exceptions.Exception'>: BSpline curve : Knots interval values too close
refine_Pad001: BSpline curve : Knots interval values too close
and am wondering ... now what did I do?

And how do I fix it?




OS: Windows XP
Platform: 32-bit
Version: 0.14.2370 (Git)
Branch: master
Hash: a836759ebd91404954a778ff8885e152611576e1
Python version: 2.6.2
Qt version: 4.5.2
Coin version: 3.1.0
SoQt version: 1.4.1
OCC version: 6.5.1
Attachments
Knots_Interval.FCStd
(16.1 KiB) Downloaded 24 times
User avatar
bejant
Posts: 5953
Joined: Thu Jul 11, 2013 3:06 pm

Re: BSpline curve : Knots interval values too close

Postby bejant » Sat Aug 17, 2013 11:02 pm

Tried to refine again and got this message instead:
Traceback (most recent call last):
File "C:\Program Files\FreeCAD0.13\Mod\OpenSCAD\OpenSCADFeatures.py", line 280, in execute
fp.Shape=sh.transformGeometry(sh.Placement.toMatrix())
<type 'exceptions.Exception'>: Geom_TrimmedCurve::parameters out of range
refine_Pad001: Geom_TrimmedCurve::parameters out of range
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: BSpline curve : Knots interval values too close

Postby NormandC » Sat Aug 17, 2013 11:38 pm

bejant wrote:I wanted to check my model for errors so I switched from Part Design Workbench to OpenSCAD Workbench, and got the error message:
Did you install OpenSCAD? Did you set the OpenSCAD executable path in the preferences?
bejant wrote:Next I tried to refine a pad ("Pad001") I got this error message:
As far as I know the refine algorithm only works on planar surfaces...
User avatar
bejant
Posts: 5953
Joined: Thu Jul 11, 2013 3:06 pm

Re: BSpline curve : Knots interval values too close

Postby bejant » Sun Aug 18, 2013 2:10 am

normandc wrote:Did you install OpenSCAD? Did you set the OpenSCAD executable path in the preferences?
I did neither; in the Windows version both are done automatically during the install. EDIT:previous bold red text is not true But, I did a quick check anyway to make sure both functions do work.

EDIT=====================
Looks like I need to set the ececutable path in preferences. I believe OpenSCAD is installed because Check Geometry and Refine Geometry both work from the OpenSCAD Workbench, but will look into it further tomorrow or Monday.. Thanks for the info!
===========================


Screen Grab after checking simple geometry for errors:
Image


Screen Grab after refining geometry:
Image
normandc wrote:As far as I know the refine algorithm only works on planar surfaces...
That may be the problem but I still don't know for sure. The sketch in the other model had arcs tangent to other arcs and lines.
Last edited by bejant on Fri Aug 23, 2013 2:45 am, edited 2 times in total.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: BSpline curve : Knots interval values too close

Postby NormandC » Sun Aug 18, 2013 3:59 am

bejant wrote:I did neither; in the Windows version both are done automatically during the install.
Where did you get that info? It is incorrect. You NEED to install OpenSCAD separately, it is not included with FreeCAD. OpenSCAD is released under the GPL v2 which means including it would be a license violation because FreeCAD is licenced under the LPGL, not the GPL.

The OpenSCAD workbench is just an interface allowing use of OpenSCAD files and code syntax.
bejant wrote:I believe OpenSCAD is installed because Check Geometry and Refine Geometry both work from the OpenSCAD Workbench,
Nope, wrong again. Check geometry and Refine geometry are not OpenSCAD tools, they are FreeCAD tools from the Part workbench. They were added to the OpenSCAD workbench for convenience.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: BSpline curve : Knots interval values too close

Postby NormandC » Sun Aug 18, 2013 4:02 am

bejant wrote:
normandc wrote:As far as I know the refine algorithm only works on planar surfaces...
That may be the problem but I still don't know for sure. The sketch in the other model had arcs tangent to other arcs and lines.
OK, I'll admit I hadn't previously had a look at your file. I just did.

First thing I noticed is it contains no BSpline geometry. I have no idea why the OpenSCADFeatures.py script threw that error.

Next I checked the OpenSCAD refine shape feature and I got the same error you did.

Since as I said this feature is based on the Part --> Refine shape tool, I tried it, and found that contrary to what I thought, it actually works on cylindrical surfaces.

I believe the problem is with the OpenSCAD refine shape feature. One thing you need to be aware is that the Part Refine shape tool is not parametric. It creates a cleaned up shape that has no relationship with the original. So if you make edits to upstream features, they will not be reflected by the refined shape. The OpenSCAD refine shape feature is a parametric implementation.

So here the workaround for now is to use the Part refine shape tool instead. But since it's not parametric, you should use it only when your model is completed.

You might want to report this bug on Mantis.
Attachments
Knots_Interval_partrefine.FCStd
(29.15 KiB) Downloaded 23 times
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: BSpline curve : Knots interval values too close

Postby shoogen » Sun Aug 18, 2013 12:56 pm

The problem with the refine shape alogritm is that it might return a Shape with a placement. This Shape can be staticly assigned to a static Part::Feature but it can not be used in a parametric object. Since the placment of the shape may conflict with the placement of the (parametric) feature.
The only way i found to work around this limitation,is to apply the Placement to the shape using transformGeometry.
https://sourceforge.net/apps/mantisbt/f ... hp?id=1221
Using transformGeometry is a bad idea as Werner explained many times before.
Last edited by shoogen on Sun Aug 18, 2013 1:38 pm, edited 1 time in total.
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: BSpline curve : Knots interval values too close

Postby shoogen » Sun Aug 18, 2013 1:36 pm

If you really want to use the parametric refine shape feature. You can manually work around this problem, by applying an unneccessary boolean operation.
In your case creating a box and cutting it from Pad001 solves the problem. The resulting shape as 'null' placement and the result of the refine shape operation (of the 'Cut' obects) has a null placement as well and can be used without transformGeometry.

Code: Select all

if sh.Placement.isNull():
    fp.Shape=sh
else:
    fp.Shape=sh.transformGeometry(sh.Placement.toMatrix())
Attachments
Knots_Interval.FCStd
with boolean before refine
(30.63 KiB) Downloaded 21 times
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: BSpline curve : Knots interval values too close

Postby NormandC » Sun Aug 18, 2013 5:18 pm

Nope, it destroys the solid. Look at the hole, its cylindrical surface is missing.

Image

OS: Ubuntu 12.04.2 LTS
Platform: 64-bit
Version: 0.14.2393 (Git)
Branch: master
Hash: fc0d342c6f529d97c76e912bc730b36fdf577dfb
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.5.0
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: BSpline curve : Knots interval values too close

Postby shoogen » Sun Aug 18, 2013 5:31 pm

I created an empty shapes with the common of to non intersection boxes. Fusing pad001 with this empty shape gives a valid shape and parametric refine is also valid.