高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】hatches again
hatches again
hatches again
hello.
somebody knows some example to see something about the import of hatches into different structures like polygons, polylines, etc.
i want to read dwg or dxf files and save the information in my own structures in c++ but i don't know how to extract the information from the hatches (type, color, etc).
thank you in advance.
david.
if you need hatch loops use getloopat().
if you need stroke lines use numhatchlines(), gethatchlinedataat() or gethatchlinesdata().
see dbhatch.h
sergey slezkin
well, basically i have two questions.
first, what's a hatch which is a solid? it's a polygon?
and second, if the hatch loop type is not a polyline, what's the operation which could tell me what's the type? (cicle, ellipse, etc...)
thank you.
david.
hatch may have a number of loops. they can be external or defining an island (hole).
each loop can be a polyline or defined by a number of edges. one of getloopat() functions return a polyline and another - edge array (pointers to odgecurve2d inheritors). edges can be odgelineseg2d, odgecircarc2d, odgeelliparc2d and odgenurbcurve2d. the type of edge can be determined by odgeent2d::type() function.
sergey slezkin
hello sergey.
first of all, thank you for your last answer. i have another question now. how can you know when you can a polyline or a list of edges? with the hatch type?
and more, how can you know the hatch type. for example, i know that if type is 7, that's a polyline, external and derived. but, what if, for instance, type is 22? how could i know the meaning of this number?
i don't know if you can understand me, i'm trying to explain my doubts as clear as possible.
thank you.
oddbhatch::looptypeat(int) returns odint32 flags. the return value is combination of bit flags defined in hatchlooptype enum. for example kpolyline=2.
so
[code
if (phatch->looptypeat(i) & oddbhatch::kpolyline)
{
// polyline loop
}
else
{
// edge array
}
[/code]
sergey slezkin
problem with hatch
hello .
we have problem with this file,exactly with island in solid hatch.
we use code like this
<code>
if(pent->looptypeat(i) & oddbhatch::kpolyline)
{
pent->getloopat(i, vertices, bulges );
}
</code>
but we get for three islands :
number of vertexs 4 ,3 ,6 ( you can see output in hatch_problem.bmp),but number of bulges 0 .
how can we get another vertex or curve (circural arc etc. )with these island?
attached images (857.0 kb, 10 views)
attached files (13.2 kb, 7 views)
hi,
getloopat return array of vertices and corresponding bulges. if bulge is zero next segment is line and if bulge is not zero segment is arc. in your case first 揾ole?loop contains following vertices:
vertex[0] = 14.691020271064536 , 23.103755602345228
bulge[0] = -0.69863425544509383
vertex[1] = 14.848575387631280, 23.337263294721907
bulge[1] = 0.85976540112268440
vertex[2] = 15.671811807383769, 25.323542201820914
bulge[2] = -0.67636273350989407
vertex[3] = 15.776608347568954, 25.964728972152017
bulge[3] = -1.8552911740744056
code:
if (looptype & oddbhatch::kpolyline)
{
odgepoint2darray vertices;
odgedoublearray bulges;
phatch->getloopat(i, vertices, bulges);
if (vertices.size() > 1)
{
for (int j = 0; j < vertices.size(); j++)
{
if (j < bulges.size() && bulges[j] != 0.0)
{
// this is arc-segment
}
else
{
// this is line-segment
}
}
}
|