forked from youen/assembly_handbook
Added possibility to hide specific objects in the rasterized image
This commit is contained in:
parent
a8e10a2b99
commit
ec97d10a51
@ -74,6 +74,7 @@ class AHB_New_Step:
|
|||||||
view.CoarseView = True
|
view.CoarseView = True
|
||||||
view.addProperty("App::PropertyString", "Assembly_handbook_PreviousStepView", "Assembly_handbook")
|
view.addProperty("App::PropertyString", "Assembly_handbook_PreviousStepView", "Assembly_handbook")
|
||||||
view.addProperty("App::PropertyBool", "Assembly_handbook_RasterView", "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
|
view.Assembly_handbook_RasterView = raster_view
|
||||||
if raster_view:
|
if raster_view:
|
||||||
view.Visibility = False
|
view.Visibility = False
|
||||||
|
@ -132,6 +132,11 @@ class RasterView:
|
|||||||
prev_parts = []
|
prev_parts = []
|
||||||
new_parts = []
|
new_parts = []
|
||||||
all_parts = view.XSource + view.Source
|
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:
|
for part in all_parts:
|
||||||
link = tmp_doc.addObject('App::Link', part.Name)
|
link = tmp_doc.addObject('App::Link', part.Name)
|
||||||
link.Label = part.Label
|
link.Label = part.Label
|
||||||
@ -180,12 +185,12 @@ class RasterView:
|
|||||||
else:
|
else:
|
||||||
prev_parts.append(link)
|
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]):
|
for obj in self._flatten_objects_tree([link]):
|
||||||
if obj in objects_to_reset.keys():
|
if obj in objects_to_reset.keys():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self._should_render(obj):
|
if self._should_render(obj) and not obj in objects_to_hide:
|
||||||
if not fast_render:
|
if not fast_render:
|
||||||
objects_to_reset[obj] = (
|
objects_to_reset[obj] = (
|
||||||
obj.ViewObject.Visibility,
|
obj.ViewObject.Visibility,
|
||||||
@ -285,7 +290,7 @@ class RasterView:
|
|||||||
# restore properties on objects we have modified
|
# restore properties on objects we have modified
|
||||||
for obj, props in objects_to_reset.items():
|
for obj, props in objects_to_reset.items():
|
||||||
obj.ViewObject.Visibility = props[0]
|
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.LineColor = props[1]
|
||||||
obj.ViewObject.ShapeMaterial.AmbientColor = props[2]
|
obj.ViewObject.ShapeMaterial.AmbientColor = props[2]
|
||||||
obj.ViewObject.ShapeMaterial.DiffuseColor = props[3]
|
obj.ViewObject.ShapeMaterial.DiffuseColor = props[3]
|
||||||
|
Loading…
Reference in New Issue
Block a user