Dev to hire for simple script creation?


#1

Hi!

I’m sorry if this is not the correct place to ask, but I need a really fast solution to create a script that draws a simple office map and then instead of desks, I need cubes in each desk placement. I lack the knowledge but could learn, but I have no time. I need a script because I have to output several images just changing the color of the cubes and I think the best way to do it is via scripting.
Can you point me to anyone or just contact myself?
Thanks!


#2

A job for scripting is something that would be run multiple times per day, and distributed so that others could also do the same task many times.

Your request sounds more like a dynamic component cube with colors set, or perhaps even normal cube components with colors applied. Then scene pages set up for each “option” along with unique “option layer” that only that scene page has visible (The other “option” scene pages have only their option layer on and the layers for all other options off.)

Each option layer has colored cube component instances inserted in the configuration for that “option”.

All “option” scenes can share the common “map” layers.

Switching between scenes is a simple matter of clicking the scene tabs (if you have them on via View > Scene Tabs,) or choosing the scene in the Scene Manager dialog.


#3

Hi Dan:
Thanks for the input. My question was about who to contract to do a template script, it is so simple I’ve been learning the last hours and I see that maybe I could do it myself. The first silly question I have is: how to set the scale of the whole drawing. Imagine I have a 1x1 m cube representing a desk. How can I set the points that will define the boundaries of the office layout via code?
Thanks!


#4

if you look at the API docs for groups, you can easily modify the example to add a ‘floor’ using something like…

unit = "1.m".to_l
 depth = unit*26
 width = unit*44
 model = Sketchup.active_model
 entities = model.active_entities
 pts = []
 pts[0] = [0, 0, 0]
 pts[1] = [width, 0, 0]
 pts[2] = [width, depth, 0]
 pts[3] = [0, depth, 0]
 # Add the group to the entities in the model
floor = entities.add_group

 # Get the entities within the group
 entities2 = floor.entities

 # Add a face to within the group
 face = entities2.add_face pts
 floor.name = "Floor"

you can use the same idea to add you desks as groups…


#5

You do not set scale. You model a full scale 1:1.

You set the units via the Units panel of the ModelInfo dialog.
(SketchUp uses inches internally, but you can use meters as your model units.)


#6

You miss the point. I am a programmer. This task is something that can be done quickly and easily using scene pages.

No script is required. Your just adding time and expense going the scripting route.

The time it will take you to learn Ruby is weeks to months.


#7

I think I don’t miss anything but maybe you should know better. I have data for 500 different desks, granular to 5 minute segments. So each 5 minutes I can have 500 different possible states I have to “paint” (the states are active or inactive). In one day, I have 288 strips with 500 possible combinations, and I have to draw this for 2 weeks. So I have 288 x 500 x 14 possible images. I have the full data stored in a MS SQL database, and currently I have queries and scripts to output this data and paint it in a MS Visio like product. With each 2 weeks periods images, I create a movie. With 4 weeks images, I create a movie comparing side by side before and after scenarios. Maybe I’m missing the point but I was naively thinking this is a task for some script, not for monkey pressing of tabs in the GUI.
The idea was to hire a programmer to do a template, and then as a Ruby file is simply a text document, I can easily tell my program to change needed data in each run. But, one day has passed and I’m already doing it on my own with some of your help here. Maybe my mistake was to say “several images” when I’ve meant 4032 jpgs. So thanks!


#8

Yes you misled me, you also said “SIMPLE office plan”. :unamused:

There was no way I could know you had that many permutations.


#9

lol
The office plan is REALLY simple, they are only 6 points!


#10

I put together a sample plugin that reads a text file with desk locations and then uses that in conjunction with a text file with activities for those desks. For each activity (i.e., 5-minute interval), a group of rectangular faces are created that are color-coded based on “A” (active = green) or “I” (inactive = red). These are added to separate layers so they can be made visible or not visible. Then the scenes (pages) are added for each activity and the layer visibility set appropriately. For my example, I used five desks and 36 activity intervals.

The text file with the desks is here: https://sites.google.com/site/spirixcode/code/desks.txt
The text file with the 36 activities: https://sites.google.com/site/spirixcode/code/activity.txt
The plugin can be downloaded here: https://sites.google.com/site/spirixcode/code/desk_activity.rb
The sample model in SketchUp 8 format: desks.skp (106.7 KB)

The two text files should be in the “C:/” root directory (or the plugin needs to be edited to reflect the location). You will need to preset the window size, etc. before running the plugin. The plugin makes no attempt to determine model units and was developed in inches.

NOTE: This is a “quick and dirty” plugin and is not suitable for a production environment without a lot more work.


#11

Sample output video using 48 desks and 288 frames (displayed at five intervals per second): https://www.youtube.com/watch?v=lRcl8xtXAhI


How to label 3D instances?
#12

Thanks! I’ve missed your post as I’ve been away. I will take a look today.


#13

By the way, my “Simple” office plan es like a “7” shape. I have 6 points defining the “7” shape perimeter. I see I’m capturing the coordinates in a wrong way because if I look at it from the top view in Sketchup, I see it like a slanted “L” instead. I’ve tried adding “-” to all the points but now I see it fine but from the bottom view. What Am I doing wrong? Sorry about the spatial ignorance.


#14

Use a 0 datum in the lower left of your plan. It sounds like you did all your measurements using a 0 datum at the top left measuring to the right and down towards your feet.

Looking down from the top, x goes from the 0 datum at the left, measuring positively towards the right.

And y goes from the 0 datum on the lower left, measuring positively away from you (towards the top edge of the paper or viewport.)


#15

You are right, because I’ve captured the locations getting touch coordinates from a custom app I’ve made on the iPad overlaid to the maps. So, sorry if this is too basic but, can I change the datum in Ruby or any property in Sketchup so it magically works or should I change my coordinates in my iPad app before?
Thanks Dan!


#16

Forget about my question. Solved it.


#17

Hi Jim:
I’m going thru the example and I love it but I’m having some errors and some doubts. I’m trying to read a desks file with 53 desks. I have the desks.txt file created following your model but I don’t know if the format (you use dot as decimal separator and I’m using only the number with no fraction) makes the plugin to raise an error. My desks file starts like:

53,527,611
539,572
537,577
548,575
499,558
508,531

And has 53 lines. I’ve also modified the activity strings but I see it fails before loading the activities.
with this error

num_desks:53 dx:527.0 dy:611.0
Error: #<NoMethodError: undefined method chomp' for nil:NilClass> /Users/JP/Downloads/desk_activity.rb:21:inblock in spirix_desk_activity’
/Users/JP/Downloads/desk_activity.rb:20:in each' /Users/JP/Downloads/desk_activity.rb:20:inspirix_desk_activity’
/Users/JP/Downloads/desk_activity.rb:62:in block in <top (required)>' SketchUp:1:incall’

Also, besides that, in my case, the number of activity periods will be variable (can be from maximum 96 to 10) but is unknown.

Can’t the input file be a single one, with the first line with all the desks coordinates for a given period, then the following line with the activity state for the preceding desks, and so on as many periods I have?

Just my questions right now I have to study it more.

Thanks a lot again


#18

Maybe I’m misunderstanding your desks file format. You say you define 6 in this format but I’m confused by the first “5” and the two commas in the first line

5,48.0,36.0
15.0,73.0
99.0,73.0
211.0,73.0
77.0,16.0
155.0,16.0


#19

post a skp with your layout drawn manually…

there are easy ways to switch group layers and color by layer will show your states…
john


#20

Office Layout.skp (613.1 KB)