Anim8or Community

General Category => ASL Scripts => Topic started by: karate5662 on June 15, 2008, 08:49:21 pm

Title: script request-copy along a spline
Post by: karate5662 on June 15, 2008, 08:49:21 pm
I'd like to see a script were you rename an object something like "copytarget 10 1" and the script copies it along a spline called "copypath"
copytarget would tell the script that this is the object it copies. the 10 would be replace with how many units between the origins of each instance.

It would make it easier to make things like tank treads, curved springs, and ropes.
Title: Re: script request-copy along a spline
Post by: NickE on June 15, 2008, 10:36:05 pm
This seems pretty straightforward, since it is only a variation on the chain_maker.  I don't think I understand everything you are saying, though.

"copypath" is the name of the spline you want to follow.
"copytarget" is what you want to copy along the spline.

What is the 10 and 1 for?  The 10 is replaced by what - a count of how many times it is copied?

How would you handle the orientation of copytarget?  What would copytarget's origin be in relation to copypath?  What is the distance between copies of copytarget?  These questions are important because you must calculate the size (length) of copytarget to space it along copypath.

Once these questions are answered, I can turn out the script pretty fast.
Title: Re: script request-copy along a spline
Post by: hihosilver on June 16, 2008, 04:59:06 am
karate, the 10 and 1 wouldn't matter.  NickE can make an option to change the spacing between the options if it were to be parametric, as well as the size perhaps?  It would be nice if you could do 2 objects as well, kind of like you did with the chain script.  Then, we could create our own fancy chains if need be.

Personally I would think that the lead of the object would be the top and the butt would be the bottom of the object.  Can you use an object that's floating around, or does it have to be centered at the origin?
Title: Re: script request-copy along a spline
Post by: floyd86 on June 16, 2008, 07:23:09 am
Ye  i would like to see such a script too. A kind of grassgen like but then as parametic (?) script.
Title: Re: script request-copy along a spline
Post by: karate5662 on June 16, 2008, 09:03:01 am
This seems pretty straightforward, since it is only a variation on the chain_maker.  I don't think I understand everything you are saying, though.

"copypath" is the name of the spline you want to follow.
"copytarget" is what you want to copy along the spline.

What is the 10 and 1 for?  The 10 is replaced by what - a count of how many times it is copied?

How would you handle the orientation of copytarget?  What would copytarget's origin be in relation to copypath?  What is the distance between copies of copytarget?  These questions are important because you must calculate the size (length) of copytarget to space it along copypath.

Once these questions are answered, I can turn out the script pretty fast.

The 10 is how much space is in between the objects. a value of 1 and they would be close together.  a value of 10 and they would be spread out. so the "10 would be replaced with the length of the object.

I forgot to explain the "1" in my above post. the 1 would be whether to rotate the object with the spline, like the links in the chain script. 1 would be yes and 0 would be no.

I you decide to make it a parametric, though, listen to hihosilvers advice. those 2 variables could be used in the parametric.

karate, the 10 and 1 wouldn't matter.  NickE can make an option to change the spacing between the options if it were to be parametric, as well as the size perhaps?  It would be nice if you could do 2 objects as well, kind of like you did with the chain script.  Then, we could create our own fancy chains if need be.

the 2 objects could be done easily if you join the solids.

Personally I would think that the lead of the object would be the top and the butt would be the bottom of the object.  Can you use an object that's floating around, or does it have to be centered at the origin?

I agree with orientation of the object. the object would probobly have to be centered to it's own origin to work properly.
Title: Re: script request-copy along a spline
Post by: NickE on June 18, 2008, 02:49:43 am
Attached is the requested script.  It copies a mesh along a spline.  To use it, you must have a mesh called "copytarget" that will be copied.  You must also have a spline called "copypath".  After selecting the icon, click in the editor window to make the parametric shape of the copytarget copied along the copypath appear.  If you double-click on the parametric shape, the parameters will show:

Center parameter: 1=mesh's centroid follows spline and is the origin of rotation, 0=mesh's own coordinate system's origin follows the spline and is the origin of rotation.

X-Rotate, Y-Rotate, Z-Rotate: degrees of rotation to apply to the mesh before it follows the spline (0 to 360 degrees).

Spacing %:  Amount of spacing between copies of the mesh expressed as a multiple of the z-width of the mesh after rotation (0.001 to 10)

