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

svg vectorizing, textfills
svg vectorizing, textfills
now that i have successfully implemented the usage of text fill (dimtfill and dimtfillclr), i'm having some difficulties vectorizing the output to svg. the default implementation works as expected, but i have the need to be able to vectorize the drawing while changing the colors.
in odsvgdevice::setcurrtraits, i implemented a simple case statement, to determine if i should muck with the current color or not.
i do this, so i can convert from a "colored" autocad drawing to a black on white, white on black, color on black, or color on white output svg.
i know i could of also changed out the color pallets, but for the "simple" cases defined above, it seemed more logical to implement it within setcurrtraits.
now the issue i am having is, svg doesn't natively support a background color, so internally i create a rect that is 2 x the size of the viewport, and then i center it upon the viewport. this works, but then when i wish to vectorize a dimension with a back color set to background, it becomes a bit obscure.
i want to "muck" with the color used in the rendering of the rect for the text background, but i need to be able to distinguish it from other solids. initially, i looked at drawcontext()->effectivetraits(), and was looking at the filltype, but that is eliminating the arrow heads as well.
is there a means of determining what entity we are vectorizing at the device (odsvgdevice) level?
is there any way to determine if we are drawing the fill color of the text entity, verses the arrow head of a dimension?
i'm thinking if it is possible, it will be related to the odgiconveyorcontext from drawcontext(), i just can't seem to find out where to go with it.
appreciate all of the help thus far, and i hope someone can give me an idea where to go on this.
last edited by jacob.hoover@greenheck.com; 28th september 2007 at 02:41 pmfff">.
odgiconveyorcontext::currentdrawable returns current obejct being vectorized.
vladimir
i'm still not able to determine the proper color at this point, mainly due to the fact that at the point i am changing colors the geometry is broken down to it's primitives.
at this point, i'm considering using pen sets. i am wondering if their are any licensing issues i should be aware of? as well, is there a particular method of the system/host services that i can override so i can load the file from a custom storage location?
you should not add this "background" rectangle to dwg, add it to svg instead (like it is done in svg export actually, see svg::rootnode())
what are "pen sets"?
vladimir
pen sets being the ctb files. so in particular i would be looking at the grayscale and monochrome ctb's
i am not adding the background in cad, and i am creating a rect in the svg root node.
specifically, i'm looking for a means to render a dimension with a text fill color set to background. the initial problem is that svg doesn't "natively" support a background color, so when rendering the blocks are coming out differently than the artificial background color i imposed.
*ps* sorry for the lack of autocad terminology, but i have limited experience with cad.
last edited by jacob.hoover@greenheck.com; 9th october 2007 at 02:49 pmfff">.
i've made it a bit further... but i am still stuck...
so far, i have added the plot setting validator and plot style service module/app loaded. from that, i can create a file pointing to a ctb file, and then i call odgicontextfordbdatabase::loadplotstyletable .
what would the next step be to tell the app to use this style in the rendering process?
you may look at svgexportcommand::execute() in exports\svgexport\source\svgexport.cpp
where od2dexportloadplotstyletable() is called. look inside the call to see details.
vladimir
i'm still spinning my wheels here..
is there a restriction on vectorizing model space to svg that it will not use plot styles?
code:
oddbblocktablerecordptr playoutblock = _pdb->getactivelayoutbtrid().safeopenobject();
oddblayoutptr playout = playoutblock->getlayoutid().safeopenobject(oddb::kforwrite);
playout->setplotplotstyles(true);
_asserte(playout->plotplotstyles());
playout->setshowplotstyles(true);
_asserte(playout->showplotstyles());

odstreambufptr pfilebuf;
odstring sfilename = _t("c:\\monochrome.ctb");
odstring sstylename = _t("monochrome.ctb");
_services.accessfile(sfilename, oda::kfileread); // sfilename is the ctb file

pfilebuf = _services.createfile(sfilename);
odpsplotstyleservicesptr ppss = odrxdynamiclinker()->loadapp(odps_plotstyle_services_appname);
odpsplotstyletableptr pmyplotstyle = ppss->loadplotstyletable(pfilebuf);
oddbplotsettingsvalidatorptr pplotsettings = this->_services.plotsettingsvalidator();
odresult res = pplotsettings->setcurrentstylesheet(playout, sstylename );
odgicontextfordbdatabaseptr pdwgcontext = odgicontextfordbdatabase::createobject();
pdwgcontext->setdatabase( _pdb );
// do not render paper
pdwgcontext->setplotgeneration( true );
pdwgcontext->loadplotstyletable(pfilebuf);//
...
odgslayouthelperptr phelper = oddbgsmanager::setupactivelayoutviews( dev, pdwgcontext );
...
phelper->onsize(screenrect);
// initiate rendering.
phelper->update( 0 );
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】question about vectorizing different layout from same dxfdw yang686526 DirectDWG 0 2009-05-07 12:14 PM
【转帖】question about japanese text vectorizing yang686526 DirectDWG 0 2009-05-07 12:11 PM
【转帖】problem vectorizing oddbregion yang686526 DirectDWG 0 2009-05-06 11:03 PM
【转帖】meshproc edge visibility and vectorizing question yang686526 DirectDWG 0 2009-05-06 05:44 PM
【转帖】error in vectorizing yang686526 DirectDWG 0 2009-05-05 09:40 AM


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


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