Issue with scripting and an object's 'locked' property

 From:  Michael Gibson
6317.4 In reply to 6317.1 
Hi Jeff, so when you run a factory, it's more like the objects you put into it are deleted and new objects are created, this happens even for things like transformations.

In your script here, the objects you've got in the 'sds' variable are not in the geometry database anymore at the time that you're trying to lock them. They're removed from the geometry database during the call to factory.commit(), and they're only still around at all at that point because the script is referencing them.

The objects that you want to lock are the newly created objects that are generated by the factory.

There is a bit of a trick for getting the newly created objects in a script, because a factory is basically reset to a clean state after you've called .commit() on it.

So try this - before calling commit do this:

factory.update();
var sds2 = factory.getCreatedObjects();


Do that right before you call .commit() and then in sds2 you'll have an object list of the output from that factory, those are the ones that you want to manipulate by setting locked or whatever on them.

Let me know if you are still stuck after that.

- Michael