LET OP!!! 
Dit Python-script wordt geleverd als voorbeeld van wat je zou kunnen doen met Python. Als het niet werkt of niet het gewenste effect heeft dan zul je zelf met de Python Assistent aan de slag moeten om het werkend te krijgen. 


Aanleiding:

Een collega had een Key-in gevonden waarmee alle shared cells in een tekening naar een cellenbibliotheek geschreven konden worden (Key-in: Export cells shared). Alleen waren niet alle cellen in de tekening 'shared' en dus werden niet alle cellen meegenomen naar de cell-bibliotheek.

Binnen de standaard-functionaliteit van MicroStation kunnen we wel van shared cellen normale cellen maken (Drop Element), maar niet andersom.


Prompt:

We hebben een script gevraagd waarin alle cellen in de tekening omgezet moesten worden naar shared cells.

Het ging niet meteen helemaal goed, maar na een tweetal keer foutmeldingen als prompt ingeladen te hebben, kregen we onderstaande tool.


Python:

Python omschrijft de verschillende handelingen die nodig zijn als volgt:

Convert all normal (graphic/point) cell instances in the active model into shared cell instances, using the same cell name and origin.


Implementation notes / limitations:

  • Only converts CELL_HEADER_ELM instances (normal cells) in the *active model*.
  • For each distinct cell name found, a Shared Cell Definition is created once in the active model, using the first instance as a template.
  • Each normal cell instance is then replaced by a Shared Cell instance referencing that definition, at the same origin and rotation.
  • Existing normal cell instances are deleted from the model.