rand height & color for containers

1364
6
Jump to solution
08-01-2016 06:25 AM
PmssS
by
New Contributor II

Dear all,

I am drawing a storage area.

and at the moment i am struggling with the containers.

Those are an imported shapefile. The containers have always the same height = 2.6.

The goal is to randomize several heights (multiples of 2.6 to a maximum of 10.4 = 4 containers over each other).

and colors.

This is my failed attempt. I'am sure is simpler than this. I just probably went in the wrong direction.

@StartRule

attr A= 2.6

attr B= 5.2

attr C= 7.6

attr D= 10.4

Containers-->

               extrude (rand(2.6, 2.6), rand (5.2,5.2), rand(7.6,7.6), rand(10.4,10.4)) HGT

HGT-->

               case HGT == A: ContainerColor

               else:

                         case HGT== B:

                                   split(y) {'0.5 : ContainerColor | ~0.5: ContainerColor}

                         case HGT==C:

                                   split(y) {'0.33 : ContainerColor | '0.33 : ContainerColor | ~0.33: ContainerColor}

                         else:

                                   split(y) {'0.25 : ContainerColor | '0.25 : ContainerColor | '0.25 : ContainerColor | ~0.25: ContainerColor}

ContainerColor-->

               color(rand(0,1), rand(0,1))

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
LR
by
Regular Contributor

Try this..

attr containerHeight = 2.6

@StartRule
Lot -->
  extrude(floor(rand(1,5))*containerHeight)
  print("Height: " +scope.sy +"\nContainers: " +scope.sy/containerHeight +"\n---") #print for control
  split(y){containerHeight: ColorContainer}* #optional split

ColorContainer -->
  color(rand,rand,rand)

View solution in original post

6 Replies
PmssS
by
New Contributor II

getting there with this but not yet accomplished:

attr cont_ht     =2.6

attr total_ht      = 10.4

lot -->

          extrude (total_ht) Container

Container -->

          split(y) {cont_ht : ContainerColor | cont_ht: ContainerColor}

ContainerColor-->

               color(rand(0,1), rand(0,1))

0 Kudos
LR
by
Regular Contributor

Try this..

attr containerHeight = 2.6

@StartRule
Lot -->
  extrude(floor(rand(1,5))*containerHeight)
  print("Height: " +scope.sy +"\nContainers: " +scope.sy/containerHeight +"\n---") #print for control
  split(y){containerHeight: ColorContainer}* #optional split

ColorContainer -->
  color(rand,rand,rand)
PmssS
by
New Contributor II

Thanks!!

although it looks easy it would take me ages to get that!!!

cheers

Pedro

0 Kudos
PmssS
by
New Contributor II

Hello Hello,

indeed it worked. But i have more than 1700 objects that use this rule... and the the performance of the resulting webscene has been reduced drastically with the inclusion of those.

I have seen webscenes of cities with much more objects than I have. and those are working very well.

How can I improve the performance of the webscene.

cheers

Pedro

0 Kudos
LR
by
Regular Contributor

It's usually the amount of faces/polygons what makes a scene choke. If you look closely, those large scenes generally consist of just simple textured blocks, so more or less building_number*6 polygons. However you're splitting (ergo multiplying) your polygon count. Maybe it would be better to skip the split and visualize it with a series of textures instead.

0 Kudos
PmssS
by
New Contributor II

Well indeed that is the problem! Sadly I needed to reduce the detail of the objects, this is the new rule in case someone will have the same problem:

I still don't understand how these cities of the wizard_cities or ESRI lib, perform so well... they have much more data than mine.

attr containerHeight = 2.6

@StartRule

Lot -->

  extrude(floor(rand(1,5))*containerHeight)

0 Kudos