Commit 56e731b6 authored by sumpfralle's avatar sumpfralle

added model corner coordinates to the 3D view


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1010 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 9a1d6446
...@@ -4845,32 +4845,157 @@ Usually you will want to use the cutter radius here to cut around the outline.</ ...@@ -4845,32 +4845,157 @@ Usually you will want to use the cutter radius here to cut around the outline.</
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkHBox" id="view3ddimension"> <object class="GtkAlignment" id="alignment22">
<property name="visible">True</property> <property name="visible">True</property>
<property name="spacing">6</property> <property name="left_padding">2</property>
<property name="right_padding">2</property>
<child> <child>
<object class="GtkLabel" id="DimensionLabel"> <object class="GtkTable" id="view3ddimension">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Bounding Box:</property> <property name="n_rows">2</property>
</object> <property name="n_columns">6</property>
<packing> <property name="column_spacing">3</property>
<property name="expand">False</property> <child>
<property name="padding">3</property> <object class="GtkLabel" id="label8">
<property name="position">0</property> <property name="visible">True</property>
</packing> <property name="xalign">0</property>
</child> <property name="label" translatable="yes">Model corners:</property>
<child> </object>
<object class="GtkHBox" id="hbox8"> <packing>
<property name="visible">True</property> <property name="top_attach">1</property>
<property name="spacing">12</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkVSeparator" id="vseparator16">
<property name="visible">True</property>
<property name="orientation">vertical</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkVSeparator" id="vseparator17">
<property name="visible">True</property>
<property name="orientation">vertical</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox42">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="ModelCornerXMin">
<property name="visible">True</property>
<property name="label" translatable="yes">xmin</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="ModelCornerXSpaces">
<property name="visible">True</property>
<property name="label" translatable="yes">..</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="ModelCornerXMax">
<property name="visible">True</property>
<property name="label" translatable="yes">xmax</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child> <child>
<object class="GtkHBox" id="hbox10"> <object class="GtkHBox" id="hbox44">
<property name="visible">True</property> <property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="ModelCornerZMin">
<property name="visible">True</property>
<property name="label" translatable="yes">zmin</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="ModelCornerZSpaces">
<property name="visible">True</property>
<property name="label" translatable="yes">..</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="ModelCornerZMax">
<property name="visible">True</property>
<property name="label" translatable="yes">zmax</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">5</property>
<property name="right_attach">6</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="DimensionLabel">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Bounding Box:</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox40">
<property name="visible">True</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="model_dim_x_label"> <object class="GtkLabel" id="model_dim_x_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">&#x394;x:</property> <property name="label" translatable="yes">&#x394;x:</property>
</object> </object>
<packing> <packing>
...@@ -4891,17 +5016,52 @@ Usually you will want to use the cutter radius here to cut around the outline.</ ...@@ -4891,17 +5016,52 @@ Usually you will want to use the cutter radius here to cut around the outline.</
</child> </child>
</object> </object>
<packing> <packing>
<property name="position">0</property> <property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkHBox" id="hbox14"> <object class="GtkHBox" id="hbox41">
<property name="visible">True</property> <property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="model_dim_z_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&#x394;z:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="model_dim_z">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">z</property>
<property name="single_line_mode">True</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">5</property>
<property name="right_attach">6</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox43">
<property name="visible">True</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="model_dim_y_label"> <object class="GtkLabel" id="model_dim_y_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">&#x394;y:</property> <property name="label" translatable="yes">&#x394;y:</property>
</object> </object>
<packing> <packing>
...@@ -4922,18 +5082,19 @@ Usually you will want to use the cutter radius here to cut around the outline.</ ...@@ -4922,18 +5082,19 @@ Usually you will want to use the cutter radius here to cut around the outline.</
</child> </child>
</object> </object>
<packing> <packing>
<property name="position">1</property> <property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkHBox" id="hbox15"> <object class="GtkHBox" id="hbox45">
<property name="visible">True</property> <property name="visible">True</property>
<property name="spacing">2</property>
<child> <child>
<object class="GtkLabel" id="model_dim_z_label"> <object class="GtkLabel" id="ModelCornerYMin">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="label" translatable="yes">ymin</property>
<property name="xpad">3</property>
<property name="label" translatable="yes">&#x394;z:</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -4941,26 +5102,35 @@ Usually you will want to use the cutter radius here to cut around the outline.</ ...@@ -4941,26 +5102,35 @@ Usually you will want to use the cutter radius here to cut around the outline.</
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="model_dim_z"> <object class="GtkLabel" id="ModelCornerYSpaces">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="label" translatable="yes">..</property>
<property name="label" translatable="yes">z</property>
<property name="single_line_mode">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="ModelCornerYMax">
<property name="visible">True</property>
<property name="label" translatable="yes">ymax</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="position">2</property> <property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child> </child>
</object> </object>
<packing> <packing>
......
...@@ -354,11 +354,14 @@ class ModelViewWindowGL: ...@@ -354,11 +354,14 @@ class ModelViewWindowGL:
# reduce it a bit. # reduce it a bit.
for color, names in ( for color, names in (
(pango.AttrForeground(65535, 0, 0, 0, 100), (pango.AttrForeground(65535, 0, 0, 0, 100),
("model_dim_x_label", "model_dim_x")), ("model_dim_x_label", "model_dim_x", "ModelCornerXMax",
"ModelCornerXMin", "ModelCornerXSpaces")),
(pango.AttrForeground(0, 50000, 0, 0, 100), (pango.AttrForeground(0, 50000, 0, 0, 100),
("model_dim_y_label", "model_dim_y")), ("model_dim_y_label", "model_dim_y", "ModelCornerYMax",
"ModelCornerYMin", "ModelCornerYSpaces")),
(pango.AttrForeground(0, 0, 65535, 0, 100), (pango.AttrForeground(0, 0, 65535, 0, 100),
("model_dim_z_label", "model_dim_z"))): ("model_dim_z_label", "model_dim_z", "ModelCornerZMax",
"ModelCornerZMin", "ModelCornerZSpaces"))):
attributes = pango.AttrList() attributes = pango.AttrList()
attributes.insert(color) attributes.insert(color)
for name in names: for name in names:
......
...@@ -568,7 +568,7 @@ class ProjectGui: ...@@ -568,7 +568,7 @@ class ProjectGui:
scale_button.connect("clicked", self.scale_model) scale_button.connect("clicked", self.scale_model)
# scale model to an axis dimension # scale model to an axis dimension
self.gui.get_object("ScaleDimensionAxis").connect("changed", self.gui.get_object("ScaleDimensionAxis").connect("changed",
self.update_scale_controls) self.update_model_dimensions)
scale_dimension_button = self.gui.get_object("ScaleDimensionButton") scale_dimension_button = self.gui.get_object("ScaleDimensionButton")
scale_dimension_button.connect("clicked", self.scale_model_axis_fit) scale_dimension_button.connect("clicked", self.scale_model_axis_fit)
scale_dimension_control = self.gui.get_object("ScaleDimensionControl") scale_dimension_control = self.gui.get_object("ScaleDimensionControl")
...@@ -579,9 +579,9 @@ class ProjectGui: ...@@ -579,9 +579,9 @@ class ProjectGui:
self.gui.get_object("ToggleModelDirectionButton").connect("clicked", self.gui.get_object("ToggleModelDirectionButton").connect("clicked",
self.reverse_model_direction) self.reverse_model_direction)
self.gui.get_object("ScaleInchMM").connect("clicked", self.scale_model, self.gui.get_object("ScaleInchMM").connect("clicked", self.scale_model,
100 * 25.4) 100 * 25.4, False)
self.gui.get_object("ScaleMMInch").connect("clicked", self.scale_model, self.gui.get_object("ScaleMMInch").connect("clicked", self.scale_model,
100 / 25.4) 100 / 25.4, False)
self.gui.get_object("Projection2D").connect("clicked", self.gui.get_object("Projection2D").connect("clicked",
self.projection_2d) self.projection_2d)
# support grid # support grid
...@@ -1149,7 +1149,7 @@ class ProjectGui: ...@@ -1149,7 +1149,7 @@ class ProjectGui:
self.update_save_actions() self.update_save_actions()
self.update_unit_labels() self.update_unit_labels()
self.update_support_controls() self.update_support_controls()
self.update_scale_controls() self.update_model_dimensions()
self.update_gcode_controls() self.update_gcode_controls()
self.update_ode_settings() self.update_ode_settings()
self.update_parallel_processes_settings() self.update_parallel_processes_settings()
...@@ -2311,6 +2311,7 @@ class ProjectGui: ...@@ -2311,6 +2311,7 @@ class ProjectGui:
self.model.transform_by_template(value, self.model.transform_by_template(value,
callback=self.update_progress_bar) callback=self.update_progress_bar)
self.append_to_queue(self.update_support_model) self.append_to_queue(self.update_support_model)
self.append_to_queue(self.update_model_dimensions)
self.append_to_queue(self.update_view) self.append_to_queue(self.update_view)
def _treeview_get_active_index(self, table, datalist): def _treeview_get_active_index(self, table, datalist):
...@@ -2756,8 +2757,9 @@ class ProjectGui: ...@@ -2756,8 +2757,9 @@ class ProjectGui:
self.disable_progress_cancel_button() self.disable_progress_cancel_button()
self.model.shift(shift_x, shift_y, shift_z, self.model.shift(shift_x, shift_y, shift_z,
callback=self.update_progress_bar) callback=self.update_progress_bar)
self.update_support_model() self.append_to_queue(self.update_support_model)
self.update_view() self.append_to_queue(self.update_model_dimensions)
self.append_to_queue(self.update_view)
def _get_model_center(self): def _get_model_center(self):
if self.model is None: if self.model is None:
...@@ -2799,7 +2801,7 @@ class ProjectGui: ...@@ -2799,7 +2801,7 @@ class ProjectGui:
@progress_activity_guard @progress_activity_guard
@gui_activity_guard @gui_activity_guard
def scale_model(self, widget=None, percent=None): def scale_model(self, widget=None, percent=None, keep_center=True):
if percent is None: if percent is None:
percent = self.gui.get_object("ScalePercent").get_value() percent = self.gui.get_object("ScalePercent").get_value()
factor = percent / 100.0 factor = percent / 100.0
...@@ -2810,15 +2812,17 @@ class ProjectGui: ...@@ -2810,15 +2812,17 @@ class ProjectGui:
self.update_progress_bar("Scaling model") self.update_progress_bar("Scaling model")
self.disable_progress_cancel_button() self.disable_progress_cancel_button()
self.model.scale(factor, callback=self.update_progress_bar) self.model.scale(factor, callback=self.update_progress_bar)
self._set_model_center(old_center) if keep_center:
self.append_to_queue(self.update_scale_controls) self._set_model_center(old_center)
self.append_to_queue(self.update_model_dimensions)
self.append_to_queue(self.update_support_model) self.append_to_queue(self.update_support_model)
self.append_to_queue(self.update_view) self.append_to_queue(self.update_view)
@gui_activity_guard @gui_activity_guard
def update_scale_controls(self, widget=None): def update_model_dimensions(self, widget=None):
if self.model is None: if self.model is None:
return return
# scale controls
axis_control = self.gui.get_object("ScaleDimensionAxis") axis_control = self.gui.get_object("ScaleDimensionAxis")
scale_button = self.gui.get_object("ScaleDimensionButton") scale_button = self.gui.get_object("ScaleDimensionButton")
scale_value = self.gui.get_object("ScaleDimensionControl") scale_value = self.gui.get_object("ScaleDimensionControl")
...@@ -2832,6 +2836,13 @@ class ProjectGui: ...@@ -2832,6 +2836,13 @@ class ProjectGui:
scale_button.set_sensitive(enable_controls) scale_button.set_sensitive(enable_controls)
scale_value.set_sensitive(enable_controls) scale_value.set_sensitive(enable_controls)
scale_value.set_value(value) scale_value.set_value(value)
# model corners in 3D view
for attr, label_suffix in (("minx", "XMin"), ("miny", "YMin"),
("minz", "ZMin"), ("maxx", "XMax"), ("maxy", "YMax"),
("maxz", "ZMax")):
label_name = "ModelCorner%s" % label_suffix
value = "%.3f" % getattr(self.model, attr)
self.gui.get_object(label_name).set_label(value)
@progress_activity_guard @progress_activity_guard
@gui_activity_guard @gui_activity_guard
...@@ -2877,8 +2888,9 @@ class ProjectGui: ...@@ -2877,8 +2888,9 @@ class ProjectGui:
callback=self.update_progress_bar) callback=self.update_progress_bar)
# move the model to its previous center # move the model to its previous center
self._set_model_center(old_center) self._set_model_center(old_center)
self.update_support_model() self.append_to_queue(self.update_support_model)
self.update_view() self.append_to_queue(self.update_model_dimensions)
self.append_to_queue(self.update_view)
def destroy(self, widget=None, data=None): def destroy(self, widget=None, data=None):
self.update_view() self.update_view()
...@@ -3022,7 +3034,7 @@ class ProjectGui: ...@@ -3022,7 +3034,7 @@ class ProjectGui:
self.update_save_actions() self.update_save_actions()
def _update_all_model_attributes(self): def _update_all_model_attributes(self):
self.append_to_queue(self.update_scale_controls) self.append_to_queue(self.update_model_dimensions)
self.append_to_queue(self.update_model_type_related_controls) self.append_to_queue(self.update_model_type_related_controls)
self.append_to_queue(self.update_support_controls) self.append_to_queue(self.update_support_controls)
self.append_to_queue(self.toggle_3d_view, value=True) self.append_to_queue(self.toggle_3d_view, value=True)
......
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