Draft AutoGroup

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Draft AutoGroup

Post by yorik »

In git commit 9a6191f572 the Draft workbench now has an additional feature, auto-grouping, that was in the plans since along time, rockn actually developed some of it, and I finally finished it.
Draft_AutoGroup.jpg
Draft_AutoGroup.jpg (64.68 KiB) Viewed 5345 times
It's pretty simple: There is a new button in the Draft toolbar that says "None" by default. If you have any Group object in the document (or derived from Group, or Arch Site, Arch Building or Arch Floor), you can press the button, and select any of them. You can do that also by right-clicking one of them in the tree, Utilities->AutoGroup.

When AutoGroup is set, the button turns green, it means autogrouping is activated. You can click on it to change the group or unset.

When autogrouping is active, any new Draft or Arch object created will be placed in that group (except when Draft construction mode is on, in which case it goes to the construction group).

This only works when creating Draft or Arch objects from the GUI buttons. Not when using them from python. This is so it is still possible for python scripts to do the grouping they want, regardless of what autogrouping says. In python scripts, using Draft autogrouping is simple, one only needs to do:

Code: Select all

Draft.autogroup(myObject)
This will take care of everything.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Draft AutoGroup

Post by DeepSOIC »

Problem is, this system is something that needs to be done across whole FreeCAD. Does it work outside of Draft?
EDIT: I see, it is only for Draft. Too bad...
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft AutoGroup

Post by yorik »

DeepSOIC wrote:Problem is, this system is something that needs to be done across whole FreeCAD. Does it work outside of Draft?
EDIT: I see, it is only for Draft. Too bad...
Yes, but it's not that difficult to port to C++ and make available throughout freecad. But I thought it's best to first experiment in a limited area like Draft. because I'm not sure that implementation is the best possible. For example, it would create some headache in PartDesign. And in PartDesign, was introduced the concept of "active host", which is a concurrent idea to this one. So this requires more thinking before anything gets done at freecad level, IMHO
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Draft AutoGroup

Post by DeepSOIC »

yorik wrote:And in PartDesign, was introduced the concept of "active host", which is a concurrent idea to this one. So this requires more thinking before anything gets done at freecad level, IMHO
So I'd like to share my vision of it =)
See points 1 and 2 in this post of mine :mrgreen: , in forum thread "Steps forward to assembly infrastructure" :
https://forum.freecadweb.org/viewtopic. ... 64#p140548
Unfortunately, I don't code for FreeCAD right now, so I feel a bit bad about trying to push others to follow my plans. But at least, can be considered.
A short correction, maybe it's better to have App.ActiveDocument.ActiveContainer, not straight App.ActiveContainer.

BTW, I already made Part-o-Magic, which does exactly this (adds new stuff to active container automatically), and works across whole FreeCAD (including any add-on workbenches). Unfortunately, it's more of a hack, and doesn't feel like a good thing to be merged into FreeCAD. And it doesn't support groups (it was made for Part containers), and it's outdated at the moment (not aware of extension framework; I hope to update it soon).
User avatar
Gift
Posts: 769
Joined: Tue Aug 18, 2015 10:08 am
Location: Germany, Sauerland

Re: Draft AutoGroup

Post by Gift »

It is possible to go the way from the other side with “smart groups”:

* Select the workbench in AutoGroup as property from the group.
* Other selectable features like ExportAutoSelect, Namespace, AutoClone …
* More for icons freaks: Standardized icon for all os. Selectable icons: SketchBox, Templates …

Many greetings from “Industrie-4.0-Germany” :D
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Draft AutoGroup

Post by HoWil »

yorik wrote: When AutoGroup is set, the button turns green, it means autogrouping is activated. You can click on it to change the group or unset.

When autogrouping is active, any new Draft or Arch object created will be placed in that group (except when Draft construction mode is on, in which case it goes to the construction group).
Hi yorik, I tried this feature and do not understand how to exit a selected group. I expected when I select 'None' that new elements are created in the root of my document. But they are not!?
BR,
HoWil
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft AutoGroup

Post by yorik »

HoWil wrote:I expected when I select 'None' that new elements are created in the root of my document. But they are not!?
Are you sure? I just tested again here, when selecting "None", the toolbar button turns red again and new objects get created in the doc root as normally...
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Draft AutoGroup

Post by HoWil »

yorik wrote:
HoWil wrote:I expected when I select 'None' that new elements are created in the root of my document. But they are not!?
Are you sure? I just tested again here, when selecting "None", the toolbar button turns red again and new objects get created in the doc root as normally...
Hi Yorik,

Please see the attached screencast:
sreenfc.webm
(258.62 KiB) Downloaded 698 times
I would expect that even if construction mode is on and 'None' is selected new elements are created in the root of the model tree:
Accordingly, see the creation of the second line at 0:13 and the creation of the fourth line at 0:23 (after switching back to 'None').

Maybe I did understand the workflow wrong and I always have to switch off construction mode to get back to root, but what is than 'None' for?
BR,
HoWil

OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10887 (Git)
Build type: None
Branch: master
Hash: 67fc70dadae471cb3d77dcf5562b4a86ec79f95d
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft AutoGroup

Post by yorik »

Ok thanks, I see now... There is a conflict between the autogroup and construction mode. I think the best approach would be to 1) when switching the construction mode on, always create a "construction" group, 2) if autogroup is set when switching construction mode on, change the autogroup group to "Construction", and 3) when switching autogroup on, unset construction mode of needed.

However I don't like creating a construction group immediately... User might switch tconstruction mode on, then change his/her mind, and not draw anything, and there would be a leftover empty constuction group there.
jidoeuf
Posts: 43
Joined: Sun Mar 01, 2015 4:06 pm

Re: Draft AutoGroup

Post by jidoeuf »

This feature adress issue #2060, isn't it?
Post Reply