[V8i/CE C++] How to publish DGN with references to i-model

Hi,

my question is about the best workflow in V8i, but I think the same can be asked for CE implementation, so I included both versions in the subject.

I have DGN file with references (often) and more models in the main DGN file (sometimes). Some elements in models contain data in custom format, partially depending on extrernal data sources. I need to publish DGN file to i-model package including the custom data. During the conversion, the original files have to remain unchanged.

What is a recommended workflow and best practice? I do not ask how to convert custom data to "i-model supported format", this part is implemented already, I am able to create EC schema(s) based on custom data structures and to attach EC data to elements, and it works fine. My question is about how to manipulate with elements, models and references.

One alternative I have thoguht about is to make a copy of the whole structure, do necessary data conversion, and to use i-model API (imodelPublisher class etc.) to publish model(s) with references.

I read i-model Primer in MicroStation Programmer Guide, but I think I do not understand well enough the description when work DGN file should be used and how references are supported in the described workflow. When I simplify the workflow described in the guide, it's:

  1. Open DGN file and model to be published.
  2. Use mdlUndo_mark function to avoid changing original data.
  3. Use ElementGraphicsProcessor or any toher type of scanning to scan the model content.
  4. When necessary, convert custom data to EC data, create EC schema also (I have working code, fully in C# now).
  5. Set i-model publishing parameters and to publish the file.

What I miss in the description is when to rewert changes (I guess when i-model publishing is finished) and also (more important) when and how to modify more models in opened DGN file and attached references.

With regards,

  Jan

Parents
  • Hi Jan,

    I will need to investigate a few options and if needed I may need to check with the MicroStation iModel publishing developer with a proposed workflow/solution to this workflow.

    Thank you,
    Bob



  • Hi Bob,

    it would be great.

    I think to copy everything to temp structure > convert > publish temp files > delete everything will work fine, but there are also some not so nice features:

    • It requires to copy the whole active design file > all models > all references to temp folder, which is easy until ProjectWise is involved.
    • It requires to open all files and models, which is not user friendly.

    ... and it seems MicroStation uses a different approach, because references are published at background, but it's not clear whether the process can be hooked using API.

    With regards,

      Jan

  • Hi Jan,

    We do have (4) imodel publishing related examples in the MicroStation CONNECT SDK, though I presume have seen/reviewed these already but if not please take a quick look:

    Most recent examples

    • IModels\DgnIModelNative
    • IModels\DgnIModelNETExample

    Older examples

    • IPCs\IPCManagedExample
    • IPCs\IPCNativeExample

    I will keep you posted and thank you for mentioning ProjectWise likely to be involved,

    Bob



  • We do have (4) imodel publishing related examples in the MicroStation CONNECT SDK, though I presume have seen/reviewed these already

    Well, I did, but it was some time ago, so I will do it again ;-)

    My two comments are that for now I have to implement it on V8i, because API to obtain external has not been ported to CE yet. But it will be, so there is also option to use some simpler (like copy everything out) in V8i and to do it better and more integrated in CE later.

    What I remember (but it's something I will have to check again) the examples do not demonstrate how to work with reference attachments including modificaiton of existing elements with new data.

    Regards,

      Jan

  • Hi Jan,

     

    Like you have mentioned while publishing the file MS traverse through all the reference attachments and publish them all. So currently there is no API which you can use to publish reference individually. But I would like to understand the use case where you need an API to publish the references.

     

    But if you want package some document with iModel then we have the APIs for that and that is EmbedDocumentsInPackage (WString documentName) which you can use to embed the document.

     

    Thanks,

    Mahendra

  • Hi Mahendra,

    thanks for you answer. My question is not about to publish references individually. I will try to explain my situation and needs using a simplified example:

    • There is a design file.
    • In the design file, there are one (default) or more models.
    • Every model can have zero or some references, probably not too complex, but it's not important for further discussion.

    ... so it's about "just an average design file" ;-)

    Some elements in the main model and attached references contain custom data. Even though the format is different, you can imagine it as mslinks to external system. Using this data and proprietary API, it's possible to retrieve further information relevant to a particular element.

    Important feature is that the data are not "i-model compatible", because of the format itself (XAttributes are used) and they are partially stored outside DGN file. A requirement is to provide the same information in i-model files too, which requires to convert the custom data into EC format, before or as a part of publishing process. A mandatory requirement is that original files (active and references) cannot be modified. My question is what is the best way to achieve it in V8i and (in future) in CONNECT Edition.

    I am able (implemented in C#):

    1. Tto iterate through the active model
    2. Test whether the custom data are attached to an element
    3. Using 3rd party API analyze the data structure and to create EC schema and store it in DGN file
    4. To attach EC instance to the element.

    I am also able to call i-model publishing API through C++/CLI from my Addin application.

    A solution I am working on, is:

    1. To copy the whole structure (active design file plus all references including references for models in active design file) to a temporary folder.
    2. To iterate through all these files and to create EC schemas and EC data.
    3. In the last step, to return back to the main active design file (its copy) and to call i-model publishing API.

    Two disadvantages I see here (but have not analyzed them in detail yet) are:

    • It's visually ugly, because MicroStation swtich between different files and folders.
    • When DMS (like ProjectWise) is used, to copy out files can require extra manipulation / code.

    But maybe there is some other way:, e.g. to obtain every element before it's published to i-model, through existing API.

    From SDK documentation I understand I can use mdlUndo_mark to be able to modify active model (add EC data) and to keep the original file unchanged. But the same approach cannot be used for references...

    I will check existing examples in EC SDK, regardless my main effort is still V8i platform, because the functionality is planned to migrate to CE also.

    My current plan is to implement the mentioned simple approach (to offer i-model publishing process quickly) and to improve implementation incrementally.

    With regards,

      Jan

  • Hi Jan,

    Thank you for clarifying the workflow with Mahendra, myself, and others. One question that may help provide an additional workflow or options...

    The final published iModel: should it be WYSIWYG (from original design - view) and could it be "flattened" (all elements stored in only one model w/proprietary data stored in EC form)?

    Thank you,
    Bob



Reply Children
No Data