[CONNECT UPDATE 15 C#] LineStyle Scale


I have problem with setting scale for linestyle in c#. If anyone found working solution please share it.

So far I tried to use ElementPropertiesSetter SetLineStyle function because this function takes LineStyleParameters as param but i can't create LineStyleParameters because it does not have constructor.

I tried to get LineStyleParameters from ElementPropertiesGetter and I get some but I can't change Scale for that object, it stays unchanged after lineStyle.Scale = scale.


Parents Reply
  • Any tip what I am doing wrong?

    I guess you are searching for wrong class name, but without some debugging, it's hard to say.

    But you choose, in my opinion, the most complicated way. To use ECQuery is powerful, but it requires to know exactly how ECQuery works (not very intuitive, because more graph than query) and also the structure of queried data. The problem is that hide complex logic, so when anything is wrong, it's usually not simple to find out what.

    Even when maybe less efficient, to use DgnECManager.GetElementProperties() is far simpler. Moreover, it allows easily understand, what EC classes and properties are available at specific element. Sometimes there is even no reason to rewrite code to ECQuery later, because it "just work".

    The only disadvantage of GetElementProperties (but it can be applied to all EC API) is a requirement to cast values to proper data type to access relevant methods. But it's common problem of OOP, when interfaces and inheritance is used. In the discussed case, everything is IECPropertyValue, but individual items can be containers like structures or arrays. But, fortunately, every IECPropertyValue knows what type it represents ;-)