几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-05-05, 11:59 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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
}
}
}
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



所有的时间均为北京时间。 现在的时间是 03:59 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多