
Tue, 02/03/2009 - 17:48
Forums:
How can I put the TPrsStd_PointDriver, TPrsStd_AxisDriver and the TPrsStd_PlaneDriver to use and display Points, Axes and Planes.
How can I put the TPrsStd_PointDriver, TPrsStd_AxisDriver and the TPrsStd_PlaneDriver to use and display Points, Axes and Planes.
Tue, 02/03/2009 - 18:54
Below you can see how i display a plane :
Handle(TDataStd_Plane) aDFPlane;
if (!aResultLabel.FindAttribute(TDataStd_Plane::GetID(),aDFPlane))
TDataStd_Plane::Set(aResultLabel);
aPresentation = TPrsStd_AISPresentation::Set(aResultLabel, TDataStd_Plane::GetID());
aPresentation->Display(Standard_True);
...
where aResultLabel contains a valid TNaming_NamedShape repsesanting a plane.aPresentation is of type Handle(TPrsStd_AISPresentation).
The same way you can use the other presentation drivers.
Fotis
Wed, 02/04/2009 - 04:29
Fotis,
Thanks for the solution. I have been displaying the point by creating a TopoDS_Shape from BRepBuilderAPI_MakeVertex and displaying it directly using TNaming_NamedShape::GetID(). The solution you have given also has solved my problem of changing the vertex color after displaying it. Now I think the AIS_Point is being used internally to represent the presentation and hence updates change of color properly.
BTW for plane can I make a TopoDS_Face from BRepBuilderAPI_MakeFace with a plane and use it?
And BRepBuilderAPI_MakeEdge with Geom_Line for Axis?
Thanks Again!
Wed, 02/04/2009 - 10:57
Hello Nair !
Using BRepBuilderAPI_MakeFace and BRepBuilderAPI_MakeEdge and assigning its value to a TNaming_NamedShape , with this TNaming_NamedShape you can create accordingly TPrsStd_PlaneDriver and TPrsStd_AxisDriver OCAF based presentations.
You can also use TPrsStd_GeometryDriver based presentations by utilising TDataStd_Geometry objects(hint: use TDataStd_Geometry::SetType method for correct usage).
Fotis
Wed, 02/04/2009 - 11:28
Hi Fotis
Thanks for the info. Actually I am trying to follow a design where actual geometry will not be exposed to or created by the user. I think this will help in the feature creation easily. e.g. when the user creates a circle, he sees a circle on the screen but actually it would be a wire. This paradigm I think will help further in easier usage of the circle for creating a prism say, the algo can take the wire directly instead of getting a circle and then building a wire in the prism algo. The selection of OCC also supports the query topological ehtities and sub-entities rather than geometry directly. Geometry retrieval can be done from the topological entity as and when required. This is my view in my development of a feature based modeller. Your suggestions and experiences will also give me better insight. Thanks again.