View Full Version : example of SendModelingCommand()?
10-13-2005, 04:18 PM
I'm trying to figure out how to use the SendModelingCommand() function to create a simple COFFEE plugin, without much luck. Here's the body of my Execute() function:
SendModelingCommand(MCOMMAND_JOIN, doc, doc->GetActiveObject(), new(BaseContainer), MODIFY_ALL);
The plugin loads fine, but I get the following error when I try to execute it:
(5) Incompatible values... NIL / OBJECT
Objects are definitely selected in the document when I try this.
Any idea what might be going on? Thanks.
10-13-2005, 06:40 PM
you don't need doc->GetActiveObject, just use "op" that's what the active object is. and make your variables/objects outside of the command, i.e. don't put new(BaseContainer) in the command. make a new basecontainer outside i.e.
then use that inside of your command.
for debugging in general it's always best to not concatenate stuff until you're sure it works.
10-14-2005, 01:05 AM
Hmm...op doesn't seem to be available as a variable. Maybe because it's a plugin file rather than a COFFEE expression? I've implemented the rest of your suggestion but the error message hasn't changed. Here's the latest:
var myob = doc->GetActiveObject();
var bc = new(BaseContainer);
SendModelingCommand(MCOMMAND_JOIN, doc, myob, bc, MODIFY_ALL);
10-14-2005, 05:38 PM
your execute should probably read
you should then check that op or if you keep it as is the myob exist i.e. if (!op) return; etc
10-14-2005, 05:52 PM
If I add the op parameter to Execute(), I just get a "too many parameters" error when C4D loads the plug-in...so I don't think that can be it.
And I agree that I should do some error-checking, but I thought I'd focus on getting the core code working first :-p.
Any other ideas? Is there any chance this has something to do with the fact that MCOMMAND_JOIN would need two or more objects to join?
10-14-2005, 05:52 PM
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-2015, Jelsoft Enterprises Ltd.