Introduction and Bearing Creator Tool

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
javiermg
Posts: 7
Joined: Mon Aug 12, 2013 11:04 am

Re: Introduction and Bearing Creator Tool

Post by javiermg »

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
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Introduction and Bearing Creator Tool

Post by NormandC »

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

Post by javiermg »

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

Re: Introduction and Bearing Creator Tool

Post by mario52 »

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, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
jreinhardt
Posts: 329
Joined: Mon Sep 09, 2013 6:08 pm

Re: Introduction and Bearing Creator Tool

Post by jreinhardt »

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
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Introduction and Bearing Creator Tool

Post by yorik »

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

Re: Introduction and Bearing Creator Tool

Post by mario52 »

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

Re: Introduction and Bearing Creator Tool

Post by jreinhardt »

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
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Introduction and Bearing Creator Tool

Post by yorik »

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

Re: Introduction and Bearing Creator Tool

Post by javiermg »

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.
Post Reply