instancezero / in3dca-freegrid

FreeCAD macros for the FreeGrid 3D printed storage system
GNU Affero General Public License v3.0
25 stars 4 forks source link

Perhaps this should be added to the FreeCAD macros repo or even turned in to a small workbench? #1

Closed luzpaz closed 2 months ago

luzpaz commented 2 years ago

Available through the Addon Manager

instancezero commented 2 years ago

That's an interesting idea, thanks! At this point I've barely picked up enough Python to get the macro to work so a full workbench is something I'd need to put a fair bit of effort into. I can see how a workbench would be useful. At the moment I'm putting my energies into making new modules for the system so I can actually get back to organizing my shop. Maybe once that's under control I'll take a look at what needs to be done.

johnsonm commented 2 years ago

Because this is already really a module with multiple files rather than a single python file to drop into the Macros directory, I'd suggest that the best way is a full workbench, which might make the UI easier anyway.

https://wiki.freecadweb.org/Workbench_creation

The worst part is probably inventing icons for the actions. The tabs in the current interface would probably be workbench buttons, so right now that would be three buttons.

luzpaz commented 2 years ago

If you need custom icons, best place to ask is on the UI/UX subforum. There should be a volunteer or 2 that are willing to help.

johnsonm commented 2 years ago

Following up from some twitter conversation just for a more durable record of ideas and not to direct...

It sounds like the tabs in the existing window could be tools in a small toolbar for a workbench.

Typically, those would also be menu items in an eponymous menu, which could also be the context menu in this case; at least, no other use for the context menu comes to mind.

For icons, I suppose you would need an icon for the workbench itself, and for each of the three or four tools.

Then I think that the contents of the FreeCAD-Macros directory would move up a level along with modifying them to implement a WB.

I noticed this in the Workbench page:

You can choose any license you like for your workbench, but be aware that if you wish to see your workbench integrated into and distributed with the FreeCAD source code at some point, it needs to be LGPL2+ like the example above. See Licence.

I want to be clear that if you decide to relicense under LGPL2+ for maximum compatibility, my minimal contributions can be relicensed. No pressure, only opportunity.

instancezero commented 2 years ago

For sure if/when it becomes a workbench, lessening the AGPL restriction to LGPL2+ is no problem. I've fought that war before and am not interested in repeating it, although personally I think if you're not going with [A]GPL3 you might as well go with MIT. The nuances in between are too hard for most to really grasp. Either way, thanks for the flexibility!

johnsonm commented 2 years ago

OK, I'm cool with MIT as well, really any Open Source license. :+1:

GAZ082 commented 1 year ago

Hello. Just came to say, please put this into the FC Macros repo. Love <3

hasecilu commented 1 year ago

Hi, I don't know if somebody already made some advancements, but I recently started the FreeGrid WB, the parts are put in the tree with their properties but still no part is generated.

Would you prefer to make another repo or just another branch?

instancezero commented 1 year ago

I did some very minor work toward a WB, then my 5 month load factor went to 4.5 and it looks like it will be pegged there for a while. I know @johnsonm did some work along those lines too. I'm thinking I should give you both write access and watch, then we can work on a branch.

instancezero commented 1 year ago

One of the things I'd like to do is have some sort of configuration selector. While changes in things like magnet size (or even base grid size) are useful, one of the good things about "a system" is that someone who downloads a STL can have a reasonable expectation that it's going to work with other FreeGrid components. Obviously, someone who picks a different grid size is going to produce stuff that doesn't fit a 50mm grid. Maybe if people could share config files (in JSON or the like) that would make it easier to ensure there was some compatibility.

Although I recognize the limitations and don't object to the pull requests here, One of the reasons for having a 10 mm unit height was so that people could check "with lid" and have the height adjust down to account for the lid, leaving the final box at n * 10mm height. This is in part down to my use case, where I need to be able to stack things... having them all a multiple of 10mm makes that much easier.

hasecilu commented 1 year ago

One of the things I'd like to do is have some sort of configuration selector. While changes in things like magnet size (or even base grid size) are useful, one of the good things about "a system" is that s.omeone who downloads a STL can have a reasonable expectation that it's going to work with other FreeGrid components. Obviously, someone who picks a different grid size is going to produce stuff that doesn't fit a 50mm grid. Maybe if people could share config files (in JSON or the like) that would make it easier to ensure there was some compatibility.

Sure, having a standard helps everyone sharing its parts and I think it's good that few variables are hard-coded and not exposed to the user. Changing the grid would be a major breaking change in the system, like creating a mini-grid system or a mega-grid system.

