A toy brick macro

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
vectronic
Posts: 52
Joined: Sun Feb 18, 2018 9:44 pm

A toy brick macro

Post by vectronic »

Hello All,

I've been working on this macro for a while with the following aims:

  • Get to grips with FreeCAD and concepts for parametric modelling: sketches, constraints, datum planes etc.
  • Use Python scripting with FreeCAD
The real challenge I gave myself was to use Python scripting with the PartDesign workbench: I wanted to end up with a parametric model fully based on sketches and datum planes.

I've learnt and discovered various things on this journey:

Example images below. Check it out and let me know what you think!

The latest macro code, brief overview and instructions are available at:

https://github.com/vectronic/freecad-legify-macros

The very first v0.1.0 cut is available at:

https://github.com/vectronic/freecad-le ... tag/v0.1.0

Image
Image
Image
Image
Image
User avatar
roerich_64
Veteran
Posts: 1465
Joined: Thu May 21, 2015 7:00 pm
Location: Ostfriesland

Re: A toy brick macro

Post by roerich_64 »

Wow, a children's dream comes true :)

Thanks for sharing :)

Can we have a look to the tree view?

BR
Walter
Die Liebe wird siegen, denn sie ist unzerstörbar :) ;)
vectronic
Posts: 52
Joined: Sun Feb 18, 2018 9:44 pm

Re: A toy brick macro

Post by vectronic »

With pleasure :-)

Image
User avatar
fosselius
Posts: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

Re: A toy brick macro

Post by fosselius »

Awesome! I am going to build a WB for building legos, is it ok if i include your script as well?

I am building a parts library for lego pieces.
See end of this thread: https://forum.freecadweb.org/viewtopic.php?f=10&t=11610
vectronic
Posts: 52
Joined: Sun Feb 18, 2018 9:44 pm

Re: A toy brick macro

Post by vectronic »

fosselius wrote: Mon Jan 21, 2019 3:25 pm Awesome! I am going to build a WB for building legos, is it ok if i include your script as well?
I like what you have done!

You are absolutely welcome to make use of this if you wish.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: A toy brick macro

Post by Zolko »

vectronic wrote: Fri Jan 18, 2019 11:42 pm I've been working on this macro for a while
Check it out and let me know what you think!
nice ! But side holes don't work for me, only side studs.

Legify.png
Legify.png (340.75 KiB) Viewed 5058 times
try the Assembly4 workbench for FreCAD — tutorials here and here
vectronic
Posts: 52
Joined: Sun Feb 18, 2018 9:44 pm

Re: A toy brick macro

Post by vectronic »

Sorry, should have pointed to the TODO items from the readme in GitHub:

https://github.com/vectronic/freecad-legify-macros#todo

  • Confirm some dimensions
  • Pin Rendering
  • Technic Hole Rendering
  • Support modern tile where the bottom has a small outside pocket (and check if fillet is also required)
  • Support rib variation in modern 2x1 tile and 2x1 technic brick with 2 non-offset holes
  • Determine a replacement for internal brick ribs if side hole studs exist
  • Determine if the inner edge of open studs and hole studs should be filleted
Hoping to tackle the first 3 in the next month or so...
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: A toy brick macro

Post by Zolko »

vectronic wrote: Wed Jan 30, 2019 10:03 am
  • Technic Hole Rendering
... this —> please
try the Assembly4 workbench for FreCAD — tutorials here and here
vectronic
Posts: 52
Joined: Sun Feb 18, 2018 9:44 pm

Re: A toy brick macro

Post by vectronic »

Initial version of technic holes has been pushed to GitHub, together with some bug fixes and cleanups. Correct measurements for some of the hole features are pending as well as support for axle-shaped holes...
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: A toy brick macro

Post by Zolko »

vectronic wrote: Mon Feb 18, 2019 9:35 am Initial version of technic holes has been pushed to GitHub
nice ... and what's more, it's completely compatible with the my Assembly Without Solver. I'm thinking about launching a Lego challenge

Legify_v0.2.png
Legify_v0.2.png (325.18 KiB) Viewed 4323 times
try the Assembly4 workbench for FreCAD — tutorials here and here
Post Reply