## [Plugin] Parametric Copy v1.01 20111030

### [Plugin] Parametric Copy v1.01 20111030

ParametricCopy_v1.01_20111030.zip

OVERVIEW
• ParametricCopy can be used to make multiple copies of an object, and control their properties using parametric formulas.
• Separate formulas may be independently applied to position, scale, and rotation on the X, Y, and Z axis.
• You can use predefined formulas, such as Fibonacci and Exponential, or write your own formulas as freeform expressions.
• You can also use the output of another program or process, expressed as a list of numbers.
• Since translation, scaling, and rotation do not break component linkage, all copies of a component object remain linked and editable.
• ParametricCopy is a generalization of the Grow2 plugin, and duplicates and expands on its functionality.
flower.jpg

sine_wave.jpg

ParametricCopy_v1.01_20111030.zip

INSTRUCTIONS
• Select an object
• Choose ParametricCopy from the plugins pull-down menu
• Choose a point which will be used as the center of rotations, and the reference for scaling operations
• At the top of the main dialog, enter the number of copies to be made, and select the order of operations (translation,scaling,rotation), and the order of rotation operations (along the X, Y, and Z axis).
• In the rest of the main dialog, select the formulas which will be applied to each operation.
• For each selected formula, a dialog box will appear allowing you to specify the formula's parameters

FORMULAS
Freeform Expressions
• Freeform expressions are defined in terms of the variable, i, which iterates from 0 to the number of copies that are made (the 0-th object is the original object). When entering a freeform expression, type only the portion after "f(i)=" -- Example: f(i)= 6*i will generate values 0, 6, 12, 18, ...
• Freeform expressions may use all of the functions and constants of the Ruby Math module. Examples include the constants E and PI, and the trigonmetric functions sin and cos. Example: f(i)= sin(PI*i/2) will generate values 0,1,0,-1,0,1,0,-1,...
• Freeform expressions may use ruby constructs, such as the x ? y : z construct (if x then y else z). Example f(i)= i%2==0 ? 0 : 1 will generate values 0,1,0,1,0,...
• Freeform expressions may refer to previous iterations using f(i) notation. Example: f(i)= i<2 ? i : f(i-1) + f(i-2) will generate the Fibonacci series: 0, 1, 1, 2, 3, 5, 8, 13, ...

Repeated Value List
• Repeated Value List is a convenient way to use the output of an external program or process, as long as it can be expressed as a space-delimited list of values.
• If the list of values is shorter than the number of copies, it will be repeated.
• Example: 0 1 2 3 will generate values 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3,...

Predefined Parametric Formulas
• Predefined formulas contain one or more constants whose values may be input by the user.
• These formulas are predefined as a convenience, and may alternatively be expressed as freeform expressions -- whenever the inputbox for a predefined formula is onscreen, the status line at the bottom of the sketchup window will display the equivalent freeform expression.
• Current predefined formulas are Constant-Step, Linear-Step-Delta, Exponential, Fibonacci, and Step+Sine.

EXAMPLES
Example 1: Stretched Spiral Staircase
Each step is higher than the previous step by 0.25 feet.
• z-translate = linear-step-delta: step=1', delta=0.25'
• z-rotate = constant-step: step=15 degrees
• z-scale: freeform expression: i==0 ? 1.0 : f(i-1) + 0.25
stretched_spiral_staircase.jpg

Example 2: Copying Over a Surface
By using the % (MOD) and / (DIV) operators, copies can be distributed across a surface.
• Copies = 99
• x-translate = freeform expression: i%10
• y-translate = freeform expression: i/10
• z-translate = freeform expression: sin( (i%10) + (i/10)*0.2*pi)
wavey_grid.jpg

Example 3: Using Random Numbers
Interesting forms can be created using functions such as rand().
• Copies = 300
• Order = Scale Rotate Move
• z-scale = freeform expression: 1.0 + (3.0 * rand())
• x-rotate = freeform expression: rand()*360
• y-rotate = freeform expression: rand()*360
pre-starburst.jpg

starburst.jpg

------------
VERSION LIST
• 1.0 2011_10_23:
• First issue.
• 1.01 2011_10_30:
• Fixed bug in Windows with pull-down menus
• Added "Initial_Val" parameter to Step+Sine and Linear-Step-Delta
• Added exception capturing in all entry boxes

ParametricCopy_v1.01_20111030.zip
0
Last edited by mikenon on Mon Oct 31, 2011 5:27 am, edited 3 times in total.

mikenon

### Re: [Plugin] Parametric Copy v1.0 20111003

