How do I? if $ == $box* then

if $ == $box001 then
 
(
sphere()
) 
else 
(
Cone ()
)

if $box001 is selected, then create box else create cone
This code works.

if $ == $box* then
 
(
sphere()
) 
else 
(
Cone ()
)

box001 or box002 or box...etc. if one of them is selected, then create box else create cone

but the code does not work.
How do I?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Graph's picture

( local foundABox =

(
	local foundABox = false
 
	for o in selection while not foundABox do if matchPattern o.name pattern:"box*" ignoreCase:true do foundABox = true
 
	if foundABox then 
	(
		print "sphere()"
	)
	else
	(
		print "cone()"
	)
 
)

Raphael Steves

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.