Hello,
my code is the following:
uint? WT = new uint(); Bentley.DgnPlatformNET.ElementPropertiesGetter propGet = new Bentley.DgnPlatformNET.ElementPropertiesGetter(Element); WT = propGet.Weight;
and the result is 0 ,although the weight is bylevel?
Does somebody has any idea?
Best regards
Axel
Hi Axel,
what CE version do you use?
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
I'am using CE Update 10,
Regards Axel
By default, it should return 0. Have you tried changing via property pane.
Thanks,
Mangesh
Hi Mangesh,
Mangesh.Shelar said:By default, it should return 0.
I am not sure how it's implemented in CE API, but historically when element property is "by level", -1 is returned.
When talking about ElementPropertiesGetter, how it can be checked whether a property (color, style, weight) is set to ByLevel?
With regards,
Let me take this with my colleague, I will let you know soon. Thanks.
You have declared WT as as an un-signed "int". Wouldn't it need to be a "signed" int?
Bruce Reeves SRNS said:You have declared WT as as an un-signed "int". Wouldn't it need to be a "signed" int?
No, both in native and managed API the getter returns UInt32 for Weight value ... at least it's written in doc ;-)
A thoughtful conjecture, but the MstnPlatformNet tells us …
public uint Weight { get; }
Jan Šlegr said:Historically when element property is "by level", -1 is returned
But that doesn't work with a uint. So how do we find if a property is by level?
uint
There's a Weight structure that has a ByLevel field. The Weight struct has an Explicit operator that creates a Weight from an int or uint. I don't know if that would automatically fill the ByLevel field.
Weight
ByLevel
Explicit
int
Unfortunately, there's no example and MstnPlatformNet documentation is terse.
Regards, Jon Summers LA Solutions
Jon Summers said:There's a Weight structure that has a ByLevel field.
But how this structure can be obtained from ElementPropertyGetter (both in C++ and NET)? As far as I understand the getter should be (together with setter) used to access common element properties.
Jan Šlegr said:historically when element property is "by level", -1 is returned
Hmm. Then things have changed. I *do* see this enum:
enum { COLOR_BYLEVEL = 0xffffffff, COLOR_BYCELL = 0xfffffffe, STYLE_BYLEVEL = 0x7fffffff, STYLE_BYCELL = 0x7ffffffe, WEIGHT_BYLEVEL = 0xffffffff, WEIGHT_BYCELL = 0xfffffffe, LEVEL_BYCELL = 64, };
Maybe the variable is not "big" enough (e.g. UInt32) ?