I have a question about the Cell instances, I have a model created with Microstation CE, from the Cell Library, I place a Cell( for example, Cell1) three times, then i have three Cell instances in the model,
those 3 instances are from the same Cell library, so they have the same shapes(lines, arcs.. mesh....) , the question is that is there any way i can check those 3 cell instances are from the same Cell defined in the cell library?
a few comments:
Labyrinth Technology | dev.notes() | cad.point
thanks Jan, I will check the other post again, actually that post did not answer my questions directly. anyway, thanks,
BTW, this post is in the communities.bentley.com/.../microstation-programming---forum
Rick cheng said:actually that post did not answer my questions directly.
As far as I remember, it think it discussed the whole topic in quite complete way. But if there is anything unclear or specific, please identify area not covered the discussion.
In your origina post, there are two separate topics:
Rick cheng said:Is there any way I can check those 3 cell instances are from the same Cell defined in the cell library?
You need to distinguish between MicroStation normal cells and MicroStation shared cells.
Normal cells are created as models in a cell library. When a MicroStation user places an instance of a normal cell, the model is copied from the cell library to the active DGN model. There is subsequently no connection between the cell instance and the library.
Usually cell instances are placed at different coordinates. They may be scaled. They may be rotated. A user might assign a new name to the cell, using the Element Information dialog. Consequently, it could be simple or quite hard to determine whether two normal cell instances are identical or from the same cell library.
When a user places a shared cell instance, the first thing that MicroStation creates is a shared cell definition element in the active DGN file. The definition is created from the cell chosen from a cell library. There is subsequently no connection between the shared cell definition and the library. As the user continues to place cell instances, MicroStation creates a reference to that shared cell definition for each shared cell instance. Each shared cell instance is quite small, and references its definition in the same DGN file.
Each shared cell instance in a DGN model refers to the shared cell definition having the same name. Usually shared cell instances are placed at different coordinates. They may be scaled. They may be rotated. But they all refer to the same shared cell definition.
Regards, Jon Summers LA Solutions
yes, u are right, there are two topics, and i am taking about normal cells, shared cells is easy to identify.
thanks Jon for the detailed reply. what i am talking is about the Normal cells, I know shared cells, so I can handle shared cell instances on my side.
for normal cell instances, they are in different coordinates, and can be scaled, rotated as you mentioned, also can be renamed, so it it hard to determine where there are from the same cell library. what i am doing now is try to do some investigation to try to tell whether the normal cell instances are from the same cell library, actually to check whether those cell instances have the same geometry( except the different coordinates, scale, rotation, name..). for example, a cell install have only a line geomerty, what i am trying to do is that found all the cell instance that have only one line, and the line's length, and direction..., i know is hard, but wantt to evaluate whether it is possible from technical perspective.
again, thanks for the reply.
A "possible" approach would be to extract the scale/position/rotation/name from an existing cell. Using the name, read the cell from the cell library and apply the scale/position/rotation to that newly read cell. Now, for each cell, create an ElementAgenda (i.e. list) of the cell "parts" (i.e. their component elements). So now you have two "lists" of elements and you can compare each element in the list as you see fit.
Rick cheng said:try to tell whether the normal cell instances are from the same cell library
As Jan wrote, it's possible that two cell libraries could each contain a model (cell) having the same name. Over the years we have read on the MicroStation Forum how much grief that possibility has created for standards checking.
Rick cheng said:for example, a cell install have only a line geomerty, what i am trying to do is that found all the cell instance that have only one line, and the line's length, and direction..., i know is hard, but wantt to evaluate whether it is possible from technical perspective
You're right: it is hard. I suggest that you design a C# CellSignature class. A CellSignature will contain a map of element types, indexed by count. Two cells that contain identical elements will have identical maps. If they contain identical elements, you can continue to match the geometry of each element.
There may be better ways to do what you want, but the signature concept has worked for me elsewhere.
make sense, I will have a try, thanks,
that's a good ideal, I will discuss with my team mates. thanks,