Browse Source

Added possibility to hide specific objects in the rasterized image

master
Youen 1 year ago
parent
commit
ec97d10a51
  1. 1
      ahb_cmd_new_step.py
  2. 11
      ahb_raster_view.py

1
ahb_cmd_new_step.py

@ -74,6 +74,7 @@ class AHB_New_Step:
view.CoarseView = True
view.addProperty("App::PropertyString", "Assembly_handbook_PreviousStepView", "Assembly_handbook")
view.addProperty("App::PropertyBool", "Assembly_handbook_RasterView", "Assembly_handbook")
view.addProperty("App::PropertyXLinkList", "Assembly_handbook_HideParts", "Assembly_handbook")
view.Assembly_handbook_RasterView = raster_view
if raster_view:
view.Visibility = False

11
ahb_raster_view.py

@ -132,6 +132,11 @@ class RasterView:
prev_parts = []
new_parts = []
all_parts = view.XSource + view.Source
objects_to_hide = []
if 'Assembly_handbook_HideParts' in view.PropertiesList:
objects_to_hide = self._flatten_objects_tree(view.Assembly_handbook_HideParts)
for part in all_parts:
link = tmp_doc.addObject('App::Link', part.Name)
link.Label = part.Label
@ -180,12 +185,12 @@ class RasterView:
else:
prev_parts.append(link)
# hide objects that we don't want to display ; also make a backup of properties we want to reset after we're done
# hide objects that we don't want to display ; also make a backup of properties we want to reset after we're done
for obj in self._flatten_objects_tree([link]):
if obj in objects_to_reset.keys():
continue
if self._should_render(obj):
if self._should_render(obj) and not obj in objects_to_hide:
if not fast_render:
objects_to_reset[obj] = (
obj.ViewObject.Visibility,
@ -285,7 +290,7 @@ class RasterView:
# restore properties on objects we have modified
for obj, props in objects_to_reset.items():
obj.ViewObject.Visibility = props[0]
if self._should_render(obj):
if self._should_render(obj) and not obj in objects_to_hide:
obj.ViewObject.LineColor = props[1]
obj.ViewObject.ShapeMaterial.AmbientColor = props[2]
obj.ViewObject.ShapeMaterial.DiffuseColor = props[3]

Loading…
Cancel
Save