Feature: General purpose attachment editor

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

Feature: General purpose attachment editor

Postby DeepSOIC » Wed May 18, 2016 10:28 pm

In Part workbench: in the menu: Part->Attachment...
Capabilities:
• editing attachment of PartDesign Datum cs, planes, lines and points
• editing attachment of Sketches, PartDesign gears, Draft primitives, and other Part2DObjects. More attachable objects coming soon.
• editing attachment of any object that has Placement property, except that attachment won't be stored (can be useful for alignment).
gpattachment teaser.png
gpattachment teaser.png (306.67 KiB) Viewed 1757 times
User avatar
DeepSOIC
Posts: 6536
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Feature: General purpose attachment editor

Postby DeepSOIC » Wed May 18, 2016 10:36 pm

Creating Py attachable objects - 2 essential pieces:
1. App.ActiveDocument.addObject("Part::AttachableObjectPython", "myfeature"). AttachableObjectPython inherits Part::FeaturePython.
2. in Proxy.execute(self, doc_obj): make sure to call doc_obj.positionBySupport(). If your feature's geometry doesn't depend on placement of itself, it's best to call positionBySupport after setting Shape. Otherwise, call before, since positionBySupport updates Placement.

positionBySupport returns Boolean. True means the attachment is active; false - inactive; if attachment fails with an error - positionBySupport raises exception.
User avatar
DeepSOIC
Posts: 6536
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Feature: General purpose attachment editor

Postby DeepSOIC » Sun Oct 02, 2016 2:04 pm

since 0.17.8576:
Object being attached is temporarily made semi-transparent in rendering, and transparent to clicks (unpickable).
triplus
Posts: 8353
Joined: Mon Dec 12, 2011 4:45 pm

Re: Feature: General purpose attachment editor

Postby triplus » Mon Oct 03, 2016 9:13 pm

DeepSOIC wrote:since 0.17.8576:
Object being attached is temporarily made semi-transparent in rendering, and transparent to clicks (unpickable).
This is working good.

As for the rest i managed to attach Draft Circle on top face of Cylinder and the same Cylinder on top face of Box. Moving the Box moves the Cylinder and Circle along with it. I added additional Box and tested the same with selecting one face on each Box and after FreeCAD restart attached Box doesn't move with the rest (Box, Cylinder and Draft Circle). But if i select the Box and start attachment editor the Box moves to the expected position. I like the fact only available options are provided and the rest is disabled but the complexity of the tool will likely contribute to some users simply not using it. This tool likely could be turned into a toolbar of tools in the future. The amount of messages (yellow/red) in Report view is overwhelming.

P.S. And i guess the tool itself is influenced a bit by Assembly capabilities currently lacking in FreeCAD and therefore try out Assembly2 ASAP as you will likely feel just like at home over there. ;)
User avatar
DeepSOIC
Posts: 6536
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Feature: General purpose attachment editor

Postby DeepSOIC » Tue Oct 04, 2016 9:27 am

triplus wrote:I added additional Box and tested the same with selecting one face on each Box and after FreeCAD restart attached Box doesn't move with the rest (Box, Cylinder and Draft Circle).
This isn't a good bug report. But I managed to reproduce it. in short, attach a Part Cube to something, move something -> cube doesn't move.

EDIT:
created issue #0002722
triplus
Posts: 8353
Joined: Mon Dec 12, 2011 4:45 pm

Re: Feature: General purpose attachment editor

Postby triplus » Tue Oct 04, 2016 9:41 am

DeepSOIC wrote:This isn't a good bug report.
Well yeah. If the tool would be more simple the bug report would likely be more like that. ;)
DeepSOIC wrote:in short, attach a Part Cube to something, move something -> cube doesn't move.
Yes.