Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4331

OpenPlant Modeler CE Update 11 C# - How modify property value of a Saved View

$
0
0


Hello,

I want to modify some properties of the Clip Volume Settings section in a Saved View using C#.
The values which I want to apply are items of a list as shown on the picture below.
All items are visualized in a dropdown menu.

The SetValue method of the PropertyHandler object does not accept strings in order to set these changes
in my case propH.SetValue("Custom:PlanForward") does not work (an unknown error arises). It accepts only an integer number,
in my case propH.SetValue(7) works. Seems that this integer is the item index in the list.

Here is the source code I use in order to set a different value for a few properties.

        public static void ModifySavedView(string savedViewName)
        {
            Application App = Utilities.ComApp;
            DesignFile ActiveDesignFile = App.ActiveDesignFile;
            SavedViewElement savedView = ActiveDesignFile.FindSavedView(savedViewName);
            PropertyHandler propH = App.CreatePropertyHandler(savedView);
            string[] accessStrings = propH.GetAccessStrings();

            if (propH.SelectByAccessString("ForwardDisplayStyle")) 
                propH.SetValue(7); // "Custom:PlanForward" element index
            if (propH.SelectByAccessString("BackwardDisplay")) 
                propH.SetValue(0); // "Off" element index
            if (propH.SelectByAccessString("CutDisplayStyle")) 
                propH.SetValue(6); // "Custom:PlanCut" element index
        }

So, I use propH.SetValue(7) in order to set the value "Custom:PlainForward" of the Forward Displey Style property.

Is there a way to set the same value avoiding use of a number in SetValue method?

I would like to use the complete string visualized in the dropdown menu (using "Custom:Plan Forward" instead of number 7 as parameter).

Regards,

Alen


Viewing all articles
Browse latest Browse all 4331

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>