Hello,
I want display a point instead a sphere but I have not found how to draw this point has three coordinates. (Is there a method for points as BRepPrimAPI_MakeSphere for display of a sphere)
Thanks.
EricThompson Mon, 04/05/2010 - 22:05
What you're looking for is:
BRepBuilderAPI_MakeVertex( gp_Pnt pnt );
Also note that the point will display as a yellow +. If you want to change how it looks, you need to work with the PointAspect of the AIS_Shape you create. So your code might look something like this:
// Create the vertex
gp_Pnt pnt( 0,0,0 ) // Use your coordinates here!
TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex( pnt );
// Create the AIS_Shape
Handle(AIS_Shape) aShape = new AIS_Shape(V1);
// Set the vertex shape, color, and size
Quantity_Color color(Quantity_NOC_RED);
Handle_Prs3d_PointAspect myPointAspect=new Prs3d_PointAspect(Aspect_TOM_O,color,2);
aShape->Attributes()->SetPointAspect(myPointAspect);
There is a noticable performance hit for creating many AIS_Shapes. If you have a lot of points, and they do not need to be individually selectable, you can stuff them all into a TopoDS_Compound and create a single AIS_Shape.
The code might look like this:
// Create a compound shape to hold the points
TopoDS_Compound compoundShape;
BRep_Builder compoundBuilder;
compoundBuilder.MakeCompound( compoundShape );
// Create the points and add to the compound shape
for ( int i=0; i
If you are want more that 1000 points I recommend you to use after Compound use Mesh for compounded shape. Or triangulate.
If you are using the OCC Application Interface you must use:
also you can make color. And If you don't want use AIS_PointPresentation you make set for AIS point prs->GetAIS()->Attributes()->SetPointAspect and disable here all that you don't want to see...
I have 100000 points but I don't understand what recommend to use after Compound use Mesh for compounded shape.
I want display the points without edge.
thank you for your help
Hi! I think you may use the triangulate because after compounding you have Shape that are Is not optimized. I make my test and may see that after 10000 point I'm have compound my saved file was 1 Mb, but after Triangulation It's 68 Kb.
You describe a surface points, and in a case with a triangulation in co-ordinates of tops of triangles. The volume of the information is much less, besides much bigger compatibility with others CAD systems. By the way, as I have understood algorithm HLR uses MESH for creation of the flat image.
There no bad sample in 02_7_TopologyTrianguation. It's very simple.
Mon, 04/05/2010 - 22:05
What you're looking for is:
BRepBuilderAPI_MakeVertex( gp_Pnt pnt );
Also note that the point will display as a yellow +. If you want to change how it looks, you need to work with the PointAspect of the AIS_Shape you create. So your code might look something like this:
// Create the vertex
gp_Pnt pnt( 0,0,0 ) // Use your coordinates here!
TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex( pnt );
// Create the AIS_Shape
Handle(AIS_Shape) aShape = new AIS_Shape(V1);
// Set the vertex shape, color, and size
Quantity_Color color(Quantity_NOC_RED);
Handle_Prs3d_PointAspect myPointAspect=new Prs3d_PointAspect(Aspect_TOM_O,color,2);
aShape->Attributes()->SetPointAspect(myPointAspect);
Tue, 04/06/2010 - 12:52
Thank you very much Eric
Tue, 04/06/2010 - 17:22
viewing points is market but it is very long slow
there exists a method that can accelerate the displaying of points.
thak you.
Tue, 04/06/2010 - 17:37
viewing points is market but it is very slow
there exists a method that can accelerate the displaying of points.
thak you.
Tue, 04/06/2010 - 18:42
There is a noticable performance hit for creating many AIS_Shapes. If you have a lot of points, and they do not need to be individually selectable, you can stuff them all into a TopoDS_Compound and create a single AIS_Shape.
The code might look like this:
// Create a compound shape to hold the points
TopoDS_Compound compoundShape;
BRep_Builder compoundBuilder;
compoundBuilder.MakeCompound( compoundShape );
// Create the points and add to the compound shape
for ( int i=0; i
Tue, 04/06/2010 - 18:48
Sorry about the typo in the for loop, apparently I can't include a less-than sign in a post.
it should read: for( int i=0; i less-than count; i++ )
Tue, 04/06/2010 - 20:09
thank you very much.
exactly what I want.
Tue, 04/06/2010 - 20:25
If you are want more that 1000 points I recommend you to use after Compound use Mesh for compounded shape. Or triangulate.
If you are using the OCC Application Interface you must use:
also you can make color. And If you don't want use AIS_PointPresentation you make set for AIS point prs->GetAIS()->Attributes()->SetPointAspect and disable here all that you don't want to see...
#include "point.h"
#include
#include
#include
#include
#include
#include
#include
#include "TNaming_Builder.hxx"
#include "BRepBuilderAPI_MakeVertex.hxx"
QString createpoint::mpoint(TDF_Label MainLab,const double myX , const double myY , const double myZ, const QString Name)
{
//! Ñîçäàþ èíòåðàêòèâíûé îáúåêò ñ àòðèáóòàìè:
// Point Label - ñîçäàííàÿ ìåòêà
// Ïðèñâàèâàþ àòðèáóòû â ñëåäóþùåì ïîðÿäêå:
// 0 -- òèï îáúåêòà (óíèêàëüíûé êîä äëÿ ëþáîãî îáúåêòà)
// 0:0 -- ÎÏÈÑÀÍÈÅ (èìÿ)
// 1 -- ÃÅÎÌÅÒÐÈß
// 1:0 -- ÎÏÈÑÀÍÈÅ
// 1:1 -- X1
// 1:2 -- Y1
// 1:3 -- Z1
// Íîâàÿ ìåòêà â ñòðóêòóðå
TDF_Label L = TDF_TagSource::NewChild(MainLab);
// Òèï îáúåêòà - ïðèìèòèâ
TDataStd_AsciiString::Set(L,"Point");
//Èìÿ
TDF_Label level0 = L.FindChild(0,Standard_True);
TDataStd_AsciiString::Set(level0.FindChild(0), Name.toAscii().data()); //èìÿ
// Ãåîìåòðèÿ:
TDF_Label level1 = L.FindChild(1,Standard_True);
TDataStd_Real::Set(level1.FindChild(1), myX);
TDataStd_Real::Set(level1.FindChild(2), myY);
TDataStd_Real::Set(level1.FindChild(3), myZ);
//Ñòðîþ òî÷êó
gp_Pnt aPnt(myX,myY,myZ);
BRepBuilderAPI_MakeVertex mkVertex (aPnt);
TopoDS_Shape ResultShape = mkVertex.Shape();
TNaming_Builder B(L);
B.Generated(ResultShape);
//Äîáàâëÿþ åå â äîêóìåíò
Handle(TPrsStd_AISPresentation) prs = TPrsStd_AISPresentation::Set(L,TNaming_NamedShape::GetID());
//Îòîáðàæàþ íà ýêðàíå
prs->Display(1);
//Âñå ïîñòðîåíî ïåðåäàþ ðåçóëüòàò ïî ðàáîòå
QString complete;
QTextStream message(&complete);
message << trUtf8("Ïîñòðîèëè òî÷êó ïî êîîðäèíàòàì:") << " X " << QString::number(myX) << " Y " << QString::number(myY) << " Z " << QString::number(myZ)
<< trUtf8(" Èìÿ: ") << QString::fromUtf8(Name.toAscii().data());
return complete;
}
createpoint::createpoint() { }
createpoint::~createpoint() { }
Wed, 04/07/2010 - 16:23
I have 100000 points but I don't understand what recommend to use after Compound use Mesh for compounded shape.
I want display the points without edge.
thank you for your help
Wed, 04/07/2010 - 21:38
Hi! I think you may use the triangulate because after compounding you have Shape that are Is not optimized. I make my test and may see that after 10000 point I'm have compound my saved file was 1 Mb, but after Triangulation It's 68 Kb.
You describe a surface points, and in a case with a triangulation in co-ordinates of tops of triangles. The volume of the information is much less, besides much bigger compatibility with others CAD systems. By the way, as I have understood algorithm HLR uses MESH for creation of the flat image.
There no bad sample in 02_7_TopologyTrianguation. It's very simple.
Fri, 12/09/2011 - 05:22
thank you very much.
I am improved after reading your words.
Thank you once more!
Fri, 12/09/2011 - 05:33
thank you very much.
I am improved after reading your words.
Thank you once more!