"Cone" with ellipse on bottom and top

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!
jacekbator
Posts: 12
Joined: Thu Mar 31, 2011 7:36 pm

"Cone" with ellipse on bottom and top

Post by jacekbator »

Hi,

Is there a simple way to create cone like part with ellipse instead of circle on bottom and top of it?

Regards

Jacek
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: "Cone" with ellipse on bottom and top

Post by wmayer »

Yep.

Code: Select all

import Part
cone=Part.makeCone(2,4,10)
from FreeCAD import Base
mat=Base.Matrix()
mat.A22=1.5
cone=cone.transformGeometry(mat)
Part.show(cone)
Guest

Re: "Cone" with ellipse on bottom and top

Post by Guest »

Thank you for the tip. At a start I thought about same solution but it doesn't completely solve my problem. It will resize same way top and bottom circle to ellipse and I need separate way of controlling top and bottom ellipse size.

My part to model is elliptically shaped (but starts with circle) horn.

Image

I have calculated about 400 ellipses for different layers of the horn (they are not equally spaced). I thought that there may be a way to create two 2D ellipses and than do something to connect their edges to full 3d "cone". Or maybe there is a way to model it other way than my set of elliptical cones?
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: "Cone" with ellipse on bottom and top

Post by NormandC »

Hi,

400 ellipses? :shock: The makeLoft command could do this with three, but it makes a surface opened on both ends. So you'll need to close the ends and make a solid, a few more operations involved (I think with makeSolid but I've never tried it). Plus I don't even know if it's possible to draw a 2D ellipse at the moment.

If you want to look into using makeLoft, search the forum, I got help from Werner and Yorik a few weeks ago.

Edit: looked at the Python scripting API, especially at transformGeometry, it looks like the transformation could be made to the 2D elements instead of the 3D shape, but I'm not sure. I'm still very green at this. So you draw circles for your profiles, transform the bottom and mid one to ellipses, then you execute makeLoft.

Edit Nº 2: for the fun of it, I drew ellipses in QCad, saved as dxf to import it in FreeCAD, but the ellipses are not recognized.
Attachments
loft_trumpet.jpg
loft_trumpet.jpg (24.13 KiB) Viewed 4580 times
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: "Cone" with ellipse on bottom and top

Post by wmayer »

Doing it with makeLoft should work. Another way could be Part.Wire.makePipeShell() if you know the curve along the ellipses -- it looks like a parabola. Here is a simplified script which just uses a straight line but it's good enough to demonstrate the idea.

Code: Select all

import Part
from FreeCAD import Base

c=Part.makeCircle(2,Base.Vector(0,0,10))
e=Part.makeCircle(20)
m=Base.Matrix()
m.A22=0.7
e=e.transformGeometry(m)
e=Part.Edge(e)
Part.show(c)
Part.show(e)

w1=Part.Wire(e)
w2=Part.Wire(c)

l=Part.makeLine(e.valueAt(0),c.valueAt(0))
Part.show(l)
w3=Part.Wire(l)
shell=w3.makePipeShell([w1,w2])
Part.show(shell
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: "Cone" with ellipse on bottom and top

Post by NormandC »

Cool! :)

It is better since you can control the trajectory. Can a BSpline be used for the curve between the elllipes? Can two or more different curves be used?
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: "Cone" with ellipse on bottom and top

Post by wmayer »

It is better since you can control the trajectory. Can a BSpline be used for the curve between the elllipes? Can two or more different curves be used?
You can use whatever you want. The only important thing is that the object of which you call "makePipeShell" is a wire. Btw, this method is available for wires only anyway. Since a wire can consist of several curves the second point is also possible.
Guest

Re: "Cone" with ellipse on bottom and top

Post by Guest »

normandc wrote:400 ellipses? :shock: The makeLoft command could do this with three.
:) But with 3 ellipses you will not get profile I want. I think I can live happily with 40-80.

I have tried makeLoft way. For a test I used 11 layers.
Image
For a start tried to run makeLoft for all of them but result was incorrect.
Image
Next try was to run makeLoft for group of 3 ellipses.
Image
But union of them gave strange result
Image
So I grouped them by 2 and union result was correct
Image
Image

So now I have to figure out how to close top and bottom because makeSolid failed to do that.
And/or try second approach.

btw. I used Part.Ellipse. Is is something wrong with it?

Any way thank you both for help
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: "Cone" with ellipse on bottom and top

Post by NormandC »

Hi!

Nice work! :) But... ;)
Guest wrote:
normandc wrote:400 ellipses? :shock: The makeLoft command could do this with three.
:) But with 3 ellipses you will not get profile I want. I think I can live happily with 40-80.
It is just my opinion, and I am in no way an expert, but it's based on the surfacing work (product design) I did in Solid Edge for two years, as well as reading some surfacing guidelines for SolidWorks (the principles are universal). It seems to me like you are making your shape uselessly complicated with so many profiles. Plus you have to calculate your ellipses' positions and dimensions perfectly or you won't get a nice smooth curve in between, rather you'll get a bumpy or uneven surface. In this case Werner's suggestion of using makePipeShell() may ensure you get the exact curve you want, with very few profiles.

To be honest though, I don't know how makePipeShell() works. In commercial parametric CAD packages you can create lofts with multiple profiles along with multiple guide curves that are in contact with the profiles. This would be the best tool for your "trumpet" I think.
So now I have to figure out how to close top and bottom because makeSolid failed to do that.
Hope you won't mind my asking, but I imagine you made sure you had surfaces at top and bottom before executing the makeSolid command?

If you did, then let's wait for Werner's answer because I want to know how to do this too. :)
btw. I used Part.Ellipse. Is is something wrong with it?
My mistake. It is not listed in the wiki, so I assumed it didn't exist. Just saw it in the console's completion mode. I confess I don't use it much. I don't even have a working knowledge of Python yet... :oops:
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: "Cone" with ellipse on bottom and top

Post by wmayer »

Hope you won't mind my asking, but I imagine you made sure you had surfaces at top and bottom before executing the makeSolid command?

If you did, then let's wait for Werner's answer because I want to know how to do this too.
To get a closed solid you have to do two further steps. From the top and bottom profiles make a face and then make a compound of the three objects which then can be converted into a solid.

Code: Select all

...
f1=Part.Face(w1)
f2=Part.Face(w2)

comp=Part.Compound([shell,f1,f2])
solid=Part.Solid(Part.Shell(comp.Faces))
Part.show(solid)
Post Reply