[ORD CONNECT C#/C++] How to Set the Reference property of Terrain?

The reference property will be shown when the terrain element was referenced from another model.

I can check "Override Symbology" to "Yes" and set override element template, and the terrain element can be in different style in different models.

So how to do this by using C# or C++ code?

Parents
  • Hi Redrum,

    I recommend to move your question to Civil programming forum. This is general Developers and Programming forum, where a knowledge of ORD features is not expected. To move existing discussion to another forum, use More > Move tool, available under your original post.

    The reference property will be shown

    What is "reference property"? It's not MicroStation term and I think ORD also do not use such terminology.

    So how to do this by using C# or C++ code?

    Did you try (because it's basic test that can be used often) VBA property handler to change the setting?

    Alternatively, to analyze how the element is represented as EC instance (check what EC schemas and EC properties are available) can provide information, whether the settings can be accessed (and changed optionally) this way.

    With regards,

      Jan

  • I recommend to move your question to Civil programming forum.

    OK, I will move it later.

    What is "reference property"?

    "Reference" property is a panel in terrain element property, you can find it in the image I marked.

    Did you try (because it's basic test that can be used often) VBA property handler to change the setting

    Sorry but I never use VBA and I don't know how to test it.And I tried to get all EC instances in the element and the attachment, but I didn't find anything helpful.

  • "Reference" property is a panel in terrain element property

    In my opinion, to use standard terminology and to say e.g. you are interested in settings in Reference group (or panel) in Properties dialog expresses your question clearer and with no confusion.

    Or, when you want to use Property term, it's cannot be used with Reference, because it's just a group name. In the discussed context, the element properties are Override Template and Override Symbology.

    Sorry but I never use VBA

    So, learn it, where is problem? Even when VBA is limited ancient tool, it allows to test many things quickly and to evaluate ideas in few minutes.

    Property handlers allows to access settings, displayed in Properties dialog, so they can be used as a test tool whether specific value is accessible, using what access string and whether it can be changed.

    And I tried to get all EC instances in the element and the attachment

    Without seeing the code (and also to have a test data), I can assume only what you did and what you received.

    From your description (my ORD knowledge is limited) it's about extra settings, applied on top element or reference file attachment. I can imagine it's represented as EC instance, attached to the element (with a link to the reference?) or to attachment itself. So not only elements, but also attachments (different type of ECQuery), including possible relationship classes, should be analyzed.

    ORD uses EC data extensively, so it often requires to analyze what can be obtained using API (which is often a lot of EC instances with a lot of EC properties) and to compare it with ORD schemas.

    My experience (primarily from MicroStation) is that when any setting, feature or property is represented as EC and is not defined as read-only property, it can be modified.

    With regards,

      Jan

  • What I mean "Reference Property" is the reference property group and its sub-property Override Template and Override Symbology of course.

    I will try to use VBA later, and I request my workmate to do this, but we found nothing useful.

    The following code is a part of getting EC instances of element and attachment, but I cannot get anything related to reference or override property.

    foreach (var attachment in dgnmodel.GetDgnAttachments())
                {
                    DgnModel attachModel = attachment.GetDgnModel();
    
                    Element attachEle = dgnmodel.FindElementById(attachment.GetElementId());
    
                    foreach (var ele in attachModel.GetElements())
                    {
                        Bentley.TerrainModelNET.Element.DTMElement dtmEle = ele as Bentley.TerrainModelNET.Element.DTMElement;
    
                        if (dtmEle != null)
                        {
                            //try CustomItemHost
                            CustomItemHost host = new CustomItemHost(attachModel);
                            var items = host.CustomItems;
    
                            host = new CustomItemHost(dtmEle, true);
                            var items2 = host.CustomItems;
    
                            host = new CustomItemHost(dtmEle, false);
                            var items3 = host.CustomItems;
    
                            host = new CustomItemHost(attachEle, true);
                            var items4 = host.CustomItems;
    
                            host = new CustomItemHost(attachEle, false);
                            var items5 = host.CustomItems;
    
                            //Try DgnECManager FindInstances
                            FindInstancesScope scope = FindInstancesScope.CreateScope(attachment, new FindInstancesScopeOption(DgnECHostType.Attachment));
                            ECQuery query = new ECQuery();
                            query.SelectClause.SelectAllProperties = true;
                            var instances1 = DgnECManager.Manager.FindInstances(scope, query);
    
                            FindInstancesScope scope2 = FindInstancesScope.CreateScope(dtmEle, new FindInstancesScopeOption(DgnECHostType.Element));
                            ECQuery query2 = new ECQuery();
                            query.SelectClause.SelectAllProperties = true;
                            var instances2 = DgnECManager.Manager.FindInstances(scope, query);
    
                            //Try DgnECManager GetElementProperties
                            var instances3 = DgnECManager.Manager.GetElementProperties(attachEle, ECQueryProcessFlags.AutoLoadModelOfRelated | ECQueryProcessFlags.SearchAllClasses | ECQueryProcessFlags.SearchAllExtrinsic);
    
                            var instances4 = DgnECManager.Manager.GetElementProperties(dtmEle, ECQueryProcessFlags.SearchAllClasses);
                        }
                    }
                }

  • and I request my workmate to do this, but we found nothing useful

    Really? The question is what you did. When you use property handler snippet available in VBA help, you should be able to access (and change) the override definitions.

    Which also gives a hope the data is available at the element itself. Also, the access string can be used to search ORD schemas to try to find where (in what schema) and how (using what EC class or EC property) the override setting is defined.

    The following code is a part of getting EC instances of element and attachment, but I cannot get anything related to reference or override property.

    You use ORD API, so I am not able to say whether it's right, but probably yes.

    GetElementProperties should return a collection that contains (and I am pretty sure it does) EC instance with the discussed properties.

    With regards,

      Jan

Reply Children
No Data