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!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Feature: General purpose attachment editor

Post by DeepSOIC »

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 3299 times
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Feature: General purpose attachment editor

Post by DeepSOIC »

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
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Feature: General purpose attachment editor

Post by DeepSOIC »

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

Re: Feature: General purpose attachment editor

Post by triplus »

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
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Feature: General purpose attachment editor

Post by DeepSOIC »

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
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Feature: General purpose attachment editor

Post by triplus »

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.
Post Reply