Background Image Script?

 From:  Michael Gibson
6162.30 In reply to 6162.29 
Hi FDP,

> I think the problem is with using the "factory.setInput( 0, obj );" where "obj" is an object
> selected by being unnamed. Here's the snippet:

From my first quick look, it looks like you need to make an "object list" to put into the factory's input index 0, not just an object.

Someday I'd like to tune this up so that the factory system could take either a single object or an object list in that slot but right now it usually only expects to see object lists there for factories that can take more than one object for their operations.

So try something like this - above your function SetObjectNames put in this function:

code:
function WrapWithObjectList( obj )
{
	// Create an object list and fill it with the given object. Some things require an object
	// list for input and can't handle a single object instead right now.
	var list = moi.geometryDatabase.createObjectList();
	list.addObject( obj );
	return list;
}


And then inside your function change:
code:
factory.setInput( 0, obj );


to instead be:

code:
factory.setInput( 0, WrapWithObjectList(obj) );


At some point I also expect to make some more friendly direct calls for things like copying and transforming objects and making lines and things like that, rather than only having the factory type methods... The factory mechanism works well for interactive commands since you can hook things like a pointpicker into a factory input and then that drives updates to that point value, but it's not very convenient when you just want to do a simple transform like you're doing here.

Let me know if you're still running into problems after that change and I'll take a close look.

- Michael