View Issue Details

IDProjectCategoryView StatusLast Update
0001273FreeCADBugpublic2017-03-27 08:29
Reporterpkoning Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version0.13 
Fixed in Version0.14 
Summary0001273: "revolve" method fails
DescriptionIf I create a default ellipse and try to revolve it around the X axis, the result is simply that same ellipse. Revolving around the Y axis works properly.

Also, if I try to revolve it around "almost the X axis", FreeCAD goes into an infinite loop.

Sample code:

e=Part.Ellipse()
es=Part.Shape([e])
V=Base.Vector
er=es.revolve(V(0,0,0),V(0,1,0))
Part.show (er) # works fine
er=es.revolve(V(0,0,0),V(1,0,0))
Part.show (er) # shows just an ellipse
er=es.revolve(V(0,0,0),V(1,1e-6,0))
Part.show (er) # infinite loop
TagsNo tags attached.
FreeCAD Information

Activities

wmayer

2013-10-16 08:20

administrator   ~0003752

Are you aware of that if you revolve a full ellipse by 360 deg that you create the surface twice? This way you clearly create a corrupted model which is impossible to mesh correctly. One way is to revolve only by 180 deg but the meshing algorithm still has problems at the two poles.

So, the correct way is to create only half of the ellipse and do a full rotation. The arc of ellipse must be chosen this way that the poles lie on the shape's end points.

from FreeCAD import Base
import Part
e=Part.Ellipse()
e.FirstParameter
e.LastParameter
es=e.toShape(e.FirstParameter,e.LastParameter/2)
Part.show(es)
er=es.revolve(Base.Vector(0,0,0),Base.Vector(1,0,0))
Part.show(er)
es=e.toShape(e.LastParameter/4,3*e.LastParameter/4)
Part.show(es)
er=es.revolve(Base.Vector(0,0,0),Base.Vector(0,1,0))
Part.show(er)

pkoning

2013-10-16 15:48

reporter   ~0003756

Oh. Sure, that makes sense. I assume I could also starts with a whole ellipse and rotate it just 180 degrees.

It sure would be helpful if there were messages that come up for stuff like this.

wmayer

2013-10-17 06:10

administrator   ~0003758

And how do you think we should recognize such situations? IMO it cannot be task of the API to identify all situations a user makes something wrong. That's simply neither possible nor realistic. At some point we simply have to say it's in the responsibility of the user to think about the correct use of the API. And I think from a programmer this can be expected.

All what can be done is to write this down to the Wiki.

> I assume I could also starts with a whole ellipse and rotate it just 180 degrees.
As mentioned above this still doesn't work correctly. The model might be valid but the meshing algorithm has problems to tessellate the shape around the poles. So, the trick is that the start and end point of the arc of ellipse are the poles.

pkoning

2013-10-17 12:15

reporter   ~0003760

Yes, I agree that a programmer can be expected to use an API correctly -- so long as it is documented. And it also helps if there is material to read that describes what can go wrong, and why, and how to avoid it.
Part of the problem is that using an API is everyday work for a programmer, but understanding the intricacies of CGS modeling isn't, necessarily. And the FreeCAD documentation doesn't offer much help there. I'm reading the POVray manual, which is some help, plus an old (1986) computer graphics textbook.

wmayer

2013-10-17 12:55

administrator   ~0003762

The documentation of the revolve() method now contains the above example.

wmayer

2013-10-17 12:55

administrator   ~0003763

git show 3fe1ef1

Related Changesets

FreeCAD: master 3fe1ef16

2013-10-17 16:53:10

wmayer

Details Diff
0001273: revolve method fails Affected Issues
0001273
mod - src/Mod/Part/App/TopoShapePy.xml Diff File

Issue History

Date Modified Username Field Change
2013-10-15 18:49 pkoning New Issue
2013-10-16 08:20 wmayer Note Added: 0003752
2013-10-16 15:48 pkoning Note Added: 0003756
2013-10-17 06:10 wmayer Note Added: 0003758
2013-10-17 12:15 pkoning Note Added: 0003760
2013-10-17 12:55 wmayer Note Added: 0003762
2013-10-17 12:55 wmayer Note Added: 0003763
2013-10-17 12:55 wmayer Status new => closed
2013-10-17 12:55 wmayer Resolution open => no change required
2013-10-17 12:55 wmayer Fixed in Version => 0.14
2017-03-27 08:29 Kunda1 Changeset attached => FreeCAD master 3fe1ef16