Problem with Molecules Script

Hi guys,

I’m using blender to simulate chemical reactions, and I’m using the PDB2blend script to import the molecules as blender objects. Only problem is that the colour is weird. It’s not shaded and moves between being over (pure white) and under (pure black) exposed as I move the camera. If I switch the object to edit mode and back, it fixes itself, but I’ll eventually be working with molecules that use hundereds of atoms, and I’d really like to avoid putting them all into edit mode individually. I’m not too experienced with Python coding, so can anyone suggest why this might be happening?

I’ll put the code in over a few messages, if that’s okay…

Thanks a lot

Right, forget the code for the moment. If anyone has any ideas, that’d be great.

hi, strange indeed.
anyway I could not fix it, but I may have found a less intrusive workaround.
after trying it seems there’s a problem with this script & the set smooth function.
so here’s what i came up with.
download this script: http://farmerjoe.info/batchx/0.1/batchx.py
now this is a bit stupid, but it works.
select one object.
then in object mode go Select/Linked/Material
this selects all the objects with the same material.
then run the batch x script. don’t change any settings.
just press Make changes.
then the material will show correctly.
you will need to do this for each material, so depending on the pdb, this means to do this 4 or 5 times.
well, it’s better than 4 or 5 thousand times.

sorry for the dodgy workround, but it works & is reasonably quick.

That’s fantastic. You’ve just saved me a crazy amount of time. I’m currently trying to add the set smooth function to the PDB program. If I can get it to automatically do that for every material then the problem should be solved (there’s lot’s of other little tweaks I’d like to try too).

Oh, also, if I just select everything and choose “Set Smooth”, it does it all at once.

Thanks again for your help

hi theshambler,
great, good find on the just select all method.
the script is also useful in making batch changes to individual atoms/elements.
i have enjoyed this script for a long time, if you do fix it,
please post link here, that would be wonderful.
thanks.