forked from youen/assembly_handbook
Added possibility to manually define a view volume, and fixed some bugs
This commit is contained in:
parent
f180c72f81
commit
8a9c6d8069
@ -125,6 +125,7 @@ class RasterView:
|
|||||||
duplicated_parts = {}
|
duplicated_parts = {}
|
||||||
try:
|
try:
|
||||||
# construct new scene with links to the parts we want
|
# construct new scene with links to the parts we want
|
||||||
|
sceneGroup = tmp_doc.addObject('App::DocumentObjectGroup', 'Scene')
|
||||||
prev_parts = []
|
prev_parts = []
|
||||||
new_parts = []
|
new_parts = []
|
||||||
for part in view.XSource:
|
for part in view.XSource:
|
||||||
@ -150,7 +151,7 @@ class RasterView:
|
|||||||
for other_part in other_parts:
|
for other_part in other_parts:
|
||||||
other_objects = self._flatten_objects_tree([other_part])
|
other_objects = self._flatten_objects_tree([other_part])
|
||||||
for obj in self._flatten_objects_tree([link]):
|
for obj in self._flatten_objects_tree([link]):
|
||||||
if obj in other_objects:
|
if self._should_render(obj) and obj in other_objects:
|
||||||
is_conflicting = True
|
is_conflicting = True
|
||||||
|
|
||||||
if is_conflicting:
|
if is_conflicting:
|
||||||
@ -162,6 +163,9 @@ class RasterView:
|
|||||||
part_copy.Label = part.Label
|
part_copy.Label = part.Label
|
||||||
duplicated_parts[link.LinkedObject] = part_copy
|
duplicated_parts[link.LinkedObject] = part_copy
|
||||||
link.LinkedObject = part_copy
|
link.LinkedObject = part_copy
|
||||||
|
part_copy.ViewObject.Visibility = False
|
||||||
|
|
||||||
|
sceneGroup.addObject(link)
|
||||||
|
|
||||||
if is_new_part:
|
if is_new_part:
|
||||||
new_parts.append(link)
|
new_parts.append(link)
|
||||||
@ -200,7 +204,22 @@ class RasterView:
|
|||||||
rot *= coin.SbRotation(coin.SbVec3f(0,0,1), coin.SbVec3f(view.Direction.x,view.Direction.y,view.Direction.z))
|
rot *= coin.SbRotation(coin.SbVec3f(0,0,1), coin.SbVec3f(view.Direction.x,view.Direction.y,view.Direction.z))
|
||||||
cam.orientation.setValue(rot)
|
cam.orientation.setValue(rot)
|
||||||
|
|
||||||
tmp_doc_view.fitAll()
|
targetViewVolume = None
|
||||||
|
try:
|
||||||
|
targetViewVolume = view.Assembly_handbook_ViewVolume
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if targetViewVolume is None:
|
||||||
|
tmp_doc_view.fitAll()
|
||||||
|
else:
|
||||||
|
sceneGroup.ViewObject.Visibility = False
|
||||||
|
viewVolumeLink = tmp_doc.addObject('App::Link', 'ViewVolume')
|
||||||
|
viewVolumeLink.LinkedObject = targetViewVolume
|
||||||
|
viewVolumeLink.Placement = targetViewVolume.Placement
|
||||||
|
tmp_doc_view.fitAll()
|
||||||
|
tmp_doc.removeObject(viewVolumeLink.Name)
|
||||||
|
sceneGroup.ViewObject.Visibility = True
|
||||||
|
|
||||||
viewVolume = cam.getViewVolume(0.0)
|
viewVolume = cam.getViewVolume(0.0)
|
||||||
self.image_view.Assembly_handbook_ViewVolumeWidth = viewVolume.getWidth()
|
self.image_view.Assembly_handbook_ViewVolumeWidth = viewVolume.getWidth()
|
||||||
|
Loading…
Reference in New Issue
Block a user