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.
Hi Damian Holubowski,
Here is a post similar to yours that provides a (best practice) final working code snippet to share with others having similar future needs.
Hi Robert Hook
I need to set this value codebehind:
I don't know how this "byLevel" feature works. For now i have resource file with defined linestyles and I do just that:
SetLinestyle(BNET.LineStyleManager.GetNumberFromName(lineStyle, dgnFile), null);
Damian Holubowski said:but i can't create LineStyleParameters because it does not have constructor.
When you will check documentation carefully (and e.g. will evaluate classes dependencies), you will find that LineStyleParameters are part of element display parameters, so they have to be obtained from there. In this situation the constructor makes no sense, because display parameters exists only when element is is displayable. And some parameters (as LineStylesParameters for example) exist only in certain situations, like when linear element has line style assigned.
Damian Holubowski said:I can't change Scale for that object, it stays unchanged after lineStyle.Scale = scale.
My feeling is that it does not work. I do not know whether it's a bug in API implementation or wrong code is used, but even with LineStyleParameters existing, it does not work for me (but maybe I did something wrong).
Damian Holubowski said:I don't know how this "byLevel" feature works.
It's crucial MicroStation (and also AutoCAD) feature, so this knowledge is mandatory, because represented in many aspects of MicroStation API.
Damian Holubowski said:I need to set this value codebehind:
Because I can see this value (LSScale) in EC schemas delivered with MicroStation, it should be accessible as element's EC property. And because it's not defined as read-only, I am pretty sure you can change it this way (which is popular and common workaround when a feature is not accessible or not work in API ;-)
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
If you provided a code with an example of using EC property, I would be grateful.
please distinguish between Jon and Jan ;-)
Damian Holubowski said:If you provided a code with an example of using EC property, I would be grateful.
Sorry, in this case I am not willing to share snippet, because I wrote it as a part of commercial code that somebody else paid already.
But because to understand EC representation of MicroStation data has become crucial knowledge, you can find many examples at many places (even when probably not exactly about Line Style properties):