高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】please advise on easiest way to modify a drawing
please advise on easiest way to modify a drawing
please advise on easiest way to modify a drawing
hi
i want to write a reasonably simple program (the basic project is already compilable) that updates a drawing.
what i have is a drawing with lots of different colours objects on the same layers. based on the layer and colour of the object, i can determine what it should be.
for example, imagine i have a layer in a drawing called "18" with some entities on it. maybe some are red, blue and green. now i know that the entities on layer 18 that are red are "lamp posts" and the blue ones are "gate posts" etc etc.
so, to begin with, i must iterate the model space entities, and for each entity i can get its layer name and colour (ofcourse, the colour might be bylayer, in which i must get the true colour, but they should all be hardcoded to a colour).
then, using this layer name and colour i can find the correct layer name for it.
this is the aspect of the program i want to talk about. the input drawing will have numerical layers. the output will be alphanumeric. so, can i simply modify the existing database in memory? can i determine the right layer, add it to the existing database if required, and update existing entity? this would save me the need to creating a new drawing and duplicating entities into the new drawing.
i would appreciate advice on this please before i go head deep into the sea...
thanks in advance.
andrew
yes you can modify loaded database in memory. add new layers, alter entity's layer and purge old layers.
but you need to iterate not only through model space but all other blocks too.
sergey slezkin
last edited by mmuratov; 2nd february 2004 at 08:16 amfff">.
the data in this drawing is only polylines, point, circles etc etc. there are no complex objects like inserts in it.
quote:
originally posted by ajtruckle
the data in this drawing is only polylines, point, circles etc etc. there are no complex objects like inserts in it.
what you meant to say is "the data in this drawing should contain only polylines, points, circles, etc., and should not contain complex objects such as inserts.
the fact of the matter is the drawing could contain such objects, and you have to be prepared to deal with them.
in the language of programmers, 'should' and 'should not" should not exist; only 'can' and 'cannot'.
for these reasons alone, you must process all of the blocks (including modelspace) in the block table.
we don't really need to argue about wording here do we? i am writing a utility for working with data produced by ourselves in microstation. our software systems do not support the additional features. yes, i admit they can be there, but it would be wrong.
at the most, all i would do is leave the objects untouched and warn user.
if i were doing a full blown shareware program, or if we were able to place inserts in within our digital image workstations, then fair enough.
but this routine is for internal use within my office, so i do know what is and is not allowed.
it was within this context that i said what i did.
but in general terms, ofcourse i agree with you.
andrew
|