Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

Pages: [1] 2 3

Author Topic: script request-copy along a spline  (Read 22609 times)

karate5662

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • my mini city
script request-copy along a spline
« on: June 16, 2008, 12:49:21 am »

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.
Logged

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: script request-copy along a spline
« Reply #1 on: June 16, 2008, 02:36:05 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.
Logged

hihosilver

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1294
    • View Profile
Re: script request-copy along a spline
« Reply #2 on: June 16, 2008, 08: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?
Logged

floyd86

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1056
    • View Profile
    • http://youtube.com/profile?user=floyd386
Re: script request-copy along a spline
« Reply #3 on: June 16, 2008, 11:23:09 am »

Ye  i would like to see such a script too. A kind of grassgen like but then as parametic (?) script.

karate5662

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • my mini city
Re: script request-copy along a spline
« Reply #4 on: June 16, 2008, 01:03:01 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.

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.
« Last Edit: June 16, 2008, 01:09:17 pm by karate5662 »
Logged

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: script request-copy along a spline
« Reply #5 on: June 18, 2008, 06: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.

« Last Edit: June 18, 2008, 06:52:13 am by NickE »
Logged

karate5662

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • my mini city
Re: script request-copy along a spline
« Reply #6 on: June 18, 2008, 02:00:43 pm »

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
« Last Edit: June 18, 2008, 02:12:10 pm by karate5662 »
Logged

thecolclough

  • Sr. Member
  • ****
  • Posts: 820
  • 3D Ignoramus 1988-2002, Anim8or User 2002-present.
    • View Profile
    • www.mattghc.com
Re: script request-copy along a spline
« Reply #7 on: June 19, 2008, 09:22:08 am »

really good tracks, karate5662!  especially the 2nd one.

i really need to get into scripting...

- colclough
Logged

kreator

  • Hero Member
  • *****
  • Posts: 1113
  • Anim8or, Blender, & Carrara. A Great Combination!
    • View Profile
    • Anim8orWorld
Re: script request-copy along a spline
« Reply #8 on: June 19, 2008, 01:59:14 pm »

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.
Logged
O

karate5662

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • my mini city
Re: script request-copy along a spline
« Reply #9 on: June 19, 2008, 02:10:41 pm »

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.
Logged

kreator

  • Hero Member
  • *****
  • Posts: 1113
  • Anim8or, Blender, & Carrara. A Great Combination!
    • View Profile
    • Anim8orWorld
Re: script request-copy along a spline
« Reply #10 on: June 19, 2008, 04: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 ....?????  ???
« Last Edit: June 19, 2008, 04:29:17 pm by kreator »
Logged
O

karate5662

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • my mini city
Re: script request-copy along a spline
« Reply #11 on: June 19, 2008, 04: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
« Last Edit: June 19, 2008, 04:57:18 pm by karate5662 »
Logged

Arik_the_Red

  • Sr. Member
  • ****
  • Posts: 760
  • Just another aninoob...
    • View Profile
    • śwakened!
Re: script request-copy along a spline
« Reply #12 on: June 19, 2008, 06: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!!!!!
Logged

kreator

  • Hero Member
  • *****
  • Posts: 1113
  • Anim8or, Blender, & Carrara. A Great Combination!
    • View Profile
    • Anim8orWorld
Re: script request-copy along a spline
« Reply #13 on: June 19, 2008, 07: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 
« Last Edit: June 19, 2008, 08:41:19 pm by kreator »
Logged
O

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: script request-copy along a spline
« Reply #14 on: June 20, 2008, 03:15:29 am »

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. 
Logged
Pages: [1] 2 3