how can i change line type?

hi i have drawn to skeches to diffranciate i want to change its line type. how can i do that?

i have gone through some of heders like Aspect_LineType, Prs2d_Type etc but not able to undestand how should i use it.......

thanks in advance !!!!!!

Svetlozar Kostadinov's picture

Try this:

myDrawer = new AIS_Drawer();
myDrawer->SetLineAspect(Prs3d_LineAspect(...));
myInteractiveObject->SetAttributes( myDrawer );

varad's picture

thanks a lot man

varad's picture

hi i ve tried the code u mentioned here but got some problem

i m having a member fun of doc file now when i write following code

Handle(AIS_InteractiveObject)CurObject = new AIS_InteractiveObject;
Handle(AIS_Drawer) myDrawer = new AIS_Drawer;
Handle(Prs3d_LineAspect) Lasp = new Prs3d_LineAspect(Quantity_NOC_RED,Aspect_TOL_DASH,1);

myDrawer->SetLineAspect(LAsp);
CurObject->SetAttributes( myDrawer );

for above code it is giving a runtime error at setting atribute ( that is on lastline)

so i ve tried some more part comented last line and added

myAISContext->SetLocalAttributes(CurObject,myDrawer);

here no error occurs but it dont chenges any aspect....

Svetlozar Kostadinov's picture

Look at the second line, I've change it.

Handle(AIS_InteractiveObject)CurObject = new AIS_InteractiveObject;
Handle(Prs3d_Drawer) myDrawer = myAISContext->DefaultDrawer();
Handle(Prs3d_LineAspect) Lasp = new Prs3d_LineAspect(Quantity_NOC_RED,Aspect_TOL_DASH,1);

myDrawer->SetLineAspect(LAsp);
CurObject->SetAttributes( myDrawer );

Shing Liu's picture

Hi, varad:
Try the following code:
// Make three dot dash line axis.
Handle_AIS_Shape xAxis = new AIS_Shape(BRepBuilderAPI_MakeEdge(gp_Pnt(-5000,0,0), gp_Pnt(5000, 0, 0)));
Handle_AIS_Shape yAxis = new AIS_Shape(BRepBuilderAPI_MakeEdge(gp_Pnt(0,-5000,0), gp_Pnt(0,5000, 0)));
Handle_AIS_Shape zAxis = new AIS_Shape(BRepBuilderAPI_MakeEdge(gp_Pnt(0, 0,-5000), gp_Pnt(0, 0, 5000)));
Handle_Prs3d_LineAspect lineAspect = new Prs3d_LineAspect(Quantity_NOC_WHITE, Aspect_TOL_DOTDASH, 1);

xAxis->Attributes()->SetWireAspect(lineAspect);
yAxis->Attributes()->SetWireAspect(lineAspect);
zAxis->Attributes()->SetWireAspect(lineAspect);

myAISContext->Display(xAxis, false);
myAISContext->Display(yAxis, false);
myAISContext->Display(zAxis, false);