View Full Version : Flipping normals script
whitehorse 04-17-2004, 03:11 PM I am wanting to make a script that when i import and object it will go through them one by and and flip the normals.
how would you go about doing this.
it is a am having a problem importing a dxf file and the unfiy normals doesn't help
|
|
<code>
for obj in geometry do
(
addmodifier obj (normalModifier())
obj.modifiers[#Normal].flip = true
)
</code>
Khye
whitehorse
04-21-2004, 09:16 AM
thanks, that works great,
you are a life saver
would have taken ages to do manually
:bowdown:
Originally posted by whitehorse
thanks, that works great,
you are a life saver
would have taken ages to do manually
:bowdown:
It would't :)
Set selection filter in Main Toolbar to Geometry,
select all objects, add a Normal modifier on top of them all, check a checkbox. The script does the same.
(Not that I am against scripting or something... :))
Just for the fun of it, the script could be written in a single line without a loop as
addModifier geometry (normalModifier flip:true)
AddModifier is mappable, geometry is a collection that can be mapped to, and the normal modifier can be applied as instance to all objects with the parameter flip already set to true.
Sorry, I know, I am a smartA** ;)
whitehorse
04-22-2004, 06:44 AM
well that is another way to do it
Just when you think you're out of grasshopper school . . .
Khye
Originally posted by oatz
Just when you think you're out of grasshopper school . . .
Khye
Sorry, I hope I did not offend you. (if it did, please accept my public apology!)
I have to admit that if I would have to answer the question, I would have supplied the code you did. But then, when you see someone's code, you start thinking - hmmm, is it possible to get this code shorter? Faster? Does it need a loop? Does it need a unique modifier on each object? Is addModifier mappable? Do I have to explicitly convert geometry to array of does it map directly to it?
So to be honest, I spent some minutes playing with the code and actually LEARNED lots of things myself. Then I posted so other people can learn what I learned.
Once again, sorry if I sounded like "Know It All", I wasn't my intention to sound like I know better...
Peace! :beer:
Bobo
CGTalk Moderation
01-18-2006, 01:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.