Part-o-magic: Active Part/Body reinvented
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Part-o-magic: Active Part/Body reinvented
================================
THIS IS AN OLD THREAD ABOUT PART-O-MAGIC THAT SHOULD DIE. PLEASE POST TO A NEW THREAD, OR TO
https://forum.freecadweb.org/viewtopic.php?t=20698
================================
Hi!
I have mocked up a Py script of automated management of object visibility, selectability and addition with heavy interaction with active Part and active Body.
https://github.com/DeepSOIC/Part-o-magic
Install:
Install as a workbench. That is, in Path/To/FreeCAD/Mod, create a directory named Part-o-matic, and put the three .py files of the repository into there. Restart FreeCAD.
Features:
* Nested Part containers creation (from PartDesign wb)
* automatic addition of all new objects (from all workbenches) to active Part
* automatic visibility: when activating a Part/Body, all objects outside are hidden; origin of active part/body is automatically shown. To show the whole document, deactivate part/body.
* automatic selectability: objects not directly in active part are not selectable in 3d view (but not hidden automatically). This prevents accidental cross-container links. Bodies are automatically switched to Tip display mode when not active, so their final shape is selectable.
Limitations/ known bugs:
* objects sometimes appear not being added to active Part. Force recompute should deal with it.
* when document is saved and there is an active object, visibility magic will be broken a little bit on re-opening. So, before saving - deactivate all active parts! (almost fixed)
* will be confused by Groups (probably; untested)
* sketches contained in nested Parts with non-zero placements behave incorrectly when editing. (FreeCAD problem, not Part-o-magic's)
I think this can be considered a goal, or a teaser, for PartDesign/FreeCAD Next development. I would love to hear some opinions. Nonetheless, Part-o-magic can potentially be used for making actual projects!
THIS IS AN OLD THREAD ABOUT PART-O-MAGIC THAT SHOULD DIE. PLEASE POST TO A NEW THREAD, OR TO
https://forum.freecadweb.org/viewtopic.php?t=20698
================================
Hi!
I have mocked up a Py script of automated management of object visibility, selectability and addition with heavy interaction with active Part and active Body.
https://github.com/DeepSOIC/Part-o-magic
Install:
Install as a workbench. That is, in Path/To/FreeCAD/Mod, create a directory named Part-o-matic, and put the three .py files of the repository into there. Restart FreeCAD.
Features:
* Nested Part containers creation (from PartDesign wb)
* automatic addition of all new objects (from all workbenches) to active Part
* automatic visibility: when activating a Part/Body, all objects outside are hidden; origin of active part/body is automatically shown. To show the whole document, deactivate part/body.
* automatic selectability: objects not directly in active part are not selectable in 3d view (but not hidden automatically). This prevents accidental cross-container links. Bodies are automatically switched to Tip display mode when not active, so their final shape is selectable.
Limitations/ known bugs:
* objects sometimes appear not being added to active Part. Force recompute should deal with it.
* when document is saved and there is an active object, visibility magic will be broken a little bit on re-opening. So, before saving - deactivate all active parts! (almost fixed)
* will be confused by Groups (probably; untested)
* sketches contained in nested Parts with non-zero placements behave incorrectly when editing. (FreeCAD problem, not Part-o-magic's)
I think this can be considered a goal, or a teaser, for PartDesign/FreeCAD Next development. I would love to hear some opinions. Nonetheless, Part-o-magic can potentially be used for making actual projects!
Last edited by DeepSOIC on Wed Jan 08, 2020 4:51 pm, edited 1 time in total.
Re: Part-o-magic: Active Part/Body reinvented
A small hiccup during install, cloned your gist into /Mod and had to rename initGui.py to InitGui.py for FreeCAD to recognize the add-on.
OS: "Arch Linux"
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7613 (Git)
Build type: Unknown
Branch: master
Hash: 4d8f338b8d1de52e0a41abbdec88b87c7e13b0c2
Python version: 2.7.11
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 6.9.1
OS: "Arch Linux"
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7613 (Git)
Build type: Unknown
Branch: master
Hash: 4d8f338b8d1de52e0a41abbdec88b87c7e13b0c2
Python version: 2.7.11
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 6.9.1
Need help? Feel free to ask, but please read the guidelines first
Re: Part-o-magic: Active Part/Body reinvented
This is very nice, DeepSOIC big improvement in the usability department.
I can also not seem to be able to nest Parts, creating a new part puts it on top of tree, and dragging a part over an existing part does show red icon for not allowed.
Having two bodies in one part, I can not manage to get visibility on both bodies at the same time.
Give me a shout, when you want more bug reporting!
OS: "Arch Linux"
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7613 (Git)
Build type: Unknown
Branch: master
Hash: 4d8f338b8d1de52e0a41abbdec88b87c7e13b0c2
Python version: 2.7.11
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 6.9.1
I do not seem to be able to add any objetct to a part, whenever i pick additive object it gets putt in the active body, can not seem to deactivate active body.DeepSOIC wrote:objects are sometimes not added to active Part. Actually, they always are, but FreeCAD doesn't update the nesting properly. Force recompute should deal with it.
I can also not seem to be able to nest Parts, creating a new part puts it on top of tree, and dragging a part over an existing part does show red icon for not allowed.
Having two bodies in one part, I can not manage to get visibility on both bodies at the same time.
Well I think you are correct, guess it is a bit early for bug hunting season.DeepSOIC wrote:very raw. may be very buggy.
Give me a shout, when you want more bug reporting!
OS: "Arch Linux"
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7613 (Git)
Build type: Unknown
Branch: master
Hash: 4d8f338b8d1de52e0a41abbdec88b87c7e13b0c2
Python version: 2.7.11
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 6.9.1
Need help? Feel free to ask, but please read the guidelines first
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Part-o-magic: Active Part/Body reinvented
Will fix...., thanks for reporting.cox wrote:A small hiccup during install, cloned your gist into /Mod and had to rename initGui.py to InitGui.py for FreeCAD to recognize the add-on.
So, probably all these problems are caused by the inability of the thing to deactivate a body. It is simply impossible, and as I said, bugfix is in pull request.cox wrote:I do not seem to be able to add any objetct to a part, whenever i pick additive object it gets putt in the active body, can not seem to deactivate active body.I can also not seem to be able to nest Parts, creating a new part puts it on top of tree
You may get some of the Part nesting to work if you don't add any PartDesign Bodies. But I advise wait for the merge (or build it ). For me, it works quite well as of now.
Re: Part-o-magic: Active Part/Body reinvented
FYI: Looks like the travis build of your pull request has timed out an failed.DeepSOIC wrote:But I advise wait for the merge
- Attachments
-
- Screenshot_20160521_120101.png (10.15 KiB) Viewed 7305 times
Need help? Feel free to ask, but please read the guidelines first
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Part-o-magic: Active Part/Body reinvented
I've seen it. It's second time in a row But it was almost there, so I guess that can be interpreted as "built fine, but not unit-tested".cox wrote:FYI: Looks like the travis build of your pull request has timed out an failed.
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Part-o-magic: Active Part/Body reinvented
Demo project!
EDIT: ported project to extension era of containers
Made with almost pure PartDesign. There are a few stand-alone sketches, and one Draft Clone. I had to use Py console once, to get ShapeBinder005 outside of body.
Uses almost no expressions (there is only one). All alignment done using geometry links to shapebinders of master sketches. This is my typical workflow (use of master sketches), that now comes to a whole new level.
Made with:
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7633 (Git)
Build type: Debug
Branch: NewBodyFixes + Part-o-magic rev.7 installed
Hash: 739509aadc5f155bcc3c44bc9b324929c6163e35
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1
Some things I noted during making of this demo project:
1. It'd be nice to be able to place shapebinders outside of bodies.
2. Datum planes often end up having zero size (makes them look like a line). That is annoying.
3. In Sketcher, if I add a symmetry constraint, all other constraint symbols become invisible. I don't think it is related to nested Parts, I'll try to reproduce it in a simple test project.
4. I really really missed the Boolean Common operation in some bodies (core of the rotor is a good example). That makes me want to experiment with adding Part objects to bodies.
Made with almost pure PartDesign. There are a few stand-alone sketches, and one Draft Clone. I had to use Py console once, to get ShapeBinder005 outside of body.
Uses almost no expressions (there is only one). All alignment done using geometry links to shapebinders of master sketches. This is my typical workflow (use of master sketches), that now comes to a whole new level.
Made with:
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7633 (Git)
Build type: Debug
Branch: NewBodyFixes + Part-o-magic rev.7 installed
Hash: 739509aadc5f155bcc3c44bc9b324929c6163e35
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1
Some things I noted during making of this demo project:
1. It'd be nice to be able to place shapebinders outside of bodies.
2. Datum planes often end up having zero size (makes them look like a line). That is annoying.
3. In Sketcher, if I add a symmetry constraint, all other constraint symbols become invisible. I don't think it is related to nested Parts, I'll try to reproduce it in a simple test project.
4. I really really missed the Boolean Common operation in some bodies (core of the rotor is a good example). That makes me want to experiment with adding Part objects to bodies.
Last edited by DeepSOIC on Wed Nov 29, 2017 6:20 pm, edited 1 time in total.
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Part-o-magic: Active Part/Body reinvented
Exploded view. Made by simply editing placements of some parts and bodies.
Note. This GREATLY benefits from what is currently considered a fundamental bug: placements of containers are not considered in geometry links. Maybe it should be left as-is??- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Part-o-magic: Active Part/Body reinvented
Did experiments on adding Part stuff to bodies. I can force the body to parent a Part feature, but the problem is that Body fails to recompute if I set its Tip to point to a Part feature. And that makes it pointless to use Body, because without Tip and display mode support, Body is no better than Part.DeepSOIC wrote:4. I really really missed the Boolean Common operation in some bodies (core of the rotor is a good example). That makes me want to experiment with adding Part objects to bodies.
Hacking it is probably a matter of changing a few lines of C++ code, but that will lock me in to my own branch again.. So I don't know...
EDIT: I'm hacking it as an experiment. But I think I will bother making a Part::BodyBase functional instead and add a command for it in Part workbench.
Re: Part-o-magic: Active Part/Body reinvented
Sounds interesting. As i don't yet use development release i will test the module at some point in the future.