Draft: Added preference setting to customize labels of Draft and Arch clones
This commit is contained in:
parent
8f45e13789
commit
7ee6a6737f
|
@ -89,7 +89,7 @@ def getParamType(param):
|
|||
"dimstyle","gridSize"]:
|
||||
return "int"
|
||||
elif param in ["constructiongroupname","textfont","patternFile","template",
|
||||
"snapModes","FontFile"]:
|
||||
"snapModes","FontFile","ClonePrefix"]:
|
||||
return "string"
|
||||
elif param in ["textheight","tolerance","gridSpacing","arrowsize","extlines","dimspacing"]:
|
||||
return "float"
|
||||
|
@ -2462,22 +2462,25 @@ def clone(obj,delta=None):
|
|||
linked copy of the given object. If the original object changes, the final object
|
||||
changes too. Optionally, you can give a delta Vector to move the clone from the
|
||||
original position.'''
|
||||
prefix = getParam("ClonePrefix","Clone of")
|
||||
if prefix:
|
||||
prefix = prefix.strip()+" "
|
||||
if not isinstance(obj,list):
|
||||
obj = [obj]
|
||||
if (len(obj) == 1) and obj[0].isDerivedFrom("Part::Part2DObject"):
|
||||
cl = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Clone2D")
|
||||
cl.Label = "Clone of " + obj[0].Label + " (2D)"
|
||||
cl.Label = prefix + obj[0].Label + " (2D)"
|
||||
elif (len(obj) == 1) and hasattr(obj[0],"CloneOf"):
|
||||
# arch objects can be clones
|
||||
import Arch
|
||||
cl = getattr(Arch,"make"+obj[0].Proxy.Type)()
|
||||
base = getCloneBase(obj[0])
|
||||
cl.Label = "Clone of " + base.Label
|
||||
cl.Label = prefix + base.Label
|
||||
cl.CloneOf = base
|
||||
return cl
|
||||
else:
|
||||
cl = FreeCAD.ActiveDocument.addObject("Part::AttachableObjectPython","Clone")
|
||||
cl.Label = "Clone of " + obj[0].Label
|
||||
cl.Label = prefix + obj[0].Label
|
||||
_Clone(cl)
|
||||
if gui:
|
||||
_ViewProviderClone(cl.ViewObject)
|
||||
|
|
|
@ -358,6 +358,30 @@ Values with differences below this value will be treated as same.</string>
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Prefix labels of Clones with:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefLineEdit" name="lineEdit">
|
||||
<property name="text">
|
||||
<string>Clone of</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ClonePrefix</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Draft</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue
Block a user