Draft AutoGroup

Info about new implemented features, classes, modules or APIs. Might get technical!
User avatar
yorik
Site Admin
Posts: 8553
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Draft AutoGroup

Postby yorik » Wed Jan 25, 2017 5:09 pm

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 611 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.
DeepSOIC
Posts: 4457
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Draft AutoGroup

Postby DeepSOIC » Wed Jan 25, 2017 10:46 pm

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
Site Admin
Posts: 8553
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Draft AutoGroup

Postby yorik » Thu Jan 26, 2017 11:36 am

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
DeepSOIC
Posts: 4457
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Draft AutoGroup

Postby DeepSOIC » Thu Jan 26, 2017 2:49 pm

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: 88
Joined: Tue Aug 18, 2015 10:08 am

Re: Draft AutoGroup

Postby Gift » Fri Jan 27, 2017 9:24 pm

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