几何尺寸与公差论坛------致力于产品几何量公差标准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, 10:17 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】exploding block references = invisible entities

exploding block references + invisible entities
exploding block references + invisible entities
i have a dwg file that i am not being able to display correctly. i can access and render all the entities but i render more than what is needed. is there a way to tell that a certain entity should not be displayed. i have tried pentity->visibility() and it works fine but only for certain entities.
i know that it can be done because (1) autocad does it; (2) free dwg viewer does it.
i also figured that the issue some where in explode() because if i select the block in autocad and explode it, more entities show up - the extra ones that i get in program.
i have attached grayscale versions of screenshots to show what i mean by invisible entities. do you think the issue might be viewport related?
attached images
spatial clip can be applied to block reference. after explode clip information is lost.
one more thing: after explode attribute entities attached to block reference are lost. and attribute definitions contained in block get visible.
sergey slezkin
quote:
spatial clip can be applied to block reference
i think i can manage that. if i am thinking correctly, this info can be obtained from getgeomextents().
quote:
after explode attribute entities attached to block reference are lost. and attribute definitions contained in block get visible
... and they should not be rendered. right?
- jaydutt shuklafff">
extents are not enougth. spatial clip can be represented by a polyline plus min and max z. and the polyline boundary can be in other than xy plane.
if a block has attribute definitions attribute entities can be attached to block reference. in this case atribute entities are displayed and attribute definitions not. after explode attributes are lost and attribute definitions get visible - try to explode block reference with attributes in autocad.
sergey slezkin
quote:
originally posted by sergey slezkin
extents are not enougth. spatial clip can be represented by a polyline plus min and max z. and the polyline boundary can be in other than xy plane.
and where can i find this info. i don't see any method in blockreference or entity class that gives me a boundary. the closest method that i see is attributeiterator() which will iterate through all entities in the blockref. but then there is no way to tell if an entity is the boundary for the blockref. what am i missing?
a question regarding viewports: is it possible to get the entities visible in a paper_space viewport without explicitly going through the model_space? i am planning on collecting all viewports in a list; then going through model_space entities and rendering relevant part of each entity in relevant viewport. that means the same entity could be drawn twice on the dcs (device coordinate system??) and i dont think anything is wrong with that. i find the need to iterate through all model_space entities inefficient. additionally, there is a possibility of certain entities not being shown in a viewport. for e.g. furniture or electrical fixtures might be omitted.
- jaydutt shuklafff">
last edited by jaydutt; 13th february 2006 at 07:06 pmfff">.
block reference clip boundary:
code:
oddbobjectid idxdic = pblkref->extensiondictionary();
if(!idxdic.isnull())
{
oddbdictionaryptr pxdic = idxdic.openobject(oddb::kforread);
if(!pxdic.isnull())
{
oddbdictionaryptr pfilterdic = pxdic->getat("acad_filter", oddb::kforread);
if(!pfilterdic.isnull())
{
oddbspatialfilterptr pspfilter = pfilterdic->getat("spatial", oddb::kforread);
if(!pspfilter.isnull())
{
if(pspfilter->isenabled())
{
odgiclipboundary boundary;
pspfilter->getdefinition(boundary);
boundary.m_bdrawboundary = pdb->getxclipframe();
// use the clip boundary
pwd->geometry().pushclipboundary(&boundary);
}
}
}
}
}
viewport entity in paper space defines view parameters for model space visible through the viewport (view direction, view height, width etc.) so where is no other way than iterating through the ms entities. viewports have a list of layers frozen in this viewport. entities on frozen layers are not rendered. so even if 2 viewports display the same area of ms some entities can be visible in one viewport and invisible in another one.
sergey slezkin
wow! i would have never figured that out.
btw m_points, are the points expressed in wcs or relative to m_ptpoint?
what is the difference between modelspace and worldspace?
what is the difference between clipspace and blockspace?
and the data that defines the boundary has only points, no curves. i believe this means that the boundary consists of linesegs only and not any other kind of curve (eg arc, ellipse or spline).
i also think that the points define the vertices of the boundary in counterclockwise order. right?
thx.
- jaydutt shuklafff">
last edited by jaydutt; 14th february 2006 at 05:23 pmfff">.
m_points are 2d. the plane they are located in is defined by normal and 3d origin point (m_ptpoint).
m_points array define 2d polyline boundary. if where are 2 points in array they represent corners of rectangle. in case of polyline boundary direction (cw/ccw) is not defined.
clip space is coordinate system in which 2d boundary is defined (they are in xy plane in this coordinate system).
block space - coordinate system in which entities inside block are defined.
also note that block references with spatial clip can be nested and more than one spatial filter can be active at a time.
if you use dd vectorization (like odvectorizeex or other samples) you need not care about all these things.
sergey slezkin
quote:
if you use dd vectorization (like odvectorizeex or other samples) you need not care about all these things
and once the vectorization is complete, how would i get hold of the vectorization. meaning how can i access individual curves and text? through the dictionary returned by properties?
properties - returns a smartpointer to the dictionary containing the properties for this device object
=====================
i went through odvectorizeex example again and it seems to me that odgidumperimpl class has a whole bunch of callback functions ( odgidumperimpl:utput(...) ) that are called by the actual vectorizer. which means that i would have to provide my own implementation of odgidumperimpl and there i can receive the vectorized entities and process them as i wish.
- jaydutt shuklafff">
i just found this document in the help:
quote:
creating a custom vectorization device object
an example of a minimal device class is the following exgssimpledevice class. the odgiconveyorgeometry overrides (polylineout, circleproc, etc.) receive and process geometry generated by the dwgdirect vectorization framework.
code:
class exgssimpledevice :
public odgsbasevectorizedevice,
public odgigeometrysimplifier // receives 3d data from the dwgdirect
// vectorization framework.
{
and the class overrides some of the odgigeometrysimplifier methods. i figured those are the methods that i need to override to process entities myself. is the odgsbasevectorizedevice still needed as a base class?
=========
other than that can you help me differentiate between:
code:
void plineproc(const odgipolyline& lwbuf,
const odgematrix3d* pxform,
oduint32 i,
oduint32 numsegs);
and
code:
void polylineproc(odint32 nbpoints, const odgepoint3d* pvertexlist,
const odgevector3d* pnormal = 0,
const odgevector3d* pextrusion = 0, odint32 lbasesubentmarker = -1);
- jaydutt shuklafff">
i had another question. i now kind of follow the flow of odvectorizeex example but how can i specify whether i want entities from the p_s or m_s?
what i am thinking of right now is that iffff"> the vectorizer blindly vectorizes all entities regardless of which block they are in, then i can erase a block and then unerase it. kind of like frozen layers that you mentioned earlier.
- jaydutt shuklafff">
what class to use as a base depends if you need odgsbasevectorizedevice functionality or not. surely if you override all its methods (and never call its methods) you need not use it as base.
difference between 2 polyline functions is in their arguments. note that odgipolyline like oddbpolyline can have arc segments and widths.
what is vectorized depends on you :-)
see odvectorizeex - it vectorizes active layout (calls setupactivelayoutviews())
another example is bmp export (see excustobjs\cmd_bmpout.cpp) it can vectorize active layout or specified block.
dwf export (which also uses vectorization framework) is able to produce multi-page dwf with all layouts.
sergey slezkin
i haven't tried it but i assume through pdb->layoutdictionaryid().safeopen()->iterator() i can get the ids of layouts, from there i can proceed to getting names, listing them, and setting user-selected layout as the active layout and then proceeding from there onwards.
but for some reason i am getting a wierd access violation error. i probed into it and figured it was coming from
code:
<my code> calling
oddbgsmanager::setupactivelayoutviews
oddbgsmanager::_setuppaperviews
odgspaperlayouthelper::initgsview
odsmartptr<odabstractviewpe>:dsmartptr<odabstractviewpe>
odsmartptr<odabstractviewpe>::internalqueryx
odgsviewimpl::queryx
odqueryximpl <<======== here
it is an access violation caused by dereferencing null pointer. apparently, odgsviewimpl::desc() is returning null when called from odqueryximpl. then dereferencing happens and an exception is thrown at me.
and i am using precisely the same code as in odvectorizeex for this part:
code:
if (!pdb.isnull())
{
// begin vectorization.
...
pdevice->update();
// end vectorization.
the derived classes are setup as
code:
class exgssimpledevice : public odgsbasevectorizedevice,
public odgigeometrysimplifier
class exsimpleview : public odgsbasevectorizeview
instead of file* i am using my own entity receiver but i don't think that is a problem. it is not be even accessed at this time. device::createview() is working fine.
- jaydutt shuklafff">
at this point, i have directly copy-pasted simpledevice, simpleview, dumper, dumperimpl and conveyorgeometrydumper files into my project. for some reason, the example (odvectorizeex) works fine but my project does not.
more probing led me to this map. identical to what i posted earlier but with more info:
code:
<my code> calling
oddbgsmanager::setupactivelayoutviews ( pdevice, pctx )
oddbgsmanager::_setuppaperviews ( ??? ) /* private function? */
odgspaperlayouthelper::initgsview ( odgsview* pview, const oddbviewport* pvp )
/* something happens here */
odsmartptr<odabstractviewpe>::c'tor ( pobj )
odsmartptr<odabstractviewpe>::internalqueryx ( pobj )
(odgsviewimpl / pobj)::queryx ( odabstractviewpe::desc() )
odqueryximpl ( this [equiv. pobj]fff">, odabstractviewpe::desc() )
here,fff"> this->desc() returns null andfff"> this->desc()->detach() causes the crash.
at this point my conclusion is that my custom exgssimpleview class is required to override desc() method or somehow i must let the od framework know that i have derived a class from one of its classes and then the framework should create a odrxclass for the custom view class. is there a macro for that?
- jaydutt shuklafff">
why isn't this in the documentation? i found it in rxobject.h
code:
/** description:
declares the runtime type identification functions
required by odrxobject objects.

remarks:
any class derived from odrxobject should include
this macro in its class declarations, passing its own name.
*/
#define odrx_declare_members(classname) \
actually it is but not where i would expect it to be. i would expect a remark about it on the odrxobject page. additionally, couldn't find it in odvectorizeex either!! that's more of a anomaly. well i found it, that's what matters. i will include the macro in the class definition. but i still don't get it, how does odvectorizeex work without including the macro?
a lots of thx for your help so far.
- jaydutt shuklafff">
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】color problem with hatch while vectorization yang686526 DirectDWG 0 2009-05-04 05:55 PM
【转帖】cloning a block yang686526 DirectDWG 0 2009-05-04 05:50 PM
【转帖】block entities are not erased after the block deleting yang686526 DirectDWG 0 2009-05-04 04:46 PM
【转帖】a dimension error yang686526 DirectDWG 0 2009-05-04 03:05 PM
【转帖】editing blocks per drawing shee yang686526 SolidWorks二次开发 0 2009-04-13 10:39 AM


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


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