Draft: misc small fixes

This commit is contained in:
Yorik van Havre
2019-08-27 21:29:20 -03:00
parent 663c975aa0
commit 0b3df322fb
3 changed files with 18 additions and 1 deletions

View File

@@ -1648,6 +1648,8 @@ def move(objectslist,vector,copy=False):
g = newgroups.setdefault(p.Name,FreeCAD.ActiveDocument.addObject(p.TypeId,p.Name))
g.addObject(newobj)
break
if getType(p) == "Layer":
p.Proxy.addObject(p,newobj)
if copy and getParam("selectBaseObjects",False):
select(objectslist)
else:

View File

@@ -192,6 +192,9 @@ class ViewProviderLayer:
for p in ["LineColor","ShapeColor","LineWidth","DrawStyle","Transparency"]:
if hasattr(vobj,p) and hasattr(o.ViewObject,p):
setattr(o.ViewObject,p,getattr(vobj,p))
# give line color to texts
if hasattr(vobj,"LineColor") and hasattr(o.ViewObject,"TextColor"):
o.ViewObject.TextColor = vobj.ShapeColor
if (prop == "Visibility") and hasattr(vobj,"Visibility"):
if hasattr(vobj,"Object")and hasattr(vobj.Object,"Group"):
@@ -268,9 +271,13 @@ class ViewProviderLayer:
def setupContextMenu(self,vobj,menu):
from PySide import QtCore,QtGui
import Draft_rc
action1 = QtGui.QAction(QtGui.QIcon(":/icons/button_right.svg"),translate("draft","Activate this layer"),menu)
action1.triggered.connect(self.activate)
menu.addAction(action1)
action2 = QtGui.QAction(QtGui.QIcon(":/icons/Draft_SelectGroup.svg"),translate("draft","Select contents"),menu)
action2.triggered.connect(self.selectcontents)
menu.addAction(action2)
def activate(self):
@@ -279,6 +286,13 @@ class ViewProviderLayer:
FreeCADGui.Selection.addSelection(self.Object)
FreeCADGui.runCommand("Draft_AutoGroup")
def selectcontents(self):
if hasattr(self,"Object"):
FreeCADGui.Selection.clearSelection()
for o in self.Object.Group:
FreeCADGui.Selection.addSelection(o)
class LayerContainer:
"""The Layer Container"""

View File

@@ -5638,7 +5638,8 @@ class Draft_Arc_3Points:
placement = FreeCAD.Placement(e.Curve.Center,rot)
start = e.FirstParameter
end = e.LastParameter/math.pi*180
Draft.makeCircle(radius,placement,startangle=start,endangle=end)
c = Draft.makeCircle(radius,placement,startangle=start,endangle=end)
Draft.autogroup(c)
self.tracker.off()
FreeCAD.ActiveDocument.recompute()