Delete will delete all selected items
Added tcl command: join_geometries which is the same command as edit -> join geometry
This commit is contained in:
parent
31ddb9cf7c
commit
51d6216361
|
@ -1186,9 +1186,10 @@ class App(QtCore.QObject):
|
||||||
|
|
||||||
# self.options2form()
|
# self.options2form()
|
||||||
|
|
||||||
|
|
||||||
def on_delete(self):
|
def on_delete(self):
|
||||||
"""
|
"""
|
||||||
Delete the currently selected FlatCAMObj.
|
Delete the currently selected FlatCAMObjs.
|
||||||
|
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
@ -1196,10 +1197,13 @@ class App(QtCore.QObject):
|
||||||
self.log.debug("on_delete()")
|
self.log.debug("on_delete()")
|
||||||
self.report_usage("on_delete")
|
self.report_usage("on_delete")
|
||||||
|
|
||||||
|
while (self.collection.get_active()):
|
||||||
|
self.delete_first_selected()
|
||||||
|
|
||||||
|
|
||||||
|
def delete_first_selected(self):
|
||||||
# Keep this for later
|
# Keep this for later
|
||||||
try:
|
try:
|
||||||
#name = copy(self.collection.get_active().options["name"])
|
|
||||||
# Shouldn't need to copy. String are immutable.
|
|
||||||
name = self.collection.get_active().options["name"]
|
name = self.collection.get_active().options["name"]
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.log.debug("Nothing selected for deletion")
|
self.log.debug("Nothing selected for deletion")
|
||||||
|
@ -2216,6 +2220,23 @@ class App(QtCore.QObject):
|
||||||
|
|
||||||
obj.union()
|
obj.union()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def join_geometries (obj_name, *obj_names):
|
||||||
|
objs = []
|
||||||
|
for obj_n in obj_names:
|
||||||
|
obj = self.collection.get_by_name(str(obj_n))
|
||||||
|
if obj is None:
|
||||||
|
return "Object not found: %s" % obj_n
|
||||||
|
else:
|
||||||
|
objs.append (obj)
|
||||||
|
|
||||||
|
def initialize(obj, app):
|
||||||
|
FlatCAMGeometry.merge(objs, obj)
|
||||||
|
|
||||||
|
if objs is not None:
|
||||||
|
self.new_object("geometry", obj_name, initialize)
|
||||||
|
|
||||||
def make_docs():
|
def make_docs():
|
||||||
output = ''
|
output = ''
|
||||||
import collections
|
import collections
|
||||||
|
@ -2480,6 +2501,14 @@ class App(QtCore.QObject):
|
||||||
'> geo_union <name>\n' +
|
'> geo_union <name>\n' +
|
||||||
' name: Name of the geometry object.'
|
' name: Name of the geometry object.'
|
||||||
},
|
},
|
||||||
|
'join_geometries': {
|
||||||
|
'fcn': join_geometries,
|
||||||
|
'help': 'Runs a merge operation (join) on the geometry ' +
|
||||||
|
'objects.' +
|
||||||
|
'> join_geometries <out_name> <obj_name_0>....\n' +
|
||||||
|
' out_name: Name of the new geometry object.' +
|
||||||
|
' obj_name_0... names of the objects to join'
|
||||||
|
},
|
||||||
'add_rect': {
|
'add_rect': {
|
||||||
'fcn': add_rectangle,
|
'fcn': add_rectangle,
|
||||||
'help': 'Creates a rectange in the given Geometry object.\n' +
|
'help': 'Creates a rectange in the given Geometry object.\n' +
|
||||||
|
|
Loading…
Reference in New Issue