View Full Version : Selecting by name and collecting
lucpet 12-14-2010, 04:43 AM I need to be able to select a set of point helpers with names pointO_01, pointO_02 etc from a bunch of point helpers with different names.
How do I do it, and include it into the following code which in itself probably needs tidying up
but does the job atm on all the points.
select(for p in helpers where classof p == point collect p)
points = for p in getCurrentSelection() where isKindOf p point collect p
for i = 2 to points.count do rotate points[i] (angleaxis spnDeg.value [0,1,0])
Appreciate any help
Nevermind I fixed it..................................yay! :blush:
|
|
labbejason
12-14-2010, 07:10 AM
If you're trying to collect helpers by a specific name then..
(
for obj in $pointO_* where ( (classOf obj) == point) do
(
-- Do changes to helpers
)
)
You won't actually need to select the objects to rotate them either.
Oops just read the last line of your post that you got it :)
lucpet
12-14-2010, 08:22 AM
Hey thanks anyway I ended up just using
poiArr = ($pointO_* as array)
for i = 2 to poiArr.count do rotate poiArr[i] (angleaxis spnDeg.value [0,1,0])
a lot simpler
It's always good to have another way to tackle things, I find myself always over thinking things and giving myself a headache lol
plastic
12-14-2010, 08:51 AM
Hey thanks anyway I ended up just using
poiArr = ($pointO_* as array)
for i = 2 to poiArr.count do rotate poiArr[i] (angleaxis spnDeg.value [0,1,0])
a lot simpler
It's always good to have another way to tackle things, I find myself always over thinking things and giving myself a headache lol
even simpler:
for i in $pointO_* do rotate i (angleaxis spnDeg.value [0,1,0])
of course it's the same as labbejason's solution and it's always a good idea to test object class before doing stuff.
lucpet
12-14-2010, 09:40 AM
Thanks Marc, Jason
The script I'm working on can be seen & downloaded on my site [link below] & Scriptspot, it automates the tutorial from Dario Strano https://www.youtube.com/watch?v=-02mLcuNutQ
The tute rigs a piston but leaves it flexible enough so it can be adjusted to suit differing conrod and crankshaft lengths and animation speeds as well as rotation offsets. I'm far from a mechanic so forgive my descriptions. Dario and I are in contact and we are adding functionality as we go, I get to learn Maxscript and make peoples live a little easier and potentionally quicker, but without all the help from the great people on this site I'd still be struggling.
:bowdown: :beer:
CGTalk Moderation
12-14-2010, 09:40 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.