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
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 ;-)
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
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.
Text using a true type font will always return a weight of 0 because weight is ignored for display.
For normal elements WEIGHT_BYLEVEL would be returned.
HTH
Answer Verified By: Axel Krueger
In order to explain:
I program a test program to comply with drawing rules. In V8i this was a VBA program. That worked correctly. How can I achieve the same result of the exam?
How do the programmers of the Element Properties dialog do it? ;)
Hi Axel,
Axel Krueger said:I program a test program to comply with drawing rules.
in my opinion, but exceptions of course exist, the best way how to comply with drawing standard is not hard code them into application, but to use Element Templates and to activate them from the application.
From long term perspective it's cheaper and more flexible solution, because it allows to change used standard easily in dgnlib (so there can be more projects using different standards) and the code is simpler.
With regards,