Wow!
Very nice work, that's looks very very very intersting...
Will make tests as soon as possible!
0

baldaman

### Re: [Plugin] Parametric Copy v1.0 20111003

Hi, mikenon:
This is a fantastic innovation based on the illustrations!! I believe you will be hearing from a lot of folks on this one. Thank you for posting.
0
I take the slow, deliberate approach in my aimless wandering.

mitcorb
Top SketchUcator

### Re: [Plugin] Parametric Copy v1.0 20111003

Wow, I'm currently learning grasshopper for Rhino so this comes right on time. Will check ASAP.
0

Pixero

### Re: [Plugin] Parametric Copy v1.0 20111003

It didn't work on my sketchup 8.0, copied the object several times in one place... the error code below:

Code: Select all
`Error: #<NoMethodError: undefined method `new' for nil:NilClass>C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/ParametricCopy.rb:453:in `applyFunc'C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/ParametricCopy.rb:471:in `move'C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/ParametricCopy.rb:599:in `run'C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/ParametricCopy.rb:406:in `onLButtonDown`
0
paranoia is a higher form of awareness...

mirale999

### Re: [Plugin] Parametric Copy v1.0 20111003

The Grow's TIG plug survitamined!
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie

pilou
Top SketchUcator

### Re: [Plugin] Parametric Copy v1.0 20111003

Hi,
I've made a small guide with mikenon's instructions and included it in the zip. I post the guide here and the Zip is now on RLD site. Thanks Mikenon !
0
Didier Bur
Ecole Nationale Supérieure d'Architecture de Nancy (F)

Didier Bur

### Re: [Plugin] Parametric Copy v1.0 20111003

mirale999 wrote:It didn't work on my sketchup 8.0, copied the object several times in one place... the error code below:

If you do not select any options, the default behavior is to just copy all of the objects in place. You must specify a formula for one of the dimensions. For instance, if you specify "Constant-Step" for x-translation, and set the value to 1-foot. Then each copy will be moved over by one foot along the x dimension. If you specify 0-feet, then all the copies will be in a single place. Also, if there is an error, I think it just goes ahead and makes all the copies, but does not do anything to them (so they all end up in one place).

Obviously, the code would benefit from some better error-handling. But I cant reproduce your error. Can you give more details of what you entered in the dialog boxes to generate it? Ive tested on OS X SU7 and OSX SU8.

Mike
0

mikenon

### Re: [Plugin] Parametric Copy v1.0 20111003

mikenon wrote:
mirale999 wrote:It didn't work on my sketchup 8.0, copied the object several times in one place... the error code below:

If you do not select any options, the default behavior is to just copy all of the objects in place. You must specify a formula for one of the dimensions. For instance, if you specify "Constant-Step" for x-translation, and set the value to 1-foot. Then each copy will be moved over by one foot along the x dimension. If you specify 0-feet, then all the copies will be in a single place. Also, if there is an error, I think it just goes ahead and makes all the copies, but does not do anything to them (so they all end up in one place).

Obviously, the code would benefit from some better error-handling. But I cant reproduce your error. Can you give more details of what you entered in the dialog boxes to generate it? Ive tested on OS X SU7 and OSX SU8.

Mike

Thank you for your patient answering, and below is my steps...

test.gif

I'm using windows. I think I didn't do something wrong... I haven't learnt ruby yet, so I can't tell what's wrong with it, the only thing I can do is this...
0
paranoia is a higher form of awareness...

mirale999

### Re: [Plugin] Parametric Copy v1.0 20111003

mirale999 wrote:I'm using windows. I think I didn't do something wrong... I haven't learnt ruby yet, so I can't tell what's wrong with it, the only thing I can do is this...

Hey that video is really helpful. Thank you! Unfortunately, I dont have windows, and I have no way to even access a windows machine, so I cant test it on a pc.

It doesn't look like you are doing anything wrong though.

If there is someone on list with a windows machine, and knowledge of the differences between Sketchup on PC and MAC, perhaps I could help walk through the debugging. I imagine the difference between Sketchup on mac and pc cant be very big. So I think this should be a quick fix -- but I dont know.

Also, is there anyone on list who could verify that this works for them with OS X, so that I know it is not just something that works with the idiosyncrasies of my own machine? Its my first plugin (and first time learning ruby), so I would be grateful for any assistance.

Thanks for your help!!

Mike
0

mikenon

### Re: [Plugin] Parametric Copy v1.0 20111003

