Notifications
Clear all

[Closed] Selecting by name and collecting

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!

4 Replies

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

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

1 Reply
(@plastic)
Joined: 11 months ago

Posts: 0

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.

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: