Cylinder part not drawing as a circle in projection

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!
Bibi
Posts: 23
Joined: Tue Nov 04, 2014 7:28 pm

Cylinder part not drawing as a circle in projection

Post by Bibi »

A simple part: Cylinder with a cylindrical cut out at 45 degrees, like so:
Part
Part
part.png (20.79 KiB) Viewed 4263 times
Should, in my mind, be drawn as a perfect circle when drawn as an orthographic projection in top view (drawing toolbench). However, it draws this funny shape:
Top view
Top view
topview.png (28.33 KiB) Viewed 4263 times
Bottom view
Bottom view
bottomview.png (31.36 KiB) Viewed 4263 times
Even though the shape is indeed funny, when viewing from the top or bottom the outer line is defined by the cylinder only, and should thus draw as a perfect circle. Or am I missing something?

The FreeCad file:
Cylinder non-circular.FCStd
FreeCad
(43.14 KiB) Downloaded 82 times
My version: (Same results in 0.14 and Mac)
OS: Windows 7
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.15.4346 (Git)
Branch: master
Hash: e329cb5c3acd5b170359e0e8cd28d98b61be935d
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Cylinder part not drawing as a circle in projection

Post by bejant »

Bibi wrote:when viewing from the top or bottom the outer line is defined by the cylinder only, and should thus draw as a perfect circle. Or am I missing something?
I don't think you're missing anything; and agree that there should not be any hidden lines when viewed from the top or bottom. Have a look at your model from the top and from the bottom...
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Cylinder part not drawing as a circle in projection

Post by NormandC »

Seems like you found a bug in the Drawing workbench. You could report it on the bug tracker. I think it has trouble projecting BSpline curves correctly.

FYI, if you create a Draft Shape2DView of your shape with direction set to (0,0,-1), the projected edge is circular as it should be.
wmayer
Founder
Posts: 20113
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Cylinder part not drawing as a circle in projection

Post by wmayer »

FYI, if you create a Draft Shape2DView of your shape with direction set to (0,0,-1), the projected edge is circular as it should be.
The same happens when using the projection command of the Drawing workbench. And the interesting fact is that the edge doesn't only look circular but it's a real circle.
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Cylinder part not drawing as a circle in projection

Post by shoogen »

wmayer wrote:And the interesting fact is that the edge doesn't only look circular but it's a real circle.
It should theoretically be circular. But it isn't.

Code: Select all

   1 : BSplineCurve
  Degree 8, 65 Poles, 10  Knots

Code: Select all

>>> bsp.Degree,bsp.isPeriodic()
(8, False)
>>> bsp.getMultiplicities(),bsp.getKnots()
([9, 7, 7, 7, 7, 7, 7, 7, 7, 9], [0.0, 0.07, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0])
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Cylinder part not drawing as a circle in projection

Post by shoogen »

The cuprit are bad parameters for the BSpline approximation, that is meant to reduce the degree for svg output.
OCCT makes a bad last segment instead of distributing the the error among all segments.
Allowing a coarser tolerance (currently 0.001 in drawing (and 0.05 in draft)) or more path segments (currently 10 in drawing (and 20 in draft)) solves the problem in this case.
https://github.com/FreeCAD/FreeCAD_sf_m ... t.cpp#L190
wmayer
Founder
Posts: 20113
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Cylinder part not drawing as a circle in projection

Post by wmayer »

The cuprit are bad parameters for the BSpline approximation, that is meant to reduce the degree for svg output.
The problem there is that SVG doesn't support B-splines at all. AFAIK it only supports Bezier curves up to a degree of 3.
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Cylinder part not drawing as a circle in projection

Post by shoogen »

wmayer wrote:The problem there is that SVG doesn't support B-splines at all. AFAIK it only supports Bezier curves up to a degree of 3.
It works well for me. DXF is the one that shows serious problems.
dxf-bspline-degree8.png
dxf-bspline-degree8.png (62.33 KiB) Viewed 4183 times
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Cylinder part not drawing as a circle in projection

Post by Kunda1 »

issue #1898 target was set to 0.15
Do we need to bump it to 0.17 or some future release?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Cylinder part not drawing as a circle in projection

Post by NormandC »

The problem appears to be fixed in

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

Forcing a recompute fixes the Drawing views.
Post Reply