boxcreator on Freecad 0.18

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Syres
Veteran
Posts: 2891
Joined: Thu Aug 09, 2018 11:14 am

Re: boxcreator on Freecad 0.18

Post by Syres »

chrisb wrote: Sun Jun 30, 2019 12:53 pm
Syres wrote: Sun Jun 30, 2019 10:53 amI believe the reason for new users (or those of us who never had the macro) not seeing macros such as this one is that they must have an entry in the Wiki
There must be another reason, because I do see it in the Addonmanager's list.
I've read the code more thoroughly and the first step, it tries to use GitPython which I would guess at least 75% of Windows users wouldn't have installed and then it uses the Wiki so I'm guessing you are running GitPython. The code section in addonmanager_workers.py I'm referring to is:

Code: Select all

    def run(self):

        """Populates the list of macros"""

        self.retrieve_macros_from_git()
        self.retrieve_macros_from_wiki()
        [self.add_macro_signal.emit(m) for m in sorted(self.macros, key=lambda m: m.name.lower())]
        if self.macros:
            self.info_label_signal.emit(translate('AddonsInstaller', 'List of macros successfully retrieved.'))
        self.progressbar_show.emit(False)
        self.stop = True

    def retrieve_macros_from_git(self):

        """Retrieve macros from FreeCAD-macros.git

        Emits a signal for each macro in
        https://github.com/FreeCAD/FreeCAD-macros.git
        """

        try:
            import git
        except ImportError:
            self.info_label_signal.emit("GitPython not installed! Cannot retrieve macros from Git")
            FreeCAD.Console.PrintWarning(translate('AddonsInstaller', 'GitPython not installed! Cannot retrieve macros from git')+"\n")
            return
OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17171 (Git)
Build type: Release
Branch: master
Hash: d19470a9711ea604f3ca6c93e46afadf64d5bb87
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Re: boxcreator on Freecad 0.18

Post by chrisb »

I'm on a Mac and have indeed Git installed. So I think you are right with your assumption.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
UR_
Veteran
Posts: 1354
Joined: Tue Jan 03, 2017 8:42 pm

Re: boxcreator on Freecad 0.18

Post by UR_ »

windows conda builds and LP 12.1.2 builds have gitpython in their package

.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: boxcreator on Freecad 0.18

Post by jmaustpc »

Syres wrote: Mon Jul 01, 2019 10:34 am it tries to use GitPython
Now that you mention it, Yorik did say something about python-git, I had forgotten.
Package name in Ubuntu is python-git for Python2 and python3-git for Python 3.
User avatar
christi
Posts: 200
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: boxcreator on Freecad 0.18

Post by christi »

TheMarkster wrote: Mon Jul 01, 2019 7:10 am That's a neat macro. Only one problem -- those box joints are going to be mighty tight come assembly time. Of course, if you print with ABS and use acetone it will probably still be able to go together as the acetone dissolves some of the material.
You can use the 3D Offset tool from the Part workbench to shrink the sides of the box. Enter a negative value for offset parameter.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: boxcreator on Freecad 0.18

Post by TheMarkster »

UR_ wrote: Sun Jun 30, 2019 2:52 pm
Edit:
yorik wrote: *ping*
i had to add to ...\Mod\AddonManager\addonmanager_utilities.py, line 27

Code: Select all

import shutil
to make install of macro working
I already have another trivial addonmanager bugfix PR pending. I will add UR_'s fix for this bug to it, too.

https://github.com/FreeCAD/FreeCAD/pull/2304
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: boxcreator on Freecad 0.18

Post by TheMarkster »

christi wrote: Mon Jul 01, 2019 4:07 pm You can use the 3D Offset tool from the Part workbench to shrink the sides of the box. Enter a negative value for offset parameter.
Thank you. Yes, that is a good tool for this. I have another way that has more work involved, but has the advantage of allowing us better control over which faces get cut into.

This macro makes extrude compatible face objects from all selected faces. To use is very simple (though somewhat tedious with many faces). Just select your faces, then run the macro.

Code: Select all

"""
CopyFaces Macro, by TheMarkster
Creates a simple non-parametric face object from each selected face.  This face object can be extruded.
Can even extrude all of them in one go via Part -> Extrude.  It is suggested to
make the Extrude symmetric for more predictable results.

"""

import FreeCAD
import Draft

selobj = FreeCAD.Gui.Selection.getSelectionEx()
if len(selobj)>=1:
    faces=FreeCAD.Gui.Selection.getSelectionEx()[0].SubObjects
else:
    FreeCAD.Console.PrintError("Select some faces and try again.")

for f in faces:
    w = Draft.makeWire(f)
    App.ActiveDocument.recompute()
    face = Draft.downgrade(App.ActiveDocument.ActiveObject)

App.ActiveDocument.recompute()
You will find in the tree view now some new objects Face, Face001, Face002, etc. Select them in the tree and run the Part -> Extrude on them. Set symmetric checkbox so you don't get some of the faces extruded in the wrong direction from what you intend. Fuse the Extrude objects, then cut the Fuse from the object to trim away some of each face (or Fuse to the object if you want to pad the faces instead of cut them).

In the video notice I only select the interior faces on the side because I don't want to cut deeper that other face. I just want to more easily be able to assemble the box.

Also note that I have my settings to have refine turned off, so where the cut is made there are some tiny extra faces showing. These won't be there if you refine set to true.

phpBB [video]
harlekin
Posts: 19
Joined: Wed May 13, 2015 8:52 pm

Re: boxcreator on Freecad 0.18

Post by harlekin »

This is the versione i work with:

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16117 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: dbb4cc6415bac848a294f03b80f65e888d531742
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)

thank you again
blue0cean
Posts: 508
Joined: Tue Feb 19, 2019 2:31 pm
Location: Bayern

Box Creator Script

Post by blue0cean »

cool, thanks. Works.
Unfortunately, a bug has crept in. Partitions can only be inserted in x or y. If you started with x, the following error occurs when inserting the y wall:
<Exception> Wire is not closed.
155.123 <App> Document.cpp (3738): Failed to recompute Unnamed # bottom: Wire is not closed.
Recompute failed! Please check report view.

or is that not allowed?
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21775 (Git)
Build type: Release
Branch: master
Hash: 1f741aa511e898849e46ed14515fce416fe32acb
Python version: 3.8.2
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: German/Germany (de_DE)
2020-07-03 11_15_41-Window.jpg
2020-07-03 11_15_41-Window.jpg (197.48 KiB) Viewed 928 times
Attachments
BoxCreator.FCStd
(197.09 KiB) Downloaded 51 times
User avatar
christi
Posts: 200
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Box Creator Script

Post by christi »

blue0cean wrote: Fri Jul 03, 2020 9:21 am cool, thanks. Works.
Unfortunately, a bug has crept in. Partitions can only be inserted in x or y. If you started with x, the following error occurs when inserting the y wall:
<Exception> Wire is not closed.
155.123 <App> Document.cpp (3738): Failed to recompute Unnamed # bottom: Wire is not closed.
Recompute failed! Please check report view.
The problem are overlapping holes in the bottom.
Image

While I do not find a solution for this, you can delete one of the holes manually, or use a different offset for the compartment to get the hole generated in between the other holes.
Post Reply