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"]:
|
"dimstyle","gridSize"]:
|
||||||
return "int"
|
return "int"
|
||||||
elif param in ["constructiongroupname","textfont","patternFile","template",
|
elif param in ["constructiongroupname","textfont","patternFile","template",
|
||||||
"snapModes","FontFile"]:
|
"snapModes","FontFile","ClonePrefix"]:
|
||||||
return "string"
|
return "string"
|
||||||
elif param in ["textheight","tolerance","gridSpacing","arrowsize","extlines","dimspacing"]:
|
elif param in ["textheight","tolerance","gridSpacing","arrowsize","extlines","dimspacing"]:
|
||||||
return "float"
|
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
|
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
|
changes too. Optionally, you can give a delta Vector to move the clone from the
|
||||||
original position.'''
|
original position.'''
|
||||||
|
prefix = getParam("ClonePrefix","Clone of")
|
||||||
|
if prefix:
|
||||||
|
prefix = prefix.strip()+" "
|
||||||
if not isinstance(obj,list):
|
if not isinstance(obj,list):
|
||||||
obj = [obj]
|
obj = [obj]
|
||||||
if (len(obj) == 1) and obj[0].isDerivedFrom("Part::Part2DObject"):
|
if (len(obj) == 1) and obj[0].isDerivedFrom("Part::Part2DObject"):
|
||||||
cl = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Clone2D")
|
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"):
|
elif (len(obj) == 1) and hasattr(obj[0],"CloneOf"):
|
||||||
# arch objects can be clones
|
# arch objects can be clones
|
||||||
import Arch
|
import Arch
|
||||||
cl = getattr(Arch,"make"+obj[0].Proxy.Type)()
|
cl = getattr(Arch,"make"+obj[0].Proxy.Type)()
|
||||||
base = getCloneBase(obj[0])
|
base = getCloneBase(obj[0])
|
||||||
cl.Label = "Clone of " + base.Label
|
cl.Label = prefix + base.Label
|
||||||
cl.CloneOf = base
|
cl.CloneOf = base
|
||||||
return cl
|
return cl
|
||||||
else:
|
else:
|
||||||
cl = FreeCAD.ActiveDocument.addObject("Part::AttachableObjectPython","Clone")
|
cl = FreeCAD.ActiveDocument.addObject("Part::AttachableObjectPython","Clone")
|
||||||
cl.Label = "Clone of " + obj[0].Label
|
cl.Label = prefix + obj[0].Label
|
||||||
_Clone(cl)
|
_Clone(cl)
|
||||||
if gui:
|
if gui:
|
||||||
_ViewProviderClone(cl.ViewObject)
|
_ViewProviderClone(cl.ViewObject)
|
||||||
|
|
|
@ -358,6 +358,30 @@ Values with differences below this value will be treated as same.</string>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user