几何尺寸与公差论坛------致力于产品几何量公差标准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-06, 02:35 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】how to export hideline data

how to export hideline data
how to export hideline data
i抦 looking to export some hideline image data to an external file.
to accomplish this i think i would need to:
1) open a dwg/dxf file,
2) create the view (top, front, iso? we would like to see the object.
3) display the model in a viewport applying this view.
4) trigger the viewport to display in hideline mode.
5) evaluate the viewports data for export to our file.
i have been successful with steps 1-3 using the included examples, i have played around with the vectorize example, but have been unable to accomplish steps 4 and 5. could you provide me with a basic outline (function calls) of the steps to do this.
thanks,
tom
additional info
to clearify
i have made a small change to the vectorize example by inserting a call to set the views mode to khiddenline
code:
/****************************************************/
/* prepare the device to render the active layout in */
/* this database. */
/****************************************************/
pdevice = oddbgsmanager::setupactivelayoutviews(pdevice, pdwgcontext);
pdevice->viewat(1)->setmode(odgsview::khiddenline);
/***************************************************/
/* set the screen size for the generated (vectorized) geometry. */
/***************************************************/
odgsdcrect screenrect(odgsdcpoint(0, 0), odgsdcpoint(1000, 1000));
pdevice->onsize(screenrect);
/******************************************************/
/* initiate vectorization */
/***************************************************/
pdevice->update();when i look at the output dump file for the run without this change (2cube_start_dump.txt) all of the edge information is included as i expected. however when i add the call to set the mode to hiddenline. the output dump file (2cube_hiddenline_dump.txt) the format is changed but all of the edges are listed, i was expecting just the (14) clipped and visible edges (see 2cube-hiddenline.jpg)
1)(408.2,813.0,0.0) to (662.8,666.0,207.9)
2)(662.8,666.0,207.9) to (535.5,592.5,311.9)
3)(535.5,592.5,311.9) to (280.9,739.5,104.0)
4)(280.9,739.5,104.0) to (408.2,813.0,0.0)
5)(280.9,298.4,-207.9) to (535.5,151.4,0.0)
6)(535.5,151.4,0.0) to (662.8,224.9,-104.0)
7)(280.9,298.4,-207.9) to (280.9,739.5,104.0)
8)(535.5,151.4,0.0) to (535.5,592.5,311.9)
9)(662.8,224.9,-104.0) to (662.8,666.0,207.9)
10)(280.9,298.4,-207.9) to (153.6,371.9,-311.9)
11)(153.6,371.9,-311.9) to (153.6,445.5,-259.9)
12)(153.6,445.5,-259.9) to (280.9,372.0,-155.9)
13)(153.6,445.5,-259.9) to (153.6,445.5,-259.9)
14)(153.6,445.5,-259.9) to ~(280.9,445.4,-259.8) (clipped by front cube)
it occurred to me that this is the geometry that is processed by the view, but the data i'm looking for is the primitive graphics to be displayed after the hiddenline processing. can you point me to where i can access this data?
thanks,
tom
attached images (199.7 kb, 3 views)
attached files (41.5 kb, 3 views)
(23.7 kb, 0 views)
(52.3 kb, 0 views)

you may look at exports\2dexport\source\2dexportdevice.cpp
and search all string containing "hlr" (short for "hidden line removal")
vladimir
i'm still not finding the output primatives? is there a sample using the 2dexportdevice.cpp i can debug thru?
tom
2dexportdevice.cpp is used e.g. in svg export. you may add the corresponding project (projectfiles\win32\msvc8\exports\svgdll\dd_svgexp ort_dll.vcproj ) to allexamplesdll solution, set breakpoint, run odamfcappdll sample, open some file and call file/svg export command.
vladimir

