Adding base shape colour to Plant_Loader.cga

743
2
Jump to solution
06-30-2020 08:17 PM
by Anonymous User
Not applicable

Hi,

I have managed to successfully add a generic brown (mulch) colour to the Plant_Distributor.cga by adding GroundCover to the existing rule:

@StartRule
Generate -->
case Mix == "Custom":
alignScopeToAxes(y)
comp(f){ vertical: NIL | bottom: NIL | all= CustomMix }
GroundCover
else:
alignScopeToAxes(y)
comp(f){ vertical: NIL | bottom: NIL | all= Generate(_getMix) }
GroundCover

GroundCover -->
color("#948477")

This works and adds a brown base colour to the shapes.

When I try to do that to Plant_Loader.cga with:

@StartRule # assumes that all main attributes have been set outside
Generate -->
case Height > 0:
set(_plantNbr,_indexFromCommonName(Name))
set(_plantName,_validate(Name))
set(_plantHeight,Height)
set(_plantRadius,Radius)
s(0,0,0) center(xyz)
alignScopeToAxes(y)
TrunkOrigin
GroundCover

else:
Generate(Name)
GroundCover

GroundCover -->
color("#948477")

The Shape does not receive a colour and stays to generic base colour.

Can someone explain what I am doing wrong?

0 Kudos
1 Solution

Accepted Solutions
CherylLau
Esri Regular Contributor

The reason why the ground cover doesn't work in the code above is because the Plant_Loader sets the size of the shape to zero.

I would recommend making a new rule that imports the Plant_Loader instead of modifying the Plant_Loader itself.  That way, if a new version of the Plant_Loader becomes available later, you can update to the new version.  On the initial shape, you can call the Plant_Loader and also create the GroundCover.  The same goes for the Plant_Distributor.

import Plant_Loader:"/ESRI.lib/rules/Plants/Plant_Loader.cga"

Lot -->
	Plant_Loader.Generate
	GroundCover
	
GroundCover -->
	color("#948477")

View solution in original post

2 Replies
CherylLau
Esri Regular Contributor

The reason why the ground cover doesn't work in the code above is because the Plant_Loader sets the size of the shape to zero.

I would recommend making a new rule that imports the Plant_Loader instead of modifying the Plant_Loader itself.  That way, if a new version of the Plant_Loader becomes available later, you can update to the new version.  On the initial shape, you can call the Plant_Loader and also create the GroundCover.  The same goes for the Plant_Distributor.

import Plant_Loader:"/ESRI.lib/rules/Plants/Plant_Loader.cga"

Lot -->
	Plant_Loader.Generate
	GroundCover
	
GroundCover -->
	color("#948477")
by Anonymous User
Not applicable

Thanks so much, I really appreciate it!

It can be so simple sometimes!

0 Kudos