Notifications
Clear all

[Closed] sweep modifer dynamic properties

 em3

Hi! I am trying to avoid having to code in all of the properties of each sweep type (1,2,3,4…)

right now I have


		case sweepType of
		(
			10: --Ibeam
			(
				local swp = sweep()
				addmodifier thePath swp
				swp.CurrentBuiltInShape = sweepType
				classOf thePath
				local p = swp[4].object
				case theAxis of
				(
					1:
						(
							p.wide_flange_width = (obb[2]) as float
							p.wide_flange_length = (obb[3]) as float
						)
					2:
						(
							p.wide_flange_width = (obb[1]) as float
							p.wide_flange_length = (obb[3]) as float
						)
					3:
						(
							p.wide_flange_width = (obb[1]) as float
							p.wide_flange_length = (obb[2]) as float
						)
				)
			)

I have to do this for each type. Is there a way to loop through the properties of the modifier and grab the length and width?

Thanks!

4 Replies
 PEN

getPropNames, getProperty, setProperty

Is that what you are looking for?

 em3

Hi Paul, thanks!

Those certainly look like the ones. Hard to believe I couldn’t find those after a moderately determined search.

So basically I will say,
(pseudo)


for prop in getPropNames where (getPropNames[prop] == "*width") do p.getPropNames[prop] = (obb[1])
--or whatever

I will try it out, thanks!

More like something like this:

for prop in (getpropnames swp[4]) where (matchpattern (prop as string) pattern:"*width") do (setproperty swp[4] prop 8.0)

Where the width parameter is set to the value of 8.0. Remember that property and propname properties return name values and should be converted to a string and tested with something like matchpattern. Also, as you previously found out the 4th subanim of the sweep modifier is where the properties of the built-in sections are stored. You will need to also test if it is in built-in mode or not, as the custom section doesn’t have a 4th subanim.

-Eric

 em3

Awesome Eric, thank you for the clarification!