assembly: remove logic of making AsmElementSketch
This commit is contained in:
parent
34a56d92b3
commit
2dcbb2e1fb
22
assembly.py
22
assembly.py
|
@ -511,30 +511,13 @@ class AsmElement(AsmBase):
|
||||||
raise RuntimeError('invalid link {}.{}'.format(
|
raise RuntimeError('invalid link {}.{}'.format(
|
||||||
objName(group),subname))
|
objName(group),subname))
|
||||||
|
|
||||||
# With the new SketchExport, we don't need special treatment of sketch,
|
|
||||||
# AsmSketchElement is only kept for backward compatibility.
|
|
||||||
isSketch = False
|
|
||||||
# isSketch = not isTypeOf(sobj,AsmElement) and sobj and \
|
|
||||||
# sobj.getLinkedObject(True).isDerivedFrom('Sketcher::SketchObject')
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if undo:
|
if undo:
|
||||||
FreeCAD.setActiveTransaction('Assembly change element' \
|
FreeCAD.setActiveTransaction('Assembly change element' \
|
||||||
if element else 'Assembly create element')
|
if element else 'Assembly create element')
|
||||||
|
|
||||||
elements = group.Proxy.getAssembly().getElementGroup()
|
elements = group.Proxy.getAssembly().getElementGroup()
|
||||||
oldLabel = None
|
|
||||||
idx = -1
|
idx = -1
|
||||||
if element and isSketch!=isinstance(element,AsmElementSketch):
|
|
||||||
# Check if element type is changed. We need special treatment
|
|
||||||
# for element from sketch object
|
|
||||||
for i,e in enumerate(elements.Group):
|
|
||||||
if e == element:
|
|
||||||
idx = i
|
|
||||||
oldLabel = element.Label
|
|
||||||
break
|
|
||||||
element = None
|
|
||||||
|
|
||||||
if not element:
|
if not element:
|
||||||
# try to search the element group for an existing element
|
# try to search the element group for an existing element
|
||||||
for e in elements.Group:
|
for e in elements.Group:
|
||||||
|
@ -543,12 +526,7 @@ class AsmElement(AsmBase):
|
||||||
sub = logger.catch('',e.Proxy.getSubName)
|
sub = logger.catch('',e.Proxy.getSubName)
|
||||||
if sub == subname:
|
if sub == subname:
|
||||||
return e
|
return e
|
||||||
if isSketch:
|
|
||||||
element = AsmElementSketch.create(name,elements)
|
|
||||||
else:
|
|
||||||
element = AsmElement.create(name,elements)
|
element = AsmElement.create(name,elements)
|
||||||
if oldLabel:
|
|
||||||
element.Label = oldLabel
|
|
||||||
elements.setLink({idx:element})
|
elements.setLink({idx:element})
|
||||||
elements.setElementVisible(element.Name,False)
|
elements.setElementVisible(element.Name,False)
|
||||||
element.Proxy._initializing = False
|
element.Proxy._initializing = False
|
||||||
|
|
Loading…
Reference in New Issue
Block a user