Introduction and Bearing Creator Tool

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
javiermg
Posts: 7
Joined: Mon Aug 12, 2013 11:04 am

Re: Introduction and Bearing Creator Tool

Postby javiermg » Sun Sep 22, 2013 7:08 pm

Hello all again.
At first I want to excuse myself for not replying your posts, I have been very very busy this months..
I am coming back slowly.

To jreinhardt: please include the code BOLTS as you want, I am very happy with the idea.
WIll check how it works later ;)

To mario52, i really don't know why you can't create these geometries. I'm very new to freecad programming and I'm sorry to not being able to help you.
All I can do is redirect you to my blog, where the development of the script is carefully described: http://linuxforanengineer.blogspot.com. ... cript.html


Thanks for your interest.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Introduction and Bearing Creator Tool

Postby NormandC » Sun Sep 22, 2013 7:16 pm

Very nice blog! And cool engine! Hope you share pictures in my topic when you're finished! (see my signature) :)
javiermg
Posts: 7
Joined: Mon Aug 12, 2013 11:04 am

Re: Introduction and Bearing Creator Tool

Postby javiermg » Sun Sep 22, 2013 9:02 pm

Thanks!
I build it in my spare time, as a good way to learn Freecad
Of course, I'll share the pictures :)
mario52
Posts: 2847
Joined: Wed May 16, 2012 2:13 pm

Re: Introduction and Bearing Creator Tool

Postby mario52 » Mon Sep 23, 2013 8:49 am

Hello
your code is not cause I can't do sphere nor tore may be due to my system ?? Vista, FreeCAD 0.13, 0.14
I did not reply on this malfunction
Mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Dialog creation. My macros on Gist.github.
jreinhardt
Posts: 329
Joined: Mon Sep 09, 2013 6:08 pm

Re: Introduction and Bearing Creator Tool

Postby jreinhardt » Mon Sep 23, 2013 11:46 am

In cooperation with javiermg, I now added the bearing collection to BOLTS. http://jreinhardt.github.io/BOLTS/html/ ... 625-1.html

I have two screenshots about the current state of the BOLTS UI. The first one shows the Widget on the right with the treeview of available collections and standards, and the result of clicking on the Add Part Button. The second shows the available choices for the dropdown list. For each selection the inner and outer diameters and the thickness is automatically chosen. Which one to choose the user will have to look up on the

http://ist-dein-freund.de/FreeCAD-BOLTS ... Widget.png
http://ist-dein-freund.de/FreeCAD-BOLTS ... opdown.png

We will continue to try to add more types of bearings, so if anyone knows a source where dimensions of standard bearings can be found, that would be helpful. For the single row radial bearings DIN625-1 I got the dimensions from
http://www.kgm-kugeln.de/show.php?ID=45 ... 9f85163af0

Javier mentioned, that he will try for axial trust bearings next.
BOLTS, standard parts library for FreeCAD Thread, Help with Translation
User avatar
yorik
Site Admin
Posts: 11686
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Introduction and Bearing Creator Tool

Postby yorik » Mon Sep 23, 2013 1:44 pm

Excellent! It's becoming very complex. Congrats!
We should add your plugin to the wiki...
mario52
Posts: 2847
Joined: Wed May 16, 2012 2:13 pm

Re: Introduction and Bearing Creator Tool

Postby mario52 » Mon Sep 23, 2013 1:51 pm

hi
SKF naturally
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Dialog creation. My macros on Gist.github.
jreinhardt
Posts: 329
Joined: Mon Sep 09, 2013 6:08 pm

Re: Introduction and Bearing Creator Tool

Postby jreinhardt » Mon Sep 23, 2013 2:42 pm

