Draft: Added a utility command to add selected objects tothe construction group
This commit is contained in:
@@ -81,7 +81,7 @@ class ArchWorkbench(Workbench):
|
||||
"Draft_FinishLine","Draft_CloseLine"]
|
||||
self.draftutils = ["Draft_VisGroup","Draft_Heal","Draft_FlipDimension",
|
||||
"Draft_ToggleConstructionMode","Draft_ToggleContinueMode","Draft_Edit",
|
||||
"Draft_Slope","Draft_SetWorkingPlaneProxy"]
|
||||
"Draft_Slope","Draft_SetWorkingPlaneProxy","Draft_AddConstruction"]
|
||||
self.snapList = ['Draft_Snap_Lock','Draft_Snap_Midpoint','Draft_Snap_Perpendicular',
|
||||
'Draft_Snap_Grid','Draft_Snap_Intersection','Draft_Snap_Parallel',
|
||||
'Draft_Snap_Endpoint','Draft_Snap_Angle','Draft_Snap_Center',
|
||||
|
||||
@@ -5358,6 +5358,37 @@ class Draft_Label(Creator):
|
||||
self.create()
|
||||
|
||||
|
||||
class Draft_AddConstruction():
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Draft_Construction',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_AddConstruction", "Add to Construction group"),
|
||||
'ToolTip' : QtCore.QT_TRANSLATE_NOOP("Draft_AddConstruction", "Adds the selected objects to the Construction group")}
|
||||
|
||||
def Activated(self):
|
||||
import FreeCADGui
|
||||
if hasattr(FreeCADGui,"draftToolBar"):
|
||||
col = FreeCADGui.draftToolBar.getDefaultColor("constr")
|
||||
col = (float(col[0]),float(col[1]),float(col[2]),0.0)
|
||||
gname = Draft.getParam("constructiongroupname","Construction")
|
||||
grp = FreeCAD.ActiveDocument.getObject(gname)
|
||||
if not grp:
|
||||
grp = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup",gname)
|
||||
for obj in FreeCADGui.Selection.getSelection():
|
||||
grp.addObject(obj)
|
||||
obrep = obj.ViewObject
|
||||
if "TextColor" in obrep.PropertiesList:
|
||||
obrep.TextColor = col
|
||||
if "PointColor" in obrep.PropertiesList:
|
||||
obrep.PointColor = col
|
||||
if "LineColor" in obrep.PropertiesList:
|
||||
obrep.LineColor = col
|
||||
if "ShapeColor" in obrep.PropertiesList:
|
||||
obrep.ShapeColor = col
|
||||
if hasattr(obrep,"Transparency"):
|
||||
obrep.Transparency = 80
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Snap tools
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -5602,6 +5633,7 @@ FreeCADGui.addCommand('Draft_ToggleGrid',ToggleGrid())
|
||||
FreeCADGui.addCommand('Draft_FlipDimension',Draft_FlipDimension())
|
||||
FreeCADGui.addCommand('Draft_AutoGroup',SetAutoGroup())
|
||||
FreeCADGui.addCommand('Draft_SetWorkingPlaneProxy',SetWorkingPlaneProxy())
|
||||
FreeCADGui.addCommand('Draft_AddConstruction',Draft_AddConstruction())
|
||||
|
||||
# snap commands
|
||||
FreeCADGui.addCommand('Draft_Snap_Lock',Draft_Snap_Lock())
|
||||
|
||||
@@ -83,7 +83,7 @@ class DraftWorkbench (Workbench):
|
||||
self.lineList = ["Draft_UndoLine","Draft_FinishLine","Draft_CloseLine"]
|
||||
self.utils = ["Draft_VisGroup","Draft_Heal","Draft_FlipDimension",
|
||||
"Draft_ToggleConstructionMode","Draft_ToggleContinueMode","Draft_Edit",
|
||||
"Draft_Slope","Draft_SetWorkingPlaneProxy"]
|
||||
"Draft_Slope","Draft_SetWorkingPlaneProxy","Draft_AddConstruction"]
|
||||
self.snapList = ['Draft_Snap_Lock','Draft_Snap_Midpoint','Draft_Snap_Perpendicular',
|
||||
'Draft_Snap_Grid','Draft_Snap_Intersection','Draft_Snap_Parallel',
|
||||
'Draft_Snap_Endpoint','Draft_Snap_Angle','Draft_Snap_Center',
|
||||
|
||||
Reference in New Issue
Block a user