A toy brick macro

Show off your FreeCAD projects here!
vectronic
Posts: 23
Joined: Sun Feb 18, 2018 9:44 pm

A toy brick macro

Postby vectronic » Fri Jan 18, 2019 11:42 pm

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
Posts: 670
Joined: Thu May 21, 2015 7:00 pm

Re: A toy brick macro

Postby roerich_64 » Sat Jan 19, 2019 9:18 am

Wow, a children's dream comes true :)

Thanks for sharing :)

Can we have a look to the tree view?

BR
Walter
vectronic
Posts: 23
Joined: Sun Feb 18, 2018 9:44 pm

Re: A toy brick macro

Postby vectronic » Sun Jan 20, 2019 9:13 pm

With pleasure :-)

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

Re: A toy brick macro

Postby fosselius » 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 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: 23
Joined: Sun Feb 18, 2018 9:44 pm

Re: A toy brick macro

Postby vectronic » Mon Jan 21, 2019 9:51 pm

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.
Zolko
Posts: 254
Joined: Mon Dec 17, 2018 10:02 am

Re: A toy brick macro

Postby Zolko » Tue Jan 29, 2019 12:27 pm

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 1894 times
vectronic
Posts: 23
Joined: Sun Feb 18, 2018 9:44 pm

Re: A toy brick macro

Postby vectronic » Wed Jan 30, 2019 10:03 am

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...
Zolko
Posts: 254
Joined: Mon Dec 17, 2018 10:02 am

Re: A toy brick macro

Postby Zolko » Wed Jan 30, 2019 12:28 pm

vectronic wrote:
Wed Jan 30, 2019 10:03 am
  • Technic Hole Rendering
... this —> please
vectronic
Posts: 23
Joined: Sun Feb 18, 2018 9:44 pm

Re: A toy brick macro

Postby vectronic » Mon Feb 18, 2019 9:35 am

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...
Zolko
Posts: 254
Joined: Mon Dec 17, 2018 10:02 am

Re: A toy brick macro

Postby Zolko » Tue Feb 19, 2019 7:42 pm

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 1159 times