Hi,
I would like to find an expression that I can use in the calculated properties of a definition. I want to return the coordinates of the associated item. In this case its lights that I want the coordinates for. It would certainly save me a huge amount of time automating this.
HIAATDC said:I want to return the coordinates of the associated item
The coordinates of an element are properties of that element. You can use an element property in an Item Type expression using something like this...
this.Element().Origin.X
Thanks to Mangesh.Shelar for correcting me!
this.GetElement().Origin.X
(you'll need to experiment)
Regards, Jon Summers LA Solutions
Instead of Element(), please use GetElement(). e.g. this.GetElement().Origin.X. If you are using CE U15, please try "Expression Builder". It's a public tech preview feature in U15.
Fantastic, but how to limit the number of digits? Tried following but doesn't work: System.String.Format("{0:D3}", this.GetElement().Origin.x) & " , " & System.String.Format("{0:D3}", this.GetElement().Origin.y)
Mikkel Bennedbaek said:How to limit the number of digits?
I believe that the D formatter is applicable only to integer numbers. Try something like the following...
D
System.String.Format ("{0:#.##}, {1:#.##}", this.GetElement().Origin.X, this.GetElement().Origin.Y)
Adjust the number of pound (#) signs to vary the precision.
#
Thanks! Works like a charm.. while I was waiting for a response I came up with:
System.Math.Round(this.GetElement().Origin.x,3) & "," & System.Math.Round(this.GetElement().Origin.y,3)
Think it does the same but your expression looks cooler and more technical :)