Complex element

Hello,

We are trying to create a "complex element" via API.

The data is in X,Y,Z format and we managed to create the horizontal "complex element". We "profiled" the "complex element" as well, but it doesn't show up in 3D, because the "3D lineal element" is not created.

In the "Default" 2D view if I select a "complex element" that is "profiled" manually, there are 2 elements/entities a "complex element" and a "3D linear element", the one we have created has only the "complex element" but has an "active profile".

Can someone, please shed some light where we're wrong?

Any help is very much appreciated.

Thank you in advance.

Regards,

Val.

Parents
  • Hi Val,

    I am assuming you've used AlignmentEdit and ProfileEdit classes to create the alignment and the profile. try to use the AlignmentEdit.SetActiveProfile method, like the code below:

    AlignmentEdit al;
    // Create the alignment
    
    ProfileEdit prof;
    // Create the profile
    
    al.SetActiveProfile(prof);
    //Persist the changes

    I hope it helps.

    Regards,

    Henrique

  • Thank you Henrique!

    We managed to have it fully working now.

    Can you please tell us how to programmatically change the feature definition of a corridor? We managed to create a corridor in a program but haven't figured out how to change the feature definition.

    Another issue is the discrepancy between stationing in Explorer and Corridor Elements, please see attached. This happens whenever we have station equations or we change the station of the start of alignment.  

    We are using the station calculation from the "GeometryHelper" class and the calculations are correct, but we don't know where the discrepancy comes from.

    Parametric constraints are affected too.

    Thank you for your support.

    Happy holidays.

    Regards,

    Val.

  • Hi,

    1. Unfortunately the DSK doesn't provide a method to set a feature definition to the corridor; 

    2. Could you post the code that is causing the stationing issue?

    Regards,

    Henrique

  • Hello Valeriu,

    I was able to change the corridor feature definition using EC properties.  The property name is "ObjectSettings".

            private void _UpdateCorridorFeaterDef()
            {
                if (lstFeatures.SelectedIndex < 0)
                    return;
    
                string sName = lstCorridors.Text;
                if (!dictCorridors.TryGetValue(sName, out Corridor corr))
                    return;
    
                string sFeat = lstFeatures.Text;
    
    
                Bentley.DgnPlatformNET.DgnEC.FindInstancesScope scope
                    = FindInstancesScope.CreateScope(corr.Element, new FindInstancesScopeOption(DgnECHostType.Element, true));
    
                var query = new ECQuery();
                query.SelectClause.SelectAllProperties = true;
                ECQueryProcessAccessor.SetIn(query.ExtendedDataValueSetter, ECQueryProcessFlags.SearchAllClasses);
    
    
                DgnECInstanceCollection inst = DgnECManager.Manager.FindInstances(scope, query);
    
                int i = 0;
                foreach (IDgnECInstance instance in inst)
                {
                    Bentley.ECObjects.Instance.IECPropertyValue valueF = null;
    
                    foreach (Bentley.ECObjects.Instance.IECPropertyValue value in instance)
                    {
                        if (value.Property.Name == "ObjectSettings")
                        {
                            valueF = value;
                            break;
                        }
                        i++;
                    }
                    if (valueF != null)
                    {
                        valueF.StringValue = sFeat;
                    }
                }
    
    
    
            }
    

    Regards,

    Andrew

Reply
  • Hello Valeriu,

    I was able to change the corridor feature definition using EC properties.  The property name is "ObjectSettings".

            private void _UpdateCorridorFeaterDef()
            {
                if (lstFeatures.SelectedIndex < 0)
                    return;
    
                string sName = lstCorridors.Text;
                if (!dictCorridors.TryGetValue(sName, out Corridor corr))
                    return;
    
                string sFeat = lstFeatures.Text;
    
    
                Bentley.DgnPlatformNET.DgnEC.FindInstancesScope scope
                    = FindInstancesScope.CreateScope(corr.Element, new FindInstancesScopeOption(DgnECHostType.Element, true));
    
                var query = new ECQuery();
                query.SelectClause.SelectAllProperties = true;
                ECQueryProcessAccessor.SetIn(query.ExtendedDataValueSetter, ECQueryProcessFlags.SearchAllClasses);
    
    
                DgnECInstanceCollection inst = DgnECManager.Manager.FindInstances(scope, query);
    
                int i = 0;
                foreach (IDgnECInstance instance in inst)
                {
                    Bentley.ECObjects.Instance.IECPropertyValue valueF = null;
    
                    foreach (Bentley.ECObjects.Instance.IECPropertyValue value in instance)
                    {
                        if (value.Property.Name == "ObjectSettings")
                        {
                            valueF = value;
                            break;
                        }
                        i++;
                    }
                    if (valueF != null)
                    {
                        valueF.StringValue = sFeat;
                    }
                }
    
    
    
            }
    

    Regards,

    Andrew

Children
No Data