Although I recognize the limitations and don't object to the pull requests here, One of the reasons for having a 10 mm unit height was so that people could check "with lid" and have the height adjust down to account for the lid, leaving the final box at n * 10mm height. This is in part down to my use case, where I need to be able to stack things... having them all a multiple of 10mm makes that much easier.

I made one last commit the let the user choose their height unit, if no unit is entered the Z height unit is assumed. But still now, user can enter a length unit.

johnsonm commented 1 year ago

I really like the non-default option to set the height in explicit units, because I have shop drawers of different heights, several of which are fairly low-profile.

I don't remember my work on a workbench being substantial. I would definitely suggest working in a branch rather than a new repository. Even if we have to move files around to make it easy to integrate with the workbench manager, Git will do a good job of tracking that and showing the history. Ultimately, this code will be more discoverable and usable presented as a workbench.

I'm no FreeCAD expert. I'm mostly a FreeCAD user with a long history of Python development. Happy to help contribute where I can, but I know that I can't lead building a workbench right now. I love the direction you are going with making it a properly parametric workbench — it's far better than the simplistic ideas I had last year... :heart:

hasecilu commented 1 year ago

I don't remember my work on a workbench being substantial. I would definitely suggest working in a branch rather than a new repository. Even if we have to move files around to make it easy to integrate with the workbench manager, Git will do a good job of tracking that and showing the history. Ultimately, this code will be more discoverable and usable presented as a workbench.

I uploaded the code to the WorkBench branch, all the file structure is based on the FreeCAD workbench starter kit, I just populated it with the FreeGrid files and a few more changes.

Also I'm pretty new with the FreeCAD codebase, once I get the properties of the files updating the part we can start thinking in new features =).

hasecilu commented 10 months ago

After studying the code of Fasteners WB, Gears WB and the starter-kit I finally get to a working WB.

Pretty much all is working but still not 1:1 to the macro.

Check it here: https://github.com/instancezero/in3dca-freegrid/tree/WorkBench

image

Box

Grid

Sketch

hasecilu commented 10 months ago

Hi, I added the sketch generatation to the WB, now I think it's all finished. The only that's different is the Generate as components option, since this WB creates parametric objects of its class, it could not then take control of all those generic objects.

If you can test the WB to confirm, it's fine (works on my :desktop_computer: ). Any suggestions to change something?

Btw, the icons are just view from Tech Draw WB exported to dxf, in edited on Inkscape, so if you see them at detail they aren't very pretty, if someone wants to make a better ones. I just remembered! The WB logo is a red square :red_square: :fearful:

https://github.com/instancezero/in3dca-freegrid/tree/WorkBench

Below is the proposed package.xml file.

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<package format="1" xmlns="https://wiki.freecad.org/Package_Metadata">
  <name>FreeGrid Workbench</name>
  <description>A simple tools workbench for generating FreeGrid storage system components.</description>
  <tag>storage</tag>
  <tag>parametric</tag>
  <version>2.0.0</version>
  <date>2024-01-15</date>
  <author>Alan Langford</author>
  <maintainer email="">Alan Langford</maintainer>
  <maintainer email="">Michael K Johnson</maintainer>
  <maintainer email="hasecilu@tuta.io">hasecilu</maintainer>
  <license file="LICENSE">AGPL-3.0 license</license>
  <pythonmin>3.6.0</pythonmin>
  <url type="repository" branch="WorkBench">https://github.com/instancezero/in3dca-freegrid</url>
  <url type="readme">https://github.com/instancezero/in3dca-freegrid/blob/WorkBench/README.md</url>
  <icon>freecad/freegrid/resources/icons/FreeGrid.svg</icon>

  <content>
    <workbench>
      <classname>FreeGridWorkbench</classname>
    </workbench>
  </content>

</package>
johnsonm commented 10 months ago

I finally got a chance to test this out. Nice work!

Box height 0 for a flat base with no walls doesn't seem to work right. I don't see any difference between a height of 0mm and a height of 10mm. Height of 0 is to make bases to mount things on.

The isSubstractive setting should be isSubtractive — I see you have this typo also elsewhere. git grep -i substract and change "substract" to "subtract" (remove the second s)

hasecilu commented 10 months ago

Hi, I have fixed the typo. Regarding the box height: On FreeGridCmd.py file, generate_box() method I clamped the value to be greater than 10 because I detected than when value was 3mm or less the upper borders of the box traspass the bottom modifying the base that would prevent a good fit.

        z = max(10, obj.height.getValueAs('mm'))

image

The whole profile is made in a single pass and when $$height>6.3[mm]$$ the geometry breaks.

I'll try splitting in 3 parts and then fuse. image

luzpaz commented 2 months ago

Really nice work here. Bravo!

hasecilu commented 2 months ago

Officially it's available on FreeCAD! :tada:

image