(
assy: AssemblyProtocol,
color: Tuple[float, float, float, float] = (1.0, 1.0, 1.0, 1.0),
edgecolor: Tuple[float, float, float, float] = (0.0, 0.0, 0.0, 0.0),
edges: bool = True,
linewidth: float = 2,
tolerance: float = 1e-3,
angularTolerance: float = 0.1,
)
| 621 | |
| 622 | |
| 623 | def toVTKAssy( |
| 624 | assy: AssemblyProtocol, |
| 625 | color: Tuple[float, float, float, float] = (1.0, 1.0, 1.0, 1.0), |
| 626 | edgecolor: Tuple[float, float, float, float] = (0.0, 0.0, 0.0, 0.0), |
| 627 | edges: bool = True, |
| 628 | linewidth: float = 2, |
| 629 | tolerance: float = 1e-3, |
| 630 | angularTolerance: float = 0.1, |
| 631 | ) -> List[vtkProp3D]: |
| 632 | |
| 633 | rv: List[vtkProp3D] = [] |
| 634 | |
| 635 | for shape, _, loc, col_ in assy: |
| 636 | |
| 637 | col = col_.toTuple() if col_ else color |
| 638 | |
| 639 | trans, rot = _loc2vtk(loc) |
| 640 | |
| 641 | data = shape.toVtkPolyData(tolerance, angularTolerance) |
| 642 | data_edges, data_faces = extractEdgesFaces(data) |
| 643 | |
| 644 | # add both to the vtkAssy |
| 645 | mapper = vtkMapper() |
| 646 | mapper.AddInputDataObject(data_faces) |
| 647 | |
| 648 | actor = vtkActor() |
| 649 | actor.SetMapper(mapper) |
| 650 | actor.SetPosition(*trans) |
| 651 | actor.SetOrientation(*rot) |
| 652 | actor.GetProperty().SetColor(*col[:3]) |
| 653 | actor.GetProperty().SetOpacity(col[3]) |
| 654 | |
| 655 | rv.append(actor) |
| 656 | |
| 657 | mapper = vtkMapper() |
| 658 | mapper.AddInputDataObject(data_edges) |
| 659 | |
| 660 | actor = vtkActor() |
| 661 | actor.SetMapper(mapper) |
| 662 | actor.SetPosition(*trans) |
| 663 | actor.SetOrientation(*rot) |
| 664 | actor.GetProperty().SetLineWidth(linewidth) |
| 665 | actor.SetVisibility(edges) |
| 666 | actor.GetProperty().SetColor(*edgecolor[:3]) |
| 667 | |
| 668 | rv.append(actor) |
| 669 | |
| 670 | return rv |
| 671 | |
| 672 | |
| 673 | def toVTK( |
no test coverage detected