Change all objects to render 'flat'

Change all objects to render 'flat'

Hi,

I'm trying to find an easy way to fix a problem with importing: DXF objects are by default imported with their shading set to "constraint", but I would prefer them set to "flat" (generally my models are flat-sided). To change this by hand can take a long time if there are many objects, so I wondered could anyone help me make a simple script to do this automatically?

Thank you.
 
Hi,
just go through the scenegraph and set the normalType parameter of all polygon objects to 0.

Code:
obj.setParameter("normalType",0);

ROI said:
...or is there a way to change the default for DXF imports?

Sorry, not via script.

Bye,
Martin
 
Martin said:
Hi,
just go through the scenegraph and set the normalType parameter of all polygon objects to 0

Ahh, Martin - you make it sound so easy! I think I understand what you mean, but unfortunately I don't know how to write any javascript to make it happen. I could manually modify the "normalType" tags in the .jas file using a text editor, but I'm sure there's a better (and safer) way.

Sorry to take up your time to answer newbie questions... when you could be working on making Cheetah even better. Thank you anyway.
 
Hi,
oh please don't mess up with the .jas files directly. You can also set the flat shading in Cheetah3D. Just use the "Smooth" property of the polygon object to "flat".

I've written the script for your. Just copy it to the "Scripts/Macro" folder and restart Cheetah3D.
To call the script use the menu command "Tools->Scripts->Macro->SetShadingFlat.js"

Bye,
Martin
 

Attachments

  • SetShadingFlat.js.zip
    571 bytes · Views: 734
Back
Top