thank you, i'm now able to step thru the code as the data is exported.
to get back to my original question, how do i now get the exported svg file to only contain the visible lines after hide line removal - hlr? i loaded the 2cube file into the odmfcapp and set the active viewport to model (the active vectorizer is windirectx) then i select the file->export to svg option. unfortunately the output file is the entire image without any hidden line removal.
i have enclosed an image of the 2cube in the odmfcapp(odamfcapp_2cube sreen showing modelspace.jpg) - this is the desired output
also enclosed is a screen shot showing the exported svg file (2cube_svg file create by export.jpg).
and below i have also copied the text from the 2cube.svg file.
am i missing a step in the odmfcapp to get only the hlr data to export???
tom
code:
<?xml version="1.0" standalone="no"?>
<defs >
<clippath id="clipid0" >
<path d="m96,820 673,820 673,243 96,243 z" />
</clippath>
<clippath id="clipid1" >
<path d="m0,1024 768,1024 768,0 0,0 z" />
</clippath>
</defs>
<image width="1" height="1" xlink:href="t:\tom/image0.png" transform="matrix(768 0 0 1024 0 1.13687e-013)" />
<image width="1" height="1" xlink:href="t:\tom/image1.png" transform="matrix(768 0 0 1024 0 1.13687e-013)" />
<g stroke-width="0.1" clip-path="url(#clipid0)" fill="none" stroke="rgb(0,0,0)" />
<g stroke-width="0.25" clip-path="url(#clipid0)" fill="none" stroke="rgb(255,0,0)" >
<polyline points="509.075,403.609 313.486,290.685 " />
<polyline points="313.486,629.455 509.075,742.378 " />
<polyline points="313.486,290.685 215.692,347.147 " />
<polyline points="411.281,460.07 509.075,403.609 " />
<polyline points="411.281,460.07 411.281,798.84 " />
<polyline points="509.075,742.378 411.281,798.84 " />
<polyline points="215.692,685.917 313.486,629.455 " />
<polyline points="215.692,347.147 411.281,460.07 " />
<polyline points="509.075,403.609 509.075,742.378 " />
<polyline points="313.486,290.685 313.486,629.455 " />
<polyline points="215.692,347.147 215.692,685.917 " />
<polyline points="411.281,798.84 215.692,685.917 " />
<polyline points="264.589,601.224 166.795,544.763 " />
<polyline points="166.795,601.224 264.589,657.686 " />
<polyline points="166.795,544.763 117.897,572.993 " />
<polyline points="215.692,629.455 264.589,601.224 " />
<polyline points="215.692,629.455 215.692,685.917 " />
<polyline points="264.589,657.686 215.692,685.917 " />
<polyline points="117.897,629.455 166.795,601.224 " />
<polyline points="117.897,572.993 215.692,629.455 " />
<polyline points="264.589,601.224 264.589,657.686 " />
<polyline points="166.795,544.763 166.795,601.224 " />
<polyline points="117.897,572.993 117.897,629.455 " />
<polyline points="215.692,685.917 117.897,629.455 " />
</g>
<g stroke-width="0.1" clip-path="url(#clipid1)" fill="none" stroke="rgb(0,0,0)" >
<polyline points="95.5667,819.574 95.5667,242.585 672.557,242.585 672.557,819.574 95.5667,819.574 " />
</g>
you did not attach the file.
which dd version do you use?
(in old versions hlr was turned off, look at the command line in codamfcappdoc:nexportsvg() there should be "yes" at the end, after numbers)
i quote my resulting svg, from the attached file (with 3d hidden viewport visual style)
code:
<?xml version="1.0" standalone="no"?>
<defs >
<clippath id="clipid0" >
<path d="m0,768 1024,768 1024,0 0,0 z" />
</clippath>
<clippath id="clipid1" >
<path d="m146,763 879,763 879,30 146,30 z" />
</clippath>
<clippath id="clipid2" >
<path d="m0,768 1024,768 1024,0 0,0 z" />
</clippath>
</defs>
<g stroke-width="0.1" clip-path="url(#clipid0)" fill="none" stroke="rgb(0,0,0)" />
<g stroke-width="0.1" clip-path="url(#clipid1)" fill="none" stroke="rgb(0,0,0)" />
<g stroke-width="0.25" clip-path="url(#clipid1)" fill="none" stroke="rgb(255,0,0)" >
<polyline points="298.195,163.119 372.733,120.085 " />
<polyline points="298.195,163.119 372.733,206.154 " />
<polyline points="298.195,163.119 298.195,220.499 " />
<polyline points="298.195,163.119 372.733,206.154 " />
<polyline points="298.195,220.499 298.195,163.119 " />
<polyline points="298.195,163.119 372.733,120.085 " />
<polyline points="422.425,91.3951 472.117,120.085 " />
<polyline points="372.733,120.085 422.425,91.3951 " />
<polyline points="372.733,206.154 397.579,220.499 " />
<polyline points="372.733,206.154 397.579,220.499 " />
<polyline points="372.733,120.085 422.425,91.3951 " />
<polyline points="422.425,91.3951 472.117,120.085 " />
<polyline points="472.117,120.085 571.501,177.464 " />
<polyline points="472.117,120.085 571.501,177.464 " />
<polyline points="571.501,177.464 646.039,220.499 " />
<polyline points="571.501,177.464 646.039,220.499 " />
<polyline points="298.195,220.499 298.195,349.602 " />
<polyline points="298.195,349.602 298.195,220.499 " />
<polyline points="397.579,220.499 472.117,263.533 " />
<polyline points="397.579,220.499 472.117,263.533 " />
<polyline points="546.655,306.568 571.501,292.223 " />
<polyline points="472.117,263.533 546.655,306.568 " />
<polyline points="546.655,306.568 546.655,349.602 " />
<polyline points="546.655,306.568 571.501,292.223 " />
<polyline points="546.655,349.602 546.655,306.568 " />
<polyline points="472.117,263.533 546.655,306.568 " />
<polyline points="571.501,292.223 670.885,234.844 " />
<polyline points="646.039,220.499 670.885,234.844 " />
<polyline points="670.885,349.602 670.885,234.844 " />
<polyline points="571.501,292.223 670.885,234.844 " />
<polyline points="670.885,234.844 670.885,349.602 " />
<polyline points="646.039,220.499 670.885,234.844 " />
<polyline points="236.08,414.154 273.349,435.671 " />
<polyline points="173.965,450.016 236.08,414.154 " />
<polyline points="173.965,450.016 223.657,478.706 " />
<polyline points="173.965,450.016 173.965,478.706 " />
<polyline points="173.965,450.016 223.657,478.706 " />
<polyline points="173.965,478.706 173.965,450.016 " />
<polyline points="173.965,450.016 236.08,414.154 " />
<polyline points="236.08,414.154 273.349,435.671 " />
<polyline points="298.195,349.602 298.195,478.706 " />
<polyline points="298.195,478.706 298.195,349.602 " />
<polyline points="273.349,435.671 298.195,450.016 " />
<polyline points="273.349,435.671 298.195,450.016 " />
<polyline points="546.655,349.602 546.655,478.706 " />
<polyline points="546.655,478.706 546.655,349.602 " />
<polyline points="670.885,478.706 670.885,349.602 " />
<polyline points="670.885,349.602 670.885,478.706 " />
<polyline points="223.657,478.706 273.349,507.396 " />
<polyline points="173.965,521.74 273.349,579.12 " />
<polyline points="173.965,521.74 273.349,579.12 " />
<polyline points="173.965,478.706 173.965,521.74 " />
<polyline points="223.657,478.706 273.349,507.396 " />
<polyline points="173.965,521.74 173.965,478.706 " />
<polyline points="298.195,593.465 323.041,607.809 " />
<polyline points="298.195,593.465 323.041,607.809 " />
<polyline points="298.195,478.706 298.195,593.465 " />
<polyline points="298.195,593.465 298.195,478.706 " />
<polyline points="273.349,507.396 298.195,521.74 " />
<polyline points="273.349,579.12 298.195,593.465 " />
<polyline points="298.195,521.74 298.195,593.465 " />
<polyline points="273.349,579.12 298.195,593.465 " />
<polyline points="298.195,593.465 298.195,521.74 " />
<polyline points="273.349,507.396 298.195,521.74 " />
<polyline points="546.655,478.706 546.655,607.809 " />
<polyline points="546.655,607.809 546.655,478.706 " />
<polyline points="670.885,607.809 670.885,478.706 " />
<polyline points="670.885,478.706 670.885,607.809 " />
<polyline points="323.041,607.809 372.733,636.499 " />
<polyline points="323.041,607.809 372.733,636.499 " />
<polyline points="372.733,636.499 472.117,693.879 " />
<polyline points="372.733,636.499 472.117,693.879 " />
<polyline points="546.655,736.913 571.501,722.568 " />
<polyline points="472.117,693.879 546.655,736.913 " />
<polyline points="546.655,736.913 571.501,722.568 " />
<polyline points="546.655,607.809 546.655,736.913 " />
<polyline points="472.117,693.879 546.655,736.913 " />
<polyline points="546.655,736.913 546.655,607.809 " />
<polyline points="571.501,722.568 670.885,665.189 " />
<polyline points="571.501,722.568 670.885,665.189 " />
<polyline points="670.885,665.189 670.885,607.809 " />
<polyline points="670.885,607.809 670.885,665.189 " />
</g>
<g stroke-width="0.1" clip-path="url(#clipid2)" fill="none" stroke="rgb(0,0,0)" >
<polyline points="145.598,763.252 145.598,30.2919 878.559,30.2919 878.559,763.252 145.598,763.252 " />
</g>
</svg>attached files (386.9 kb, 2 views)

vladimir

thanks, now the output is correct.
i believe i'm using v2.5.1.0
i'm not sure if this is a bug, but in addition to looking at the svg files i was reviewing the dwf output files, and they appear to be flipped (see 2cube1 output to dwf.jpg). i have enclosed some output dwf file created from the 2cube1.dwg file.
tom
attached images (193.6 kb, 0 views)
attached files (8.2 kb, 0 views)
(3.2 kb, 0 views)
(8.2 kb, 0 views)
(4.7 kb, 0 views)

afaik it was fixed in 2.5.2
vladimir
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】how to add extended entity data yang686526 DirectDWG 0 2009-05-05 12:35 PM
【转帖】hot to get the data stored in dxfinfields of a custom obje yang686526 DirectDWG 0 2009-05-05 12:11 PM
【转帖】export data in different units yang686526 DirectDWG 0 2009-05-05 10:23 AM
【转帖】dwf export problem yang686526 DirectDWG 0 2009-05-04 08:19 PM
【转帖】哪位高手指点一下下边lisp的怎么用 yang686526 数据库ObjectDBX 0 2009-04-28 12:13 PM


所有的时间均为北京时间。 现在的时间是 12:02 PM.


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