by bonsalty » Tue Sep 15, 2009 1:17 pm
Of course you have to call Polyline in the entity section. The reason it doesnt work might be that you use incorrect parameters in DL_PolylineData.
I will add my code.
Im using my own wrapper class. I defined the entities(line,polyline,hatch,circle,etc) each as a class, and for each class type there is a vector, that holds the entities I draw.
For instance the class polyline has variables like layer name,color,line width and of course the coordinates for each vertex.
Here is my code for the polyline caddrawing:
for (int i=0;i<polylines.size();i++){ // for each polyline
DL_PolylineData(polylines[i].NumOfVertex,0,0,0), DL_Attributes(polylines[i].Layer.Name, polylines[i].Color, polylines[i].Width,polylines[i].Ltype.Name));
for (int j=0;j<polylines[i].NumOfVertex;j++){ //for each vertex in poly
dxf->writeVertex(*dw,DL_VertexData(
polylines[i].Polyline.GetX(j),
polylines[i].Polyline.GetY(j),
polylines[i].Polyline.GetZ(j),0));
} //end for each vertex
dxf->writePolylineEnd(*dw);
}//end for each polyline
So: polylines[i] is the vector of my polyline class.
You have to know how many verteces each polyline consist of.
I store this number in polylines[i].NumOfVertex
In DL_PolylineData( polylines[i].NumOfVertex, ... ) you have to define how many verteces you are using and you must call
dxf->writeVertex(...) exactly the same time, otherwise it wont display anything.
I hope it was helpfull