Draft: Autogroup, insert guard to prevent cyclic references
ref. Forum discussion: Draft_OrthoArray: Crash when using active Std_Part. https://forum.freecadweb.org/viewtopic.php?f=23&t=59155&p=508132#p508132 Autogroup try to add new created Draft Objects into the active Part, but if the Part is used as a Base for the new object this could create a cyclic reference. This behaviour is prevented by adding a check for " obj in active_part.InListRecursive"
This commit is contained in:
@@ -69,6 +69,7 @@ class SketcherSketchObjectGuiTools(GuiTools):
|
||||
0 : startpoint
|
||||
1 : endpoint
|
||||
"""
|
||||
import Sketcher
|
||||
if node_idx == 0:
|
||||
obj.movePoint(0, 1, v)
|
||||
elif node_idx == 1:
|
||||
|
||||
@@ -129,6 +129,9 @@ def autogroup(obj):
|
||||
if Gui.ActiveDocument.ActiveView.getActiveObject("Arch"):
|
||||
# add object to active Arch Container
|
||||
active_arch_obj = Gui.ActiveDocument.ActiveView.getActiveObject("Arch")
|
||||
if obj in active_arch_obj.InListRecursive:
|
||||
# do not autogroup if obj points to active_arch_obj to prevent cyclic references
|
||||
return
|
||||
active_arch_obj.addObject(obj)
|
||||
|
||||
elif Gui.ActiveDocument.ActiveView.getActiveObject("part", False) is not None:
|
||||
@@ -136,6 +139,9 @@ def autogroup(obj):
|
||||
# so object does not jump to different position, works with App::Link
|
||||
# if not scaled. Modified accordingly to realthunder suggestions
|
||||
active_part, parent, sub = Gui.ActiveDocument.ActiveView.getActiveObject("part", False)
|
||||
if obj in active_part.InListRecursive:
|
||||
# do not autogroup if obj points to active_part to prevent cyclic references
|
||||
return
|
||||
matrix = parent.getSubObject(sub, retType=4)
|
||||
if matrix.hasScale() == 1:
|
||||
err = translate("Draft",
|
||||
|
||||
Reference in New Issue
Block a user