Add a move base property that moves the base object instead of the object itself if true.

This is useful because it is the default case for most architectural work.
This commit is contained in:
Dion Moult
2019-02-08 20:14:40 +11:00
committed by Yorik van Havre
parent 8ceaab78fc
commit 57b596e0fc
3 changed files with 34 additions and 1 deletions

View File

@@ -261,6 +261,9 @@ class Component:
if r in IfcRoles:
obj.IfcRole = r
FreeCAD.Console.PrintMessage("Downgrading "+obj.Label+" IfcType property to IfcRole\n")
if not "MoveBase" in pl:
obj.addProperty("App::PropertyBool","MoveBase","Component",QT_TRANSLATE_NOOP("App::Property","Specifies if moving this object moves its base instead"))
obj.MoveBase = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetBool("MoveBase",False)
if not "MoveWithHost" in pl:
obj.addProperty("App::PropertyBool","MoveWithHost","Component",QT_TRANSLATE_NOOP("App::Property","Specifies if this object must move together when its host is moved"))
obj.MoveWithHost = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetBool("MoveWithHost",False)

View File

@@ -17,7 +17,16 @@
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
@@ -190,6 +199,9 @@
<property name="text">
<string>Set &quot;Move with host&quot; property to True by default</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>MoveWithHost</cstring>
</property>
@@ -198,6 +210,22 @@
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkBox_5">
<property name="text">
<string>Set &quot;Move base&quot; property to True by default</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>MoveBase</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -1479,6 +1479,8 @@ def move(objectslist,vector,copy=False):
newobjlist = []
newgroups = {}
for obj in objectslist:
if hasattr(obj, "MoveBase") and obj.MoveBase:
obj = obj.Base
if hasattr(obj,"Placement"):
if obj.getEditorMode("Placement") == ["ReadOnly"]:
if not copy: