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

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】how to retrieve simple features from entities (http://www.dimcax.com/hust/showthread.php?t=16758)

yang686526 2009-05-06 03:10 PM

【转帖】how to retrieve simple features from entities
 
how to retrieve simple features from entities
how to retrieve simple features from entities
hi,
i am new with the use of this library. i need to convert a dwg into a simpler model composed of simple polygons, polylines and points dwg files in 2d (on shape files). i look at the documentation and see three way to retrieve geometric information.
the entity way : retrieve entities and extract for each one of them the information related to it. this is called "the long and painful way".
the worlddraw way : retrieve entities and extract only the geometry from it in a worlddraw call. interesting but is there a way to retrieve only polygon, polylines, text and pointsfrom the odgiworldgeometry?
the renderer way : looking in this forum in the thread "true type fonts in vectorizeex" explain we could remove everything from the odgigeometrysimplifier to keep only polylineproc() and polygonproc(). all i have to do is to use a renderer (exrender, svg exports, etc) and transpose this geometry. however, i would like to keep an access to the oddbentity objects (to access non-geometry information around it) and i would like to sort these entities using the layer name. is it possible?
regards
last edited by theman; 10th september 2004 at 06:18 amfff">. reason: correction

quote:
originally posted by theman
the worlddraw way : retrieve entities and extract only the geometry from it in a worlddraw call. interesting but is there a way to retrieve only polygon, polylines, text and pointsfrom the odgiworldgeometry?
worlddraw way with possibility to get only defined set of primitives is the render way.
quote:
originally posted by theman
all i have to do is to use a renderer (exrender, svg exports, etc) and transpose this geometry. however, i would like to keep an access to the oddbentity objects (to access non-geometry information around it) and i would like to sort these entities using the layer name. is it possible?
yes, it is possible. layer accessible through the traits (see samples), entity id accessible through oddbobjectid(drawcontext()->currentdrawabledesc()->persistid). function odgibasevectorizer::drawcontext() returns pointer to draw context (odgiconveyorcontext instantiation).
sincerely yours,
george udov
so, the best way is...
quote:
worlddraw way with possibility to get only defined set of primitives is the render way.
so you suggest me to use the worlddraw on entities. i have already some code written to handle entities. what i presume in my implementation is odgiworldgeometry methods could call a odgigeometrysimplifier class containing an implementation managing simple geometric types. is it a correct approch?
best regards and thanks for the quick reply.
last edited by theman; 10th september 2004 at 10:43 amfff">. reason: correction

odgigeometrysimplifier implements odgiconveyorgeometry interface. classes odgibasevectorizer and odgsbasevectorizeview implement a hook from odgiworldgeometry/odgiviewportgeometry to odgiconveyorgeometry interfaces. so i think it is good for you to look into odvectorizeex sample .
sincerely yours,
george udov


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