How can I Transfer the yard area to the sign?

255
2
04-26-2020 12:50 AM
nazaninyosefi
New Contributor II

hello everyone

I want the yard area to appear in the sing leaf. So I used the set(YardArea,geometry.area()) command .
Sign --> print("Yard For Sing :"+YardArea) but the result print for yard area is zero . how can yard area appear correct in the sing leaf. very thanks

my code is :

@Range(1,30)
attr Height =10
Parcel-->
Sign
split(x) { 6 : Yard |~1:Building }


Building -->
extrude(Height)
color(1,0,0)


@Hidden
attr YardArea =0

Yard -->
color(0,0.7,0)
set(YardArea,geometry.area())
print("Yard :"+YardArea)


Sign -->
alignScopeToAxes(y)
t(0,Height+1,scope.sz/1.5)
rotate(rel, scope, 0, 90, 90)
center(y)
s(scope.sx-10,scope.sy,scope.sz-5)
print("Yard For Sing :"+YardArea)

0 Kudos
2 Replies
CherylLau
Esri Regular Contributor

The operation set() only sets the attribute for the shape in the derivation shape in which it is set and its descendants.  This means, that the value that was set, the yard area in your case, is only set in the Yard shape.  Other shapes in the tree do not know about this value.  Therefore, instead of creating Sign in the Parcel rule, move it to the Yard rule after the set is called.  Also, to print text in the viewport, you might want to use ESRI.lib/rules/General/Text.cga.

nazaninyosefi
New Contributor II

very thanks 

0 Kudos