Dev to hire for simple script creation?

Specifically, as I’ve mentioned in Jim’s reply, I can analyse several floors at once and do animations between scenes to better show the findings. Also, working with the Z axis I can vary the “desks” height to convey some value (like user activity level, etc). Also, as I will use the system to control building systems, I can set up a 3D model with lights and simulate the results after my controlling system is in place.

I don’t do special effects for movies but I was exactly looking at it this afternoon. My hope is to be able to: associate a set of lights with a zone, and set them off when a given amount of computers linked to them are OFF, and to also do the math about the savings so the customer can predict exact ROI. This is Tooooo hard for me because I’m not an engineer nor a programmer, I just learn the least amount needed to advance my ideas, that’s why the title of my post was “dev to hire”. I love to do things myself but I have to confess that I’m impressed and I feel non capable of doing the quality work that people around here does!

Adam who develops the LighUp extension is very good at all this stuff, I’ll try pinging him @AdamB,
as I think he could add value here, I’ll send him an email as well, so maybe he’ll pipe up…

john

Thanks! Beware of my newbie status with all of this. The first thing I have to do is to decide which approach to finally settle with. I like your color by layer idea and I also like Jim’s one scene per time slice one.
What I was expecting to have is only a movie with a frame for each period, showing the active desks in it, but I don’t realise if having a scene per period (as Jim does) adds more power to the way of communicating the status of things.

I’m modifying my databases to spit out a list of device names that can be used to decide which ones are on or off per period (as your idea). But I’m not sure about creating the desks once and then just colouring by layer or going the scene’s way.

I guess that having a scene per period is more powerful to go back and forth if I’m discussing this with a prospect. I can show Ms Martha’s syndrome on the fly :smile:

It is 2:38 AM here now, I will go to bed as my 3 kids don’t really care about this at 8AM jumping around :smile:

I’ve managed to modify your code so the input from desks has z data, and I also solve my question about where to add the face pull, and I can now locate desks in several floors at once. I need to add a new column to the desks data with the devicename, I will try to figure it out later.

Here’s a crude video that shows the effect of adding a third dimension to the data:

Second version of code (should co-exist with the code you’re modifying - will show up on the extension menu as “Desk Activity 2”): https://sites.google.com/site/spirixcode/code/desk_activity2.rb

And how should the input data be formatted? I suppose you are adding a little height with each iteration found active?

I upload the current version I’m working with, where I’ve added the Z data to situate the cubes on different floors, and also the name of each one. Can you take a look and see if you approve it?desk_activity1.1.rb (3.9 KB)

The forum system is not allowing me to upload the new desks.txt file but I’ve simply added 2 columns after line 2: Now it is X,Y,Z,Name (Z is the height of the cube that belongs to the building floors) and name is the PC Name I get from the SQL.

