void viewerLines_linePresentation::Compute(const Handle(PrsMgr_PresentationManager)& prsMgr,
const Handle(Prs3d_Presentation)& prs, const Standard_Integer mode)
{
if (m_points.IsNull())
return;
const Standard_Integer nbVertices = m_points->VertexNumber();
Handle(Graphic3d_ArrayOfPolylines) prims = new Graphic3d_ArrayOfPolylines(nbVertices);
for (Standard_Integer pointsIt = 1; pointsIt <= nbVertices; ++pointsIt)
{
prims->AddVertex(m_points->Vertice(pointsIt));
}
Handle(Graphic3d_Group) group = prs->NewGroup();
group->SetGroupPrimitivesAspect(Attributes()->LineAspect()->Aspect());
group->AddPrimitiveArray(prims);
}
Hey @udoS! I would very appreciate if you elaborate a bit on whether the custom presentation resolves the performance issue? Does it work for you? How much complex toolpath you can create display with acceptable speed now?Hallo Natalia
Thanks a lot for this. Finally I got it to work with QtCreator with Linux Debian10.
Now. : I create the line from live-points that come from an actual cnc-position.
There are two situation: high and low speed; changing at any given time.
I like to display this in two different colors of the line.
In your example while running wirelines_presentations press a bottom to change color. How to ?
A little help would be nice.
Thanks again.
void viewerLines_linePresentation::Compute(const Handle(PrsMgr_PresentationManager)& /*prsMgr*/,
const Handle(Prs3d_Presentation)& prs, const Standard_Integer /*mode*/)
{
if (m_points.IsNull())
return;
const Standard_Integer nbVertices = m_points->VertexNumber();
Handle(Graphic3d_ArrayOfPolylines) prims = new Graphic3d_ArrayOfPolylines(nbVertices);
for (Standard_Integer pointsIt = 1; pointsIt <= nbVertices; ++pointsIt)
{
prims->AddVertex(m_points->Vertice(pointsIt));
}
Handle(Graphic3d_Group) group = prs->NewGroup();
group->SetGroupPrimitivesAspect(Attributes()->LineAspect()->Aspect());
group->AddPrimitiveArray(prims);
// visualization of the lines in additional color
// Here each point is translated on a fixed value and painted in blue color.
Handle(Prs3d_LineAspect) color2Style = new Prs3d_LineAspect(Quantity_NOC_BLUE, Aspect_TOL_SOLID, 1);
Handle(Graphic3d_ArrayOfPolylines) prims2 = new Graphic3d_ArrayOfPolylines(nbVertices);
for (Standard_Integer pointsIt = 1; pointsIt <= nbVertices; ++pointsIt)
{
prims2->AddVertex(m_points->Vertice(pointsIt).XYZ() + gp_Pnt(0.5, 0.5, 0.).XYZ());
}
Handle(Graphic3d_Group) group2 = prs->NewGroup();
group2->SetGroupPrimitivesAspect(color2Style->Aspect());
group2->AddPrimitiveArray(prims2);
}