Skip to content

Commit

Permalink
Draft: misc small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Aug 28, 2019
1 parent 7fef642 commit 5b2e74c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Mod/Draft/Draft.py
Expand Up @@ -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:
Expand Down
14 changes: 14 additions & 0 deletions src/Mod/Draft/DraftLayer.py
Expand Up @@ -192,6 +192,9 @@ def onChanged(self,vobj,prop):
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"):
Expand Down Expand Up @@ -268,9 +271,13 @@ def dropObject(self,vobj,otherobj):
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):

Expand All @@ -279,6 +286,13 @@ def activate(self):
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"""
Expand Down
3 changes: 2 additions & 1 deletion src/Mod/Draft/DraftTools.py
Expand Up @@ -5638,7 +5638,8 @@ def getPoint(self,point,info):
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()

Expand Down

0 comments on commit 5b2e74c

Please sign in to comment.