I wish I could help but I can't...
I know nothing about MAC.
In Windows: I think the problem comes when user is asked to pick rotation/scale reference point
You can click 10 times, nothing happen. The software stays waiting for the validation of that input.
I hope it helped a little bit.
0

baldaman

### Re: [Plugin] Parametric Copy v1.0 20111003

Mikenon

There are only a few differences between PCs and MACs: for example with different names/codes for 'modifier' keys and so on.
I suspect something is adrift in your code about picking a point - it needs to reset a flag so it then continues... or the dialog values are not all trapped for errors/emptiness
Get the users' Ruby Console errors...
0
TIG

TIG
Global Moderator

### Re: [Plugin] Parametric Copy v1.0 20111003

This is very cool. SketchUp has needed something like this for a long time.

For me, SketchUp crashes every time, when the rotation is applied. I've tried different components, rotation axes, and parametric values. Each time, when the rotation is applied, I get a crash.
0

danbig

### Re: [Plugin] Parametric Copy v1.0 20111003

danbig wrote:This is very cool. SketchUp has needed something like this for a long time.

For me, SketchUp crashes every time, when the rotation is applied. I've tried different components, rotation axes, and parametric values. Each time, when the rotation is applied, I get a crash.

Danbig: what version of Sketchup and Windows/OS X are you running? Could you send me a private message with details of what paramater values you used? If you select "None" (you may have to use the pull-down menu to find "None") for all of the rotation and scale operations, but just choose Constant-Step for the translation options, do you get the same problem?

Everyone: Im in the process of fixing these bugs. It works perfectly on my OS-X box under extensive testing -- so I cannot debug on my own machine.

Therefore I am debugging by email, which is very slow. But it will get fixed. So far mirale999 has helped by allowing me to send him versions of the plugin with debug statements, running it on his Windows box, then sending me back the debugging output. We have discovered at least one difference between windows and OS X Sketchup: on OS X, if you leave the default values blank in inputbox dialog, the value of a pulldown menu will default to the first item. On windows, it will default to empty-string.

If anyone else is willing to help, please send me a message.
0

mikenon

### Re: [Plugin] Parametric Copy v1.0 20111003

Mybe the last version I have tested, had fixed the bug successfully!
0
paranoia is a higher form of awareness...

mirale999

### Re: [Plugin] Parametric Copy v1.01 20111030

Ok here is version 1.01: http://forums.sketchucation.com/viewtopic.php?p=361858#p361858

In addition to fixing the error in Windows-compatibility, there is now better error-handling in general for the input boxes, and there are new parameters for some of the functions.

Extra thanks to mirale999 for patiently running code updates and sending me the bug reports.

Mike
0

mikenon

### Re: [Plugin] Parametric Copy v1.01 20111030

wow!

this plus a GUI and some sort of preview/incremental undos would be insane.
0
dotdotdot

jeff hammond
Global Moderator

### Re: [Plugin] Parametric Copy v1.01 20111030

Remember this I have made 8 years ago

GDL Language : Normally for ArchiCad or d'AutoCad but you can use it for Sketchup
GDL book, free

need
GDL Scripter free
Just put some lines from the tutorial above in the window "Script 3D"

GDL Web Control/Plug-in Free for see Objects rotate in 3D window

GDL Object Explorer Free for see all the GDL of objects the univers!
and you can save as many formats! Not sure the this explorer is always available! here
Example ! Copy this following inside the 3D Script Editor Click on the Rubik-Cub

Code: Select all
`for i = 1 to 20 addx i*2CYLIND i*6, i*4next i`

0
Last edited by pilou on Wed Nov 09, 2011 10:57 am, edited 1 time in total.
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie

pilou
Top SketchUcator

### Re: [Plugin] Parametric Copy v1.01 20111030

Here's an Analog Clock I wrote in GDL years ago http://www.scribd.com/doc/66416515/110/Analog-Clock ... it was in an earlier version of the Cookbook...
0
TIG

TIG
Global Moderator

### Re: [Plugin] Parametric Copy v1.01 20111030

Very nice plugin, exactly what i'm looking for.

However, can i suggest the addition of a 'back' button when entering values? It would be great to try a number, look at the outcome, but then quickly go back and change the number to see what the difference is.
0

Polythene

### Re: [Plugin] Parametric Copy v1.01 20111030

Hi mikenon,

Looks very interesting and no problems so far.

Thanks so much.
0

Lobster

### Re: [Plugin] Parametric Copy v1.01 20111030

Hi, witch matematical language do it use?
i mean: there is a reference for translating operations in simbology?
(i know * is x, and - is "less"...but i'd like to get some more...).
thanks
0

stoneuge