Notifications
Clear all

[Closed] Does "Edit_Poly:scaleSelection" work on SOL?

Using the Edit_Poly modifier, I’ve been trying to scale a face without any luck. Here’s a little code to illustrate…

(
rollout scaletest "Scale test"
(
button btn_1 "Make Cylinder"
button btn_2 "Scale Face"
local c
local ep
local pct = 2
 
on btn_1 pressed do
(
c = cylinder radius:50 height:20 heightsegs:2 sides:20
)
 
on btn_2 pressed do
(
convertToPoly(c)
select c
polyop.setFaceSelection c #{42}
ep = Edit_Poly()
addModifier c ep
max modify mode
subobjectlevel = 4
/* problem 1: if I insert this line...
ep.SetOperation #TransformFace
... I get a "Runtime error: Unrecognized code: #TransformFace" 
runtime error */
 
-- here's problem 2...
 
ep.scaleSelection [pct,pct,pct]
 
/*The previous line scales the entire object rather than
the selected face. If I make the 3point [pct,pct,0] the
cylinder flattens out like a pancake. */ 
)
)
createDialog scaletest 200 70
)

I’ve done something similar with rotateSelection on subobjectlevel 2, and it worked fine. Am I overstepping the bounds of Edit_Poly or am I just screwing up? Many thanks.

6 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

I happened to have Max 2009 Beta open and after running your code, got exactly what you would expect (the selection got scaled, the rest not).
So I fired up Max 2008 and got exactly the same correct result.
So I closed that and launched Max 9, same story, correct (I guess) result – the polygon on top of the cylinder gets scaled 2 times, the rest stays, so it looks like a sort of a futuristic landing platform…

The big question is: What version of Max are you using and what does your result look like?

Thanks for the prompt response, Bobo. I’m running this on Max9 SP2. Also tried it on Max8 SP3 (on another machine) with the same results. Attached are shots after the first, then second button is pressed. I tried entering the code line for line in the Listener (minus the rollout stuff) and it worked exactly as it should, i.e., as it worked for you. Tried the same procedure with a box primitive… both by entering directly into the Listener and as a rollout… with the same results; worked as advertised in the Listener, got the whole object rather than the selected face scaling up. I think I need to go lie down.

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

This is spooky.
There must be something different about the way your modifier stack is being updated.
If NO faces are selected, on my machine nothing gets scaled. So it is not like the method sees no faces and scales the object, but it sees ALL faces selected for some reason and scales the object, which shouldn’t even be possible even if the stack’s selected wasn’t passed up correctly.

I don’t know what to suggest… Try shuffling the order of your selection/modify mode/SO=4 calls to see if they affect it in any way. For example, switch to modify mode first, then select the object and add the modifiers. Just try to see if there is anything different after you do so – you shouldn’t be getting such a result in the first place…

It is kind of Twilight Zonish. Predictably, it’s the final step on a project I’ve been working on. I’ll keep poking at it and report back.

Well, I played with the code seven ways to Sunday without being able to get it to scale properly. I did come up with a working solution by chucking out the scaling procedure altogether…

(
rollout scaletest "Scale test"
(
button btn_1 "Make Cylinder"
button btn_2 "Scale Face"
local c
local ep
local pct = 2
 
on btn_1 pressed do
(
c = cylinder radius:50 height:20 heightsegs:2 sides:20
)
 
on btn_2 pressed do
(
convertToPoly(c)
select c
polyop.setFaceSelection c #{42}
ep = Edit_Poly()
addModifier c ep
max modify mode
subobjectlevel = 4
-- replace ep.scaleSelection with the following
ep.SetOperation #Outline
ep.outlineAmount =10 
)
)
createDialog scaletest 200 70
)

For several reasons using #Outline actually solves several other problems, though I’m gonna have to rework some math. It really bothers me, though, that I haven’t figured out why the scaling wasn’t working for me. Also why #TransformFace isn’t being recognized. Hmmp. At any rate, thanks again, Bobo.

Just as a quick sanity check, here’s a quick swf of what’s been going on… http://www.e-nimation.com/turbosquid/scaleSelectionWeirdness/scaleSelectionWeirdness.html .