[Plugin] Parametric Copy v1.01 20111030

[Plugin] Parametric Copy v1.01 20111030

Postby mikenon » Sun Oct 23, 2011 9:37 pm

DOWNLOAD LINK:
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


DOWNLOAD LINK:
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

Postby baldaman » Sun Oct 23, 2011 10:20 pm

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

baldaman 
 

Re: [Plugin] Parametric Copy v1.0 20111003

Postby mitcorb » Sun Oct 23, 2011 10:28 pm

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.
User avatar
mitcorb 
Top SketchUcator
 

Re: [Plugin] Parametric Copy v1.0 20111003

Postby Pixero » Mon Oct 24, 2011 7:36 am

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

Re: [Plugin] Parametric Copy v1.0 20111003

Postby mirale999 » Mon Oct 24, 2011 8:51 am

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

Postby pilou » Mon Oct 24, 2011 11:10 am

The Grow's TIG plug survitamined! :fro:
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Parametric Copy v1.0 20111003

Postby Didier Bur » Mon Oct 24, 2011 3:22 pm

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)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: [Plugin] Parametric Copy v1.0 20111003

Postby mikenon » Mon Oct 24, 2011 4:19 pm

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

Postby mirale999 » Mon Oct 24, 2011 5:42 pm

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... :oops:

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... :cry:
0
paranoia is a higher form of awareness...

mirale999 
 

Re: [Plugin] Parametric Copy v1.0 20111003

Postby mikenon » Mon Oct 24, 2011 6:35 pm

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... :cry:


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

Postby baldaman » Thu Oct 27, 2011 12:24 pm

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

Postby TIG » Thu Oct 27, 2011 12:47 pm

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
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Parametric Copy v1.0 20111003

Postby danbig » Fri Oct 28, 2011 8:40 pm

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

Postby mikenon » Fri Oct 28, 2011 9:06 pm

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

Postby mirale999 » Sat Oct 29, 2011 10:04 am

:enlight:
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

Postby mikenon » Mon Oct 31, 2011 5:04 am

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

Postby jeff hammond » Mon Oct 31, 2011 5:37 am

wow! :enlight:


this plus a GUI and some sort of preview/incremental undos would be insane.
:D
0
dotdotdot
User avatar
jeff hammond 
Global Moderator
 

Re: [Plugin] Parametric Copy v1.01 20111030

Postby pilou » Wed Nov 09, 2011 4:20 am

Remember this I have made 8 years ago ;)

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

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 :thumb:

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

Code: Select all
for i = 1 to 20
addx i*2
CYLIND i*6, i*4
next 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
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Parametric Copy v1.01 20111030

Postby TIG » Wed Nov 09, 2011 10:45 am

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
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Parametric Copy v1.01 20111030

Postby Polythene » Mon Nov 14, 2011 3:24 pm

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

Postby Lobster » Fri Nov 18, 2011 11:07 am

Hi mikenon,

Looks very interesting and no problems so far.

Thanks so much.
0

Lobster 
 

Re: [Plugin] Parametric Copy v1.01 20111030

Postby stoneuge » Mon Apr 01, 2013 5:11 pm

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 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: DouglasB2310, goga63, Humpmetwice, nikonadaraia45 and 17 guests

Visit our sponsors: