Forum > modo > SDK, Scripting & Macros > Constrain to Path and Duplicate script

Topic - Constrain to Path and Duplicate script

Page 1 of 4
[   1  2  3  4  |  Next ]
  [ Last ]
Karlsson
rating: signal +18 signal 

Sweden
127 posts
Hi!
I recently needed to make a bicycle chain for a work project.
I found it was very time consuming and hard to come up with a chain of say 200 instances.
Fortunately I didn't need to animate the chain, so I got away with just using the curve clone tool.
But what if I wanted it to move?
I came up with this script that builds a rig for you!
You can control the animation, movement, spacing and axis of the items constrained in one simple controller.

I uploaded two instruction videos to vimeo for you to look at
Showing different functionalities of the script:
http://vimeo.com/5663678
Old video:
http://vimeo.com/5539917
Showing how to rig a basic bicycle chain:
http://www.vimeo.com/5540650

You can download the scripts and config from this link:
http://erka.se/script/pathDuplicate_v1.00.zip

Is there anyway I can share this in the share section page?
This should fit in the assemblies tab but you can't upload scripts, can you?

Anyway, hope you like it and find it useful! :)


EDIT: Updated with new script and video!

Message edited by Karlsson on 12/30/2009 - 2:26 PM

7/10/2009 - 11:37 AM
[ Quote ]
JL3D
rating: signal 0  

Springfield, VA
25 posts
BRILLIANT!
7/10/2009 - 12:49 PM
[ Quote ]
Gim Dong joo
rating: signal 0  

South Korea
171 posts
It's awesome. Thank you.

Message edited by Gim Dong joo on 7/10/2009 - 1:23 PM

7/10/2009 - 1:11 PM
[ Quote ]
Jason Bartley
rating: signal 0  

Indiana
241 posts
Quote from Karlsson :
Is there anyway I can share this in the share section page?
This should fit in the assemblies tab but you can't upload scripts, can you?



You should be able to just upload the zip file containing the script and config file to the asset site.
7/10/2009 - 1:17 PM
[ Quote ]
3dforward
rating: signal 0  


85 posts
Not just 1, but 2 feathers for your cap.
7/10/2009 - 1:56 PM
[ Quote ]
Karlsson
rating: signal +2 signal 

Sweden
127 posts
thanks! :)

I have now updated the script with a few new features.

1. You can now choose what type of path constraint you want.
- Checking both Align and Position will make a regular path constraint.
- Checking only Position will make a Path Position constraint.
- Checking only Align will make a Path Normal constraint.
- Checking none of the options will also make a regular path constraint.

2. Added roll value to both the individual control objects and the main control object.

3. Added automatic resizing of control locators shapes. To prevent them to be to big or to small.

Link in above post is updated with the new version.

/Erik
7/12/2009 - 10:31 AM
[ Quote ]
John Rafferty
rating: signal 0  

Sweden
798 posts
This very cool! Tack for sharing

Cheers

John

:-)
7/13/2009 - 4:22 AM
[ Quote ]
gswartz
rating: signal 0  

Canton, OH
596 posts
Karlsson, simply fantastic! Thanks for sharing!!!
7/13/2009 - 9:21 AM
[ Quote ]

Anchorage, Alaska (USA)
1949 posts
Thank you for the effort, the script, and the videos. This is something we can all use a lot, I'm sure.

Great work, and great of you to share it with us.

Can you help me with something? I'm running this script on a Mac, and it appears to function perfectly, except that I don't get the pop-up palette shown in your videos. Is that something I have to set up myself, or is that supposed to appear when you run the script?

Thanks again. This has great potential.

PS> Some time later...
I've created an animated roller coaster, using your great script! The thread is at http://forums.luxology.com/discussion/topic.aspx?id=37152 This is going to be fun!

Modo, and the modo community ROCKS!
Visit http://www.mikejamesmedia.com

Message edited by Mike James modo on 7/14/2009 - 9:31 AM

7/14/2009 - 4:12 AM
[ Quote ]
Karlsson
rating: signal 0  

Sweden
127 posts
Quote from Mike James modo :
Can you help me with something? I'm running this script on a Mac, and it appears to function perfectly, except that I don't get the pop-up palette shown in your videos. Is that something I have to set up myself, or is that supposed to appear when you run the script?



Cool nice to hear and see that you find it useful :)

About the pop-up, do you mean the channel-haul you get after you run the script?
The channel-haul should be activated right after you run the script. In the same way you get when you select the control-locators.
I'm using the item.channelHaul command for this.

Or do you mean the form I have with all the settings I use before I run the script?


7/14/2009 - 9:57 AM
[ Quote ]

Anchorage, Alaska (USA)
1949 posts
Hello Karlsson,

The channel haul is appearing properly. It's the form that I'm missing. Any ideas?

I may have mis-installed the config file, since I've never installed a custom one before. I placed it in the Luxology/Configs folder. Then, when I started modo, I did "config import" with your file, followed by a "config save". (Is that correct?)

Modo, and the modo community ROCKS!
Visit http://www.mikejamesmedia.com

Message edited by Mike James modo on 7/14/2009 - 10:11 AM

7/14/2009 - 10:01 AM
[ Quote ]
Karlsson
rating: signal 0  

Sweden
127 posts
Alright, so you used it without the form, with just the default values then?

I forgot to put the description of how to install here. It's in the pathDuplicate.py but I paste it here.

#Installation
#Put the script file pathDuplicate.py in users script folder
#Put the config file pathDuplicate.CFG in users config folder
#In Modo go to System> Form Editor and look for the form "Constrain to Path and Duplicate"
#Place it where ever you like and use the options and "Populate Path" to run the script.

An alternative way of getting the pop-up is to:
- Go to Layout> Palettes> New Palette
- At the arrow on the right choose "Form View"
- Right click the upper part where it says Form View
- Look for the Constrain to Path and Duplicate

You should now have a form like the one I showed in the videos.

7/14/2009 - 10:18 AM
[ Quote ]

Anchorage, Alaska (USA)
1949 posts
Yes, the little demo rig I did used the defaults.

Thank you for the instructions. I'm trying it now...

Modo, and the modo community ROCKS!
Visit http://www.mikejamesmedia.com

7/14/2009 - 10:22 AM
[ Quote ]

Anchorage, Alaska (USA)
1949 posts
Thank you again, karlsson!

I was able to place the palette in my "basic" tab, and also understand how to create floating palettes now. I wasn't clear on what you meant when you said "Use the options and "Populate Path", but I took a guess that it was a script command and placed it there in quotes, like this:

@pathDuplicate.py "Populate Path"


It didn't produce an "automatic" popup. Is that what you meant?

The script works great. This will help a lot of people create some fun rigs.

Modo, and the modo community ROCKS!
Visit http://www.mikejamesmedia.com

7/14/2009 - 11:00 AM
[ Quote ]
Karlsson
rating: signal 0  

Sweden
127 posts
To make it easier, I did a quick macro that pops up the palette instead. I updated the download link with this file attached in the zip-file. http://erka.se/script/pathDuplicate.zip

Just download the .zip again and put the pathDuplicate_pop.LXM in your users script folder. Now run this macro in modo and it will pop-up the form!

Sorry about the bad description.

Let me know if you have any more troubles or questions!

7/14/2009 - 11:12 AM
[ Quote ]

Luxology Headquarters
2162 posts
Super awesome. I have a project where I needed to make a bike chain, and its been on hold, this may be what I need to finish it off now. Thank you so much.

James Darknell
http://www.mutant-pixel.com

7/14/2009 - 11:28 AM
[ Quote ]

Anchorage, Alaska (USA)
1949 posts
Hi Karlsson,

For my roller coaster rig, I planned to do this, based on early testing:

1. Created a (new) "track path" curve

2. Duplicated it, renaming the second one "cars path curve". This second path was raised slightly in the Y axis, to place the cars above the track.

3. First, I used your script to constrain the track segments to the "track path" curve. That worked great, generating over 500 track segments. (!) Image attached.

4. I then wanted to run your script again, constraining the passenger cars to path #2, called "cars path curve". This is where the script fails, with a report "The channel name must be unique." Do you know how I can solve this?

Thanks for any help you can provide. I love this script.

Modo, and the modo community ROCKS!
Visit http://www.mikejamesmedia.com

7/16/2009 - 4:10 AM
[ Quote ]
Karlsson
rating: signal 0  

Sweden
127 posts
Yes I think I know whats causing this.
The script creates a new channel named "nr". If this channel already is created the error you talking about will come up.

You can easily fix this by going to the object you are trying to attach to the curve and have a look at its channels.
Locate the "nr" channel, right click and choose remove channel.

I will try making a error handling of this so the script always creates a unique channel name.

Thanks, hope it works!

7/16/2009 - 4:21 AM
[ Quote ]
Blu Ego
rating: signal 0  

The Beautiful Florence (Italy)
250 posts
Love this script.
Thank you !
7/16/2009 - 6:13 AM
[ Quote ]

Anchorage, Alaska (USA)
1949 posts
Thank you for the fast response, Karlsson!

Your solution works perfectly... No bigee to use your workaround until you update the script. Really great stuff. I hope other IK-related scripts appear. It really speeds things up a LOT!

Here's an OpenGL preview of what I've got so far, thanks to you.
The movie (40 seconds, 984k QuickTime)

Modo, and the modo community ROCKS!
Visit http://www.mikejamesmedia.com

Message edited by Mike James modo on 7/16/2009 - 7:30 AM

7/16/2009 - 6:15 AM
[ Quote ]

Anchorage, Alaska (USA)
1949 posts
Hi again Karlsson,

Because of the huge number of copies I'm generating on this project, (about 1500 track sections) I'm starting to encounter memory problems. Is it possible to do the same thing your script does, but with instances or replicators?

Modo, and the modo community ROCKS!
Visit http://www.mikejamesmedia.com

7/16/2009 - 4:13 PM
[ Quote ]
Karlsson
rating: signal 0  

Sweden
127 posts
Hi Mike, I tried with both replicators and instances so it should work.
Maybe I should add an option for that in the script.

If you want to use instances, take your mesh item and create a instance of it, then instead of using the base mesh select the instance mesh and the curve and run the script as usual. Should work!

If you want replicators, use the replica clone tool to create a replicator of your object. Then select the replicator and the curve and run the script.

Again would be cool to have this built in the script as an option. Will see if that is possible!

/Erik
7/17/2009 - 6:12 AM
[ Quote ]

Toronto, Ontario
764 posts
I'm glad this was featured in the modcast alert -- I'd missed it in the forums.

Amazing stuff! It will be so ridiculously useful...
7/17/2009 - 3:13 PM
[ Quote ]
Sesshumaro
rating: signal 0  

Hamburg, Germany
116 posts
great and useful script. Good job Karlsson ;-)

cheers
7/17/2009 - 3:51 PM
[ Quote ]

Anchorage, Alaska (USA)
1949 posts
Hi Karlsson,

I've tried the script with both replicators and instances, and it does work. At this scale, the differences in generated file size are significant:

• Original file, before replication ("parts" only) - 14 MB

• File size with "raw" script (duplicates generated) 61.7 MB

• File size with instances - 21.5 MB

• File size with replicators - 22.1 MB (Interesting - I expected replicators to take less than instances.)

Thank you for this great tool. I'll be looking forward to any improvements you make in this script, as well as others you create.

And...
I find that this file, even at 22 MB, is too much for my system to work with at reasonable speed. Certainly nothing to do with this wonderful script, just a lot of parts. So, if any of you want to play with this file, it's HERE. (5MB Zip)

Modo, and the modo community ROCKS!
Visit http://www.mikejamesmedia.com

Message edited by Mike James modo on 7/18/2009 - 4:39 AM

7/18/2009 - 1:07 AM
[ Quote ]
Page 1 of 4
[   1  2  3  4  |  Next ]
  [ Last ]
Search
Topic Subscriptions
Forum Preferences
Forum Help
Search the Forums
Advanced Search
modo Training Materials

New for modo 401
Backpack Modeling

New for modo 401
Human Eye

HDRE Urban Kit

HDRE Landscape Kit

Studio Lighting & Illumination Kit

Product Auto Presets

Splash Kit

Subdivision Modeling

modo 401 Spotlight

Real World modo

Shader Tree Essentials

modo 401 Courseware

Rotary Aircraft Engine

Architectural Interior Rendering Series (Intermediate)

Architectural Modeling Series (Intermediate)

Rapid Prototyping Training Series (Intermediate)

Concept Car Training Series (Intermediate)

Cartoon Kid Training Series (Intermediate)

The Alley - Real-Time Asset and Level Creation (Intermediate)

modo is a registered trademark of Luxology LLC., in the USA and/or other countries.
All products or brand names mentioned are trademarks or registered trademarks of their respective holders.