![]() |
【转帖】reading data from a dwg file
reading data from a dwg file
reading data from a dwg file hi, i have to write a c++ program which reads some data from a dwg file and writes it into a text file. i've already studied the odreadex example project, but i'm stuck. i want to read some attributes from the dwg file. anyone who can help me? thanks in advance! hi, you want to read some attribute entities (related to block inserts)? or simply some common entity properties - if so then which exactly do you want to read? best regards chudomir quote: originally posted by chudo hi, you want to read some attribute entities (related to block inserts)? or simply some common entity properties - if so then which exactly do you want to read? i want to read the attribute entities related to block inserts and find some attribute entities with a certain name and write the name of the attribute and the value to a text file. how can i iterate all block inserts and read the attributes related to them? to get all the block references (this example is for the model space): code: oddbblocktablerecordptr pmodelspace = pdb->getmodelspaceid().safeopenobject(); oddbobjectiteratorptr pi = pmodelspace->newiterator(); for (pi->start(); !pi->done(); pi->step()) { oddbentityptr pent = pi->entity(); if (pent->iskindof(oddbblockreference::desc())) { oddbblockreferenceptr pblockref = pent; /*here you can use the block reference*/ /*see the docs for more information about oddbblockreference::attributeiterator and oddbattribute*/ } //if } //for (i haven't compile this so if you have any problems please let me know; also exceptions are possible to be thrown, so catch(oderror&) is needed at outer level) hope this helps... best regards chudomir |
所有的时间均为北京时间。 现在的时间是 06:39 AM. |