It uses the same files and formats as the other. I didn’t add the z location of the instance … I figured you could do that. In the previous iteration, I processed each line in the file as I went. Now it’s read from the activity file into an array and then the maximum for all desks is found. Then that’s used to scale the results to whatever maximum you want (I used 100" in lines 93 and 98). Like most of my code, it’s very hacky.

So in my previous mode, the scenes where to create single images to create a movie, to show activity sequence. Right? In this second one, the height is an indication of total level of activity for the whole period. Right? I think I need both. If you look at the movies in my website, the sequenced one is really good to show the optimised advantages when you put people with similar time of work closer. This second one is really good to show which are the most active desks, and I’ve been doing that by color coding but this is better, If I’m understanding you.
Thanks!

I think I understand that you understand. I’ve edited your rb file, but I can’t get the instance name to work so I commented out that line for the time being.

desk_activity2.1.rb (4.9 KB)

BTW, you can name a text file as .rb and it will upload to the forum.

Also, I create a unit tall component that is then scaled by the instances.

Doh. I swapped i and j while juggling things … this works: inst.name = @@s[j][3]

OK I will test it later. By now, the last thing I think it needs is a column 0 in the activity records that names the period. In my database I have the periods named from Period0 to Period95 but as I analyse them single or grouped, I’d like to use a descriptive name like “8AM - 10AM” and use it as Scenes names. I will try to add this copying your way of reading the first line of the desks file. Am I OK with this approach? And, the last thing I don’t like are the scenes pointing to the origin by default. Which is the command to set them to a suitable zoom or view? I’ve tested with Sketchup.send_action(“viewIso:” but looks like crashing into the shapes :smile:
Regards
JP

If you can describe the format you’d like to use, I’ll see what I can work out. I also thought I’d point out that the component doesn’t need to be a cube, but could be anything. Like a desk or something. At least in the initial version (not the 3d bar graph version).

Don’t worry, I will try to do it myself and it is good to learn. I will ask for help if I get stuck. About the components, I like it to be abstract because it conveys the idea of used or active space instead of an object. Maybe a half sphere would be fine.

try a combination on the view…

Sketchup.send_action("viewIso:")
Sketchup.send_action("viewPerspective:")
Sketchup.active_model.active_view.zoom_extents

I prefer Perspective to Iso…

1 Like

Hi Jim:
I’m a bit lost with the versions. I’ve modified (first) the original and uploaded it. I had only added a z value for cubes height positioning, a face pushpull to make the cubes and the instances names (and labels as optional text). For me it was Version 1.1. Before, you uploaded Version 2, that showed the effect of adding a third dimension to the cubes to reflect activity data. But then you uploaded Version 2.1 and I don’t know if it was only a tweak of version 2 or you mixed the codes up with my mods and your new idea on 3d data for the height of each cube. I’m lost because I’m in doubt if I still have to add the z value to the desks positioning in your versions or not. Can you help me clarify it? I liked your idea of both codes coexisting with 2 different names in the menu but I ignore if this is still valid or had you incorporated all in one code.
Thanks!

JP

Me too. I apologize for taking so long to reply, but I got sidetracked last night on some other stuff :frowning:

Backtracking and catching up … you had asked about the push/pull tool:

Where must I add the pushpull for the face if I want cubes?

By the time I got around to answering, you had already figured it out.

I kinda went off on a tangent here and was playing around with the “3D” version and I never answered your question. I think I’m the wrong person to ask about this since I don’t write very good code … there are others here that are much better at this stuff.

The only things I might change would be to combine the two push/pull statements:

face.reverse!
face.pushpull 20

into one statement:

face.pushpull(-20)

and to drop the “String” from:

inst.name = String(@@s[i][3])

to be:

inst.name = @@s[i][3]

This works under version 8, but I haven’t tested it on 2015, so maybe stick to your syntax if it doesn’t work.

To be honest, since you had made these changes on your own, I assumed you would kinda be able to read between the lines when I added the z values and names to the second (“3D”) version, but all I did was mangle things up pretty good. Sorry about that …

This should be easy enough to do … if it was me, I would write the labels (“8AM - 10AM”) into the input file as the period name so I don’t have to do any extra work in the plugin script (as opposed to parsing “Period42”, etc.).

I played around with a few things and decided that the Sketchup.send_action("viewIso:") doesn’t get applied until after the script has finished running (it’s asynchronous). I added a Set View function that creates a new camera to set the viewpoint:

def spirix_set_view()
  eye = [1000,-2000,2000]
  target = [0,0,0]
  up = [0,0,1]
  camera = Sketchup::Camera.new(eye,target,up)
  camera.perspective = false
  Sketchup.active_model.active_view.camera = camera
end

I also added a first pass flag that zooms the view extents only when the first set of cubes are created (and changed the file read loop logic slightly):

def spirix_get_activity_data(filename)
  act = File.open(filename,"r")
  first = 1
  while(t = act.gets)
    layer = Sketchup.active_model.layers.add("Scene " + @@scene.to_s)
    for i in 0...@@num_desks do
      vec = Geom::Vector3d.new(@@s[i].x,@@s[i].y,@@s[i].z)
      trans = Geom::Transformation.translation(vec)
      inst = Sketchup.active_model.entities.add_instance(@@compdef,trans)
      inst.layer = layer
      inst.name = @@s[i][3]
      if(t[i,1] == 'A')
        inst.material = "green"
      else
        inst.material = "red"
      end
    end
    if(first == 1)
      Sketchup.active_model.active_view.zoom_extents
      first = 0
    end
    layer.visible = false
    @@scene += 1
  end
  act.close
end