yorikvanhavre wrote:Excellent! It's becoming very complex. Congrats!
We should add your plugin to the wiki...
I would like to wait a bit with that. I am currently still figuring out a lot of fundamental organisation issues, so things are changing rapidly under the hood. Until this has stabilized, I would prefer to just have a few people that try it from time to time.
BOLTS, standard parts library for FreeCAD Thread, Help with Translation
User avatar
yorik
Site Admin
Posts: 11686
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Introduction and Bearing Creator Tool

Postby yorik » Mon Sep 23, 2013 2:50 pm

No problem! Your baby ;)
javiermg
Posts: 7
Joined: Mon Aug 12, 2013 11:04 am

Re: Introduction and Bearing Creator Tool

Postby javiermg » Mon Sep 23, 2013 3:59 pm

As jreinhardt said, there is a new function that generates axial thrust bearings:

Code: Select all

import Part
import math

def ATB(rout,rin, bth):
  fth=0.3*bth  #Thrust plate widh 
  #Edge fillet value 
  if rout<70:
    RR=1
  else:
    RR=1.5
  #shapes--
  #shapes=[]
  #Lower ring--------------------------
  lr1=Part.makeCylinder(rout,fth)
  lr2=Part.makeCylinder(rin,fth)
  lr=lr1.cut(lr2)
  lre=lr.Edges
  lr=lr.makeFillet(RR,lre)
  #Upper ring--------------------------
  ur1=Part.makeCylinder(rout,fth)
  ur2=Part.makeCylinder(rin,fth)
  ur=ur1.cut(ur2)
  ure=ur.Edges
  ur=ur.makeFillet(RR,ure)
  #Positioning Vector
  Vur=(0,0,bth-fth)
  ur.translate(Vur)
  #Balltracks---------------------------
  tbigradius=((rout-rin)/2.00)+rin
  tsmradius=(bth/2.00)-(0.75*fth)
  Vtorus=(0,0,bth/2.00)
  torus=Part.makeTorus(tbigradius,tsmradius)
  #Positioning vector
  torus.translate(Vtorus)
  #Booleans------------------------------
  lr=lr.cut(torus)
  ur=ur.cut(torus)
  Part.show(lr)
  Part.show(ur) 
  #shapes.append(ur)
  #shapes.append(lr)
  #Balls--------------------------------
  RBall=tsmradius
  CBall=tbigradius
  #Ball number (constant multiplied by radius and rounded)
  NBall=(2*math.pi*CBall)/(2*RBall)
  NBall=math.floor(NBall)
  NBall=NBall*0.9 
  NBall=int(NBall)
  #Ball creator
  for i in range (NBall):  
    Ball=Part.makeSphere(RBall)
    Alpha=(i*2*math.pi)/NBall  
    BV=(CBall*math.cos(Alpha),CBall*math.sin(Alpha),bth/2.00) 
    Ball.translate(BV) 
    Part.show(Ball)
    #shapes.append(Ball)
    
  #BearingAT=Part.Compund(shapes)
  #Part.show(BearingAT)
  Gui.SendMsgToActiveView("ViewFit")
  
Simply type: ATB(outer radius, inner radius, bearing widh), and something should appear.

Some details:
-Balls are generated automatically with a function that measures how many of them will fit, and rounding down that number to assure that there is certain clearance between them.
-The disk thickness is also a proportion of the total bearing thickness.
-Disk fillet is 1 to bearings with an outer radius less than 110 units and 1.5 to bigger than this bearings. Just aesthetics.

Issues:
-Bearings take up to 7 seconds to generate. I don't know if this is normal.
-I have not succeed at creating shapes, the steps are commented at code. I am not seeing what is wrong.

jreinhardt, I will take a look a github later and see how can I code to make it easier to you.

My purpose to this bearings is that they should provide of exact external measures and a model to get an idea of the whole thing, but without focusing at internals or hyper-realistic looks.
So this is the explanation to not have ball cage and other minor aspects. Do you agree with that point of view?

Tell me anything about it, if you don't like, is not working, is horrible... Without problems.

Regards, Javier.