Note that the coordinate system of the spline has the z-axis along the spline so the mesh copies are spaced according to the z-width of the mesh after rotations are applied.

Also note that the mesh has its own coordinate system based on the values of its points regardless of how it is displayed in the editor window.  Even if you change the orientation and origin of the mesh, it retains its original point values.

*** Remember to convert the parametric shape to a mesh before using it in any other objects, in figures, or scenes.  It is totally dependent on the original "copytarget" mesh and "copypath" spline while it remains a parametric shape.  As Steve stated:  parametric scripts were never intended to work this way.  ***

One final note:  this script only works with Anim8or 0.97b (or later, when they arrive).

Please try it out and please let me know your feedback.

Title: Re: script request-copy along a spline
Post by: karate5662 on June 18, 2008, 10:00:43 am
wow...

it works amazingly, nice job.

I was able to make quite a nice set of tank tracks in about 5 minutes. well done.

EDIT: added another, better track
Title: Re: script request-copy along a spline
Post by: thecolclough on June 19, 2008, 05:22:08 am
really good tracks, karate5662!  especially the 2nd one.

i really need to get into scripting...

- colclough
Title: Re: script request-copy along a spline
Post by: kreator on June 19, 2008, 09:59:14 am
I`m having a few problemos with this .... i have a mesh called copytarget and a spline called copypath....and all I get is this.....this is 0.97b version too.
Title: Re: script request-copy along a spline
Post by: karate5662 on June 19, 2008, 10:10:41 am
is the object you are using as copytarget a parametric shape?
YOu have to convert it to a mesh first. and make sure there is no typos.
Title: Re: script request-copy along a spline
Post by: kreator on June 19, 2008, 12:27:22 pm
I take a parametric Shape to be a standard cube.... ie The bounding box is yellow as opposed to a mesh (White bounding box).... anyway i used the cube first to get that error ... converting it to a mesh does nothing for me just sits there.

typos what are they ....?????  ???
Title: Re: script request-copy along a spline
Post by: karate5662 on June 19, 2008, 12:35:21 pm
when the script gave you the error it made a little box. double click on that box and press OK.

here's a helpful video i made:
http://www.box.net/shared/qbhp6i83oc (http://www.box.net/shared/qbhp6i83oc)
Title: Re: script request-copy along a spline
Post by: Arik_the_Red on June 19, 2008, 02:11:32 pm
Well now, the timing of this little tool is awesome!

What with the tank projects I've stirred up at AnimAnon, and a related project going on for a bigger purpose... 

I'll definitely be taking this tool to task!

Thank YOU!!!!!
Title: Re: script request-copy along a spline
Post by: kreator on June 19, 2008, 03:32:15 pm
That is the coolest script yet!!...... now all we need is objects to folllow a path/Spline in scene mode then that will be very cool ( the attach to path in Menu)

Thanks Nicke for your efforts with these scripts! I salute you!

edit: On some occassions you do not get anything on the GUI, although it obviously has done something from the de-bug screen 
Title: Re: script request-copy along a spline
Post by: NickE on June 19, 2008, 11:15:29 pm
Kreator,
I do not understand what you meant about objects following a path/Spline in scene mode.  Are you referring to their motion?

Could you be referring to the ability to draw a spline in object mode and then be able to use that as a controller in scene mode?  I think I could write a script that could write a controller script from a spline drawn in object mode that you could cut and paste into scene mode.  Very interesting idea. 
Title: Re: script request-copy along a spline
Post by: kreator on June 20, 2008, 03:23:57 am
NickE: Yep thats exactly what I am referring to at the moment, you must stick a target in so that the object can follow , it would be so much nicer to have a path then the object can follow that ...... there is a "Follow Path" In the Scene Editor Menu under BUILD but that Has not been Implemented at the moment .....it would be so much better if it was.

This program will only get better when all these little things are implemented,

I know this is totally off topic but the other thing that niggles me in anim8or whilst in scene mode, is the total inability to Copy/ paste duplicate objects (Carrara Pro 5 has this )

 
Title: Re: script request-copy along a spline
Post by: Orange Pickle on June 20, 2008, 03:35:24 am
Thanks karate5662 for the tutorial and NickE for the script!
Title: Re: script request-copy along a spline
Post by: karate5662 on June 20, 2008, 01:31:14 pm
no problem pickle

I know this is totally off topic but the other thing that niggles me in anim8or whilst in scene mode, is the total inability to Copy/ paste duplicate objects (Carrara Pro 5 has this ) 

I agree with that.

this animation would have taken 2-3 hours if i could have copied and pasted in scene mode. instead, it took 4 days:
Title: Re: script request-copy along a spline
Post by: Steve on June 20, 2008, 02:50:21 pm
What do you need to copy?  Objects?  Or Objects and all of thier controllers, dependendencies and other properties?  The same question applies to the paste operation.
Title: Re: script request-copy along a spline
Post by: karate5662 on June 20, 2008, 04:05:44 pm
it would be nice to copy and paste objects and their keyframes.

Another feature i would like is to be able to make closed paths in scene mode that would be like splines but the object on the path keeps going after it gets to the end, like a loop.
Title: Re: script request-copy along a spline
Post by: lynn22 on June 25, 2008, 06:10:16 pm
I tried this script today and got the same error as kreator.
Attached is the Debug Output
I made sure there were not typos in the names of the spline and mesh, which was just a small ball.

I must be missing something, a push in the right direction would be helpful, many thanks.
Title: Re: script request-copy along a spline
Post by: NickE on June 25, 2008, 07:14:46 pm
lynn22,

In those early scripts, I forgot to put error checking to insure that you actually have a mesh called "copytarget" and a spline (path) called "copypath".  In the case of the error you posted, it is caused by NOT having a mesh called "copytarget" present.  If I get time, I will post an updated version of that script with error checking.
Title: Re: script request-copy along a spline
Post by: lynn22 on June 26, 2008, 02:56:01 am
NickE, when I left here last night I tried again.
Drew a spline, called it copypath and a little ball, called it copytarget, selected both and made attached screenshot.
Then I clicked on the script button and on the edit window and I still got the same error messsage.  ???
Title: Re: script request-copy along a spline
Post by: kreator on June 26, 2008, 03:04:22 am
Seems to me that the Lynn22 action, has something to either do with memory or pagesys...
Every time I try on my little laptop at work the function does something as it writes the result to debug console but no parametric shape appears on the GUI....now the laptop only has about 200md when fully loaded. 

If I do the same operation from home on my desktops that have 2gb memory , i have no problem whatsoever .,
Title: Re: script request-copy along a spline
Post by: hihosilver on June 26, 2008, 05:04:49 am
Convert the sphere to mesh.  Try it then.
Title: Re: script request-copy along a spline
Post by: karate5662 on June 26, 2008, 08:32:01 am
Convert the sphere to mesh.  Try it then.
kreator had that problem when he first tried to use the script with a parametric cube. this script only works with meshes, convert it to a mesh.
Title: Re: script request-copy along a spline
Post by: lynn22 on June 26, 2008, 02:05:45 pm
Sorry, I tried it with both parametric and mesh and I got the same error message each time.
I guess it must me my PC, it's an old work horse so it may be reluctant to learn new tricks ;)
Title: Re: script request-copy along a spline
Post by: kreator on June 26, 2008, 02:55:07 pm
It definately is a memory problem.... I tried it on another computer with 64Mb memory.... and it would not display anything to the GUI  , although debug is showing 24 objects created .

And as a point of note i did convert the base object to mesh before starting

 
Quote
take a parametric Shape to be a standard cube.... ie The bounding box is yellow as opposed to a mesh (White bounding box).... anyway i used the cube first to get that error ... converting it to a mesh does nothing for me just sits there.
Title: script request-copy along a spline - WHERE IS FOR DOWNLOAD ??
Post by: neirao on July 05, 2008, 02:04:34 pm
Please NickE,

where is the script "meshpath in a8s" for DONWLOAD??

i donīt found... ??? ???

referent in this video  http://www.box.net/shared/qbhp6i83oc .

thanks!



lynn22,

In those early scripts, I forgot to put error checking to insure that you actually have a mesh called "copytarget" and a spline (path) called "copypath".  In the case of the error you posted, it is caused by NOT having a mesh called "copytarget" present.  If I get time, I will post an updated version of that script with error checking.
Title: Re: script request-copy along a spline
Post by: NickE on July 05, 2008, 02:10:02 pm
The file is available for download further up in this thread:

http://www.anim8or.com/smf/index.php?action=dlattach;topic=879.0;attach=1027 (http://www.anim8or.com/smf/index.php?action=dlattach;topic=879.0;attach=1027)

Title: Re: script request-copy along a spline
Post by: neirao on July 05, 2008, 03:03:54 pm
Thank you Nicke!




The file is available for download further up in this thread:

http://www.anim8or.com/smf/index.php?action=dlattach;topic=879.0;attach=1027 (http://www.anim8or.com/smf/index.php?action=dlattach;topic=879.0;attach=1027)


Title: Duplicate objects based in points (mesh2path_2.a8s) modified ?
Post by: neirao on July 08, 2008, 10:26:52 am
Hi again NickiE,

is possible to charger "mesh2path_2.a8s" to duplicate objects BASED ONLY IN THE POINTS POSITIONS and axis X,Y and Z of mesh?
follow sample:
(http://nrecado.890m.com/temp/request_hair_demo.jpg)

for generate hair, grass etc...

.a8s for download?

(PS: the Standalone Grassgen software donīt work right in rounded objects and axis Y).
I believe then a8s. script work better!!

Thank you! :D

- Sorry my english ok, iīm not americam  ;)

Neirao - Brazil



Attached is the requested script.  It copies a mesh along a spline.  To use it, you must have a mesh called "copytarget" that will be copied.  You must also have a spline called "copypath".  After selecting the icon, click in the editor window to make the parametric shape of the copytarget copied along the copypath appear.  If you double-click on the parametric shape, the parameters will show:

Center parameter: 1=mesh's centroid follows spline and is the origin of rotation, 0=mesh's own coordinate system's origin follows the spline and is the origin of rotation.

X-Rotate, Y-Rotate, Z-Rotate: degrees of rotation to apply to the mesh before it follows the spline (0 to 360 degrees).

Spacing %:  Amount of spacing between copies of the mesh expressed as a multiple of the z-width of the mesh after rotation (0.001 to 10)

Note that the coordinate system of the spline has the z-axis along the spline so the mesh copies are spaced according to the z-width of the mesh after rotations are applied.

Also note that the mesh has its own coordinate system based on the values of its points regardless of how it is displayed in the editor window.  Even if you change the orientation and origin of the mesh, it retains its original point values.

*** Remember to convert the parametric shape to a mesh before using it in any other objects, in figures, or scenes.  It is totally dependent on the original "copytarget" mesh and "copypath" spline while it remains a parametric shape.  As Steve stated:  parametric scripts were never intended to work this way.  ***

One final note:  this script only works with Anim8or 0.97b (or later, when they arrive).

Please try it out and please let me know your feedback.


Title: Re: script request-copy along a spline
Post by: NickE on July 08, 2008, 10:32:10 am
Please see the response to your other similar post:

http://www.anim8or.com/smf/index.php?topic=951.msg6950#msg6950 (http://www.anim8or.com/smf/index.php?topic=951.msg6950#msg6950)
Title: Re: script request-copy along a spline
Post by: Boywonda1 on December 30, 2008, 04:10:12 am
Thanks NickE this really helps.i guess i have to delete my suggestion in the forum.:D
Title: Re: script request-copy along a spline
Post by: dajean on January 30, 2009, 01:40:30 pm
Hey Nicke when I try to download the video tutorial I get a php file, but no video.

any idea why?

Title: Re: script request-copy along a spline
Post by: dajean on January 30, 2009, 01:43:15 pm
sorry for double posting, the file is called "index.php"
Title: Re: script request-copy along a spline
Post by: NickE on January 30, 2009, 06:53:08 pm
It is not a video tutorial, it is a web page.
Title: Re: script request-copy along a spline
Post by: Tanzim on January 31, 2009, 06:42:01 am
Just rename the file to x.avi (x= file name, and avi=the actual video type)
Title: Re: script request-copy along a spline
Post by: NickE on January 31, 2009, 08:26:16 am
My apologies.  I though you were referring to the web page tutorial on animating tank treads at:

http://www.tranceportsoftware.com/anim8orstuff/ (http://www.tranceportsoftware.com/anim8orstuff/)
Title: Re: script request-copy along a spline
Post by: Andyba on June 07, 2009, 05:06:50 am
Wow thank you NickE.
This is a very handy script.