Commit 2d9cd826 authored by sumpfralle's avatar sumpfralle

add a reference to the base model's name for derived new modesl


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1110 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent e27eba65
...@@ -110,9 +110,20 @@ class ModelExtrusion(pycam.Plugins.PluginBase): ...@@ -110,9 +110,20 @@ class ModelExtrusion(pycam.Plugins.PluginBase):
else: else:
self.log.error("Unknown extrusion type selected: %s" % type_string) self.log.error("Unknown extrusion type selected: %s" % type_string)
return return
model_manager = self.core.get("models")
for model in models: for model in models:
new_model = model.extrude(stepping=grid_size, func=func, new_model = model.extrude(stepping=grid_size, func=func,
callback=self.core.get("update_progress")) callback=self.core.get("update_progress"))
if new_model: if new_model:
self.core.get("load_model")(new_model) self.core.get("load_model")(new_model)
try:
# add the name of the original model to the new name
original_name = model_manager.get_attr(model,
"name").split("(")[0].strip()
new_name = model_manager.get_attr(new_model, "name")
model_manager.set_attr(new_model, "name",
"%s (extrusion of %s)" % \
(new_name, original_name))
except LookupError:
pass
...@@ -84,9 +84,20 @@ class ModelProjection(pycam.Plugins.PluginBase): ...@@ -84,9 +84,20 @@ class ModelProjection(pycam.Plugins.PluginBase):
if self.gui.get_object(objname).get_active(): if self.gui.get_object(objname).get_active():
plane = Plane(Point(0, 0, z_level), Vector(0, 0, 1)) plane = Plane(Point(0, 0, z_level), Vector(0, 0, 1))
self.log.info("Projecting 3D model at level z=%g" % plane.p.z) self.log.info("Projecting 3D model at level z=%g" % plane.p.z)
projection = model.get_waterline_contour(plane) new_model = model.get_waterline_contour(plane)
if projection: if new_model:
self.core.get("load_model")(projection) self.core.get("load_model")(new_model)
model_manager = self.core.get("models")
try:
# add the name of the original model to the new name
original_name = model_manager.get_attr(model,
"name").split("(")[0].strip()
new_name = model_manager.get_attr(new_model, "name")
model_manager.set_attr(new_model, "name",
"%s (projection of %s)" % \
(new_name, original_name))
except LookupError:
pass
else: else:
self.log.warn("The 2D projection at z=%g is empty. Aborted." % \ self.log.warn("The 2D projection at z=%g is empty. Aborted." % \
plane.p.z) plane.p.z)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment