Snap to the Center of a BuildingPart: how does that work?

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Roy_043
Veteran
Posts: 8544
Joined: Thu Dec 27, 2018 12:28 pm

Snap to the Center of a BuildingPart: how does that work?

Post by Roy_043 »

According to the Draft_Module page you can snap to the center of a BuildingPart. I wonder how that works.

I am unable to snap to a BuildingPart containing a single wall in Wireframe mode if only Center snap is active. And I have to switch to Wireframe mode to prevent snapping to faces.

Code: Select all

OS: Windows 8.1 (6.3)
Word size of FreeCAD: 64-bit
Version: 0.20.25220 (Git)
Build type: Release
Branch: master
Hash: 46282db7c8c65d1205a4cd03499d4beadb1573c6
Python version: 3.8.10
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: Dutch/Netherlands (nl_NL)
marioalexis
Posts: 124
Joined: Wed Jun 19, 2019 7:44 pm

Re: Snap to the Center of a BuildingPart: how does that work?

Post by marioalexis »

The snap to BuildingPart works with Snap Center: https://github.com/FreeCAD/FreeCAD/pull/4410
You can also set Selectable to false in the object's view properties if there is interference between snapping.
User avatar
Roy_043
Veteran
Posts: 8544
Joined: Thu Dec 27, 2018 12:28 pm

Re: Snap to the Center of a BuildingPart: how does that work?

Post by Roy_043 »

Thanks for your comment. I am aware that Center snap should work for BuildingParts (see the linked page in the OP). Perhaps I am doing something wrong, but I cannot get it to work at all.

Direct link to the code:
https://github.com/FreeCAD/FreeCAD/blob ... er.py#L467

marioalexis wrote: Wed Jul 21, 2021 1:12 pm set Selectable to false
You would have to do that for the objects inside the BuildingPart then. But even then it does not work. And AFAICT snapping to objects that are not selectable is impossible.

If you can get it to work then please provide step-by-step instructions.
marioalexis
Posts: 124
Joined: Wed Jun 19, 2019 7:44 pm

Re: Snap to the Center of a BuildingPart: how does that work?

Post by marioalexis »

I guess we are doing the same (unless I misunderstood your first post). In any case, here are the steps:
Create a BuildingPart
Create ArchWall inside the BuildingPart
Set Snap Center to ON
Select some Draft Modification or Creation command.
Try to snap the BuildingPart.
Attachments
Screenshot_snap_BuildingPart.png
Screenshot_snap_BuildingPart.png (391.07 KiB) Viewed 1385 times
User avatar
Roy_043
Veteran
Posts: 8544
Joined: Thu Dec 27, 2018 12:28 pm

Re: Snap to the Center of a BuildingPart: how does that work?

Post by Roy_043 »

Ah, thanks for that! I was clicking on the edges of the wall and did not consider the text element and the 3 axis lines of the BuildingPart.

BTW:
Using Center snap for this, and for snapping to WP proxies, is a bit confusing IMO. Wouldn't it make more sense to extend Draft_Snap_Special instead?
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

Re: Snap to the Center of a BuildingPart: how does that work?

Post by paullee »

Good to learn that :)

And agree that better be Snap Special.
marioalexis
Posts: 124
Joined: Wed Jun 19, 2019 7:44 pm

Re: Snap to the Center of a BuildingPart: how does that work?

Post by marioalexis »

Yes, using Snap Special seems more suitable.
Post Reply