Custom Linestyles won't resymbolize if they are in a reference file

We have an MDL application (since ported to Native Code) that resymbolizes elements on the fly based on user specified criteria.  Changing Color, Style, and Weight are the most common uses and this application has worked just fine for many years.  I am in the process of modernizing it by adding support for Named Levels and Custom Linestyles.

The issue I'm having is trying to resymbolize lines\linestrings within attached reference files with a custom linestyle defined (actually in a RSC file) in the MASTERFILE (the custom linestyles have never been placed in these reference files).  Even though I am adding the custom linestyle to the element descriptor (and validating it is there via mdlElement_hasLineStyle()), the custom linestyle refuses to display.  The only way I can get the custom linestyle to display properly is to either copy the element into the MASTERFILE (in the code) or open the reference file as the main file and place a sample line with the target custom linestyle.  These are not desirable as this application is meant only to resymbolize the display of the elements without altering the underlying dgn files.

I understand that this issue is likely caused by the reference file not having the custom linestyle definitions loaded - how can one accomplish this without physically touching each of the 1000+ dgn files that we use as reference files (they are provided by a third party).

All thoughts and commentary are greatly appreciated!

Thanks,

Jeff 

  • Hi Jeff,

    Unknown said:
    We have an MDL application

    I recommend to read and follow MicroStation Programming forum best practices, especially rules about sharing mandatory information. From your post it's not clear even very important information if you are talking about some older MicroStation version, V8i or CONNECT Edition ... and if you are talking about MicroStation or some other product ;-)

    Unknown said:
    I am in the process of modernizing it by adding support for Named Levels and Custom Linestyles.

    It's a bit off-topic, but still related to development: Is such application, with respect to existing MicroStation resymbolization features, necessary? But I guess you need something more complex than straight simple resymbolization of elements created with "by level" attributes. In CONNECT Edition, Display Rules can be used also.

    Unknown said:
    The issue I'm having is trying to resymbolize...

    It's not clear how your code works, can you provide more details? Do you hook element display process (how?), stop it and provide own element instead of an original one?

    Unknown said:
    I understand that this issue is likely caused by the reference file not having the custom linestyle definitions loaded

    In my opinion there is nothing like "loaded by references": If a line style definition comes from RSC file, it's available for the whole session (active model and all attachments). Today the line styles can be also stored directly in a design file (if they were stored in dgnlib originally) and in such case I guess this definition is available for a specific reference only. But you mentioned you work with RSC.

    Unknown said:
    All thoughts and commentary are greatly appreciated

    Because I don't know how you code works, I can guess only: There are plenty of other settings related to reference attachments like reference presentation (view) attributes, attachment settings like scale etc. that influe how line style is displayed. If you place manually a target line style (element using this style) into the reference, is it displayed correctly?

    With regards,

      Jan

  • Please follow the MicroStation Programming forum best practices.

    Identify Your Platform

    Please identify the version of MicroStation, or other product such as PowerDraft, that you are using: MicroStation CONNECT or MicroStation V8i. What is the 8-digit version number (e.g. 10.xx.yy.zz) of MicroStation?

    If you're using MicroStation in a ProjectWise (PW) managed environment, let us know that too.

    The APIs supplied with MicroStation CONNECT are different to those supplied with MicroStation V8i. Consequently, our answers are likely to be different.

    MDL Development

    Unknown said:
    We have an MDL application ported to Native Code

    So far, so good!  But tell us what platform you are using.

    Unknown said:
    I am adding the custom linestyle to the element descriptor (and validating it is there via mdlElement_hasLineStyle()

    Code Syntax Highlighting

    When you post code, use the Forum advanced editor's syntax highlighting tool. That's the icon that resembles a pencil:  Syntax Highlighter

    Unknown said:
    I understand that this issue is likely caused by the reference file not having the custom linestyle definitions loaded

    If the hosting application is MicroStation (which, as Jan writes, you haven't actually told us), then MicroStation has opened and owns any required resources. If you think about it, how would a reference file (a piece of read-only data) load anything?

     
    Regards, Jon Summers
    LA Solutions

  • Hi Jan/Jon,

    Thanks for the responses, I should have been more clear originally, but here is more information.  I'm having some difficulty with the quoting, so I hope this comes across formatted ok.

    I recommend to read and follow MicroStation Programming forum best practices, especially rules about sharing mandatory information. From your post it's not clear even very important information if you are talking about some older MicroStation version, V8i or CONNECT Edition ... and if you are talking about MicroStation or some other product ;-)

    We are currently using MicroStation SS1 (8.11.07.171). Yes, time for an upgrade. :)

    jeff.clough

    I am in the process of modernizing it by adding support for Named Levels and Custom Linestyles.

    It's a bit off-topic, but still related to development: Is such application, with respect to existing MicroStation resymbolization features, necessary? But I guess you need something more complex than straight simple resymbolization of elements created with "by level" attributes. In CONNECT Edition, Display Rules can be used also.

    Correct, it is a legacy application that we have used for many years and have several workflows around it.  Migrating to CONNECT is a ways away.  We are upgrading to SS4 soon.
    jeff.clough
    The issue I'm having is trying to resymbolize...

    Yes, precisely.  Elements are intercepted before they are displayed, resymbolized, then displayed.

    Public void updateV8i_init(void) {
    // Add update each element hook...
    mdlView_setSubstituteElemFunc (substituteElemCallback);
    }

    I understand, but the behaviour that I'm seeing leads me to believe otherwise. The elements read from a reference file do not display with the custom linestyles available to the active file. Perhaps this is controlled by a reference file setting?  If so, I have not been able to find it.
    This is the behaviour I'm seeing (all steps are done in code unless otherwise specified):
    1. Add a custom linestyle to a line that resides in the active file -> displays with the new linestyle
    2. Add a custom linestyle to a line that resides in an attached reference file -> does not display with the new linestyle
    3. Add a custom linestyle to a line that resides in an attached reference file and copy that element to the active file -> displays with the new linestyle
    4a. Open the reference file as the active file, place a sample line using the target custom linestyle, then go back to the original active file (manual step)
    4b. Add a custom linestyle to a line that resides in that attached (now modified) reference file -> displays with the new linestyle.
    
    

    Because I don't know how you code works, I can guess only: There are plenty of other settings related to reference attachments like reference presentation (view) attributes, attachment settings like scale etc. that influence how line style is displayed. If you place manually a target line style (element using this style) into the reference, is it displayed correctly?

    With regards,

      Jan

    Yes, manually placing a line with the target custom line style in the reference file works as expected.
    Thanks,
    Jeff