For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

AIS2D_ProjShape

jelle's picture
Forums: 

has anyone perhaps has some code to share that deals with the "AIS2D_ProjShape" class?
its a class that uses the HLR projection of TopoDS_Shape in a 2d viewer, which is something really useful if you're interested in writing postscript / plotting files...

thanks,

-jelle

Alexey Gorshkolep's picture

There is my pieces of code, but I think it contains a memory leak and I can't fix it.
try{
V3d_Coordinate DX,DY,DZ,XAt,YAt,ZAt, Vx,Vy,Vz ;
myView->Proj(DX,DY,DZ);
myView->At(XAt,YAt,ZAt);
myView->Up( Vx,Vy,Vz );
Standard_Boolean IsPerspective = (myView->Type() == V3d_PERSPECTIVE);
Quantity_Length aFocus = 1;
Prs3d_Projector aPrs3dProjector(IsPerspective,aFocus,DX,DY,DZ,XAt,YAt,ZAt,Vx,Vy,Vz);
HLRAlgo_Projector aProjector = aPrs3dProjector.Projector();
//HLRAlgo_Projector myProjector = HLRAlgo_Projector(gp_Ax2(gp_Pnt(0.,0.,0.), gp_Dir(0.,0.,-1.)));
Handle(AIS2D_ProjShape) myProj = new AIS2D_ProjShape();
myProj->SetPolyAlgo(Standard_False);
myProj->SetHLMode(Standard_False);
myProj->ShowEdges(/*aSharp*/ Standard_True, /*Smooth*/ Standard_True, /*aSewn*/ Standard_False, /*anOutline*/ Standard_True, /*anIsoline*/ Standard_False) ;
for ( myAISContext->InitSelected(); myAISContext->MoreSelected(); myAISContext->NextSelected() )
{
myProj->Add(myAISContext->SelectedShape());
}
myProj->SetProjector(aProjector);
Handle(Prs2d_AspectLine) myAspect = new Prs2d_AspectLine();
myAspect->SetColor(Quantity_NOC_STEELBLUE4);
myAspect->SetWidth(Aspect_WOL_THIN);
myProj->SetAspect(myAspect);
myAIS2dContext->Display(myProj, Standard_True);
}
catch(Standard_Failure){}

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.