Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4120

ScaleObject and TransformObject behaviour

$
0
0

Andras Sobester wrote:

Hello,

I am encountering problems with scaling an object at different factors in x, y, z. Here is what I am trying to do:

# FuselageOMLSurf is the result of a complex, parametric script. I am trying to scale it by 5 in the y direction and 10 in the z direction here (though in my actual script Scaling is the argument of the function) 

Scaling = [1, 5, 10] 

FuselageOMLSurf = rs.ScaleObject(FuselageOMLSurf, (0,0,0), Scaling)

When I first run it, this produces the expected result: FuselageOMLSurf stretches by a factor of 5 in the y direction and 10 in the z direction. However, after a few runs it starts mixing up the axes and will stretch it in the z direction by a factor of 5 and y by a factor of 10, etc.

My suspicion is that this has something to do with the line "Scaling is based on the active construction plane." is the ScaleObject header, but I don't know how to ensure that it all happens in world coordinates.

I don't use construction planes - at least, not knowingly! I have also tried:

Scaling = [1, 5, 10] 

xform = rs.XformScale(Scaling)

FuselageOMLSurf = rs.TransformObjects(FuselageOMLSurf, xform)
   

This seems to have the same (inconsistent) result.

In either case, if I open a new document, the first time I run the script the result is as expected. But if I delete the resulting objects and re-run the script, it starts getting hit and miss.

Any help would be much appreciated.

Posts: 6

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4120

Trending Articles