View Full Version : Script request: repeat last command
MrBraun 09-11-2008, 09:39 AM Hello to all,
is possible by script to repeat last command?
I know that have a toolbar where cinema4D store the last command used, but what i want are, for example, one script that repeat the last command wiht the setted parameters! :)
For example, i select a polygon (or a serie of polygons), make a extrusion with offset=3cm.
Whith the script i whant to select anoter polygon and have a same extrusion!
This for all cinema4D tools, except for the move, scale, rotate!
Tnx in advance for the reply! :)
|
|
tcastudios
09-11-2008, 10:04 AM
The last setting of a tool is kept. Just click "Apply", (instead of dragging the
tool in the viewport)
Cheers
Lennart
MrBraun
09-11-2008, 10:19 AM
Tnx for the answer Lennart: yes i know this, but i whant to have a shortcut for apply directely! :)
This is why i whant this type of script! :)
tcastudios
09-11-2008, 11:01 AM
Ah.
This should do it far a Extrude tool. For other tools see the CommandManager for ID's
Cheers
Lennart
var prevtool = doc->GetActiveTool()->GetType(); // Get the Current Tool
CallCommand(1011183); // Call Extrude tool
EventAdd();
var tool = doc->GetActiveTool(); // Get the Tool
var ext = tool#MDATA_EXTRUDE_OFFSET; // Get the extrudeparameter of the Tool(If changed in AM)
var bc = tool->GetContainer(); // Get the Tool Container
bc->SetData(MDATA_EXTRUDE_OFFSET, ext);// Set the extrude value into the container (If changed in AM)
SendModelingCommand(ID_MODELING_EXTRUDE_TOOL, doc, op, bc, MODIFY_POLYGONSELECTION);// Do it!
EventAdd();
CallCommand(prevtool); // Get the "Current"tool back!
MrBraun
09-11-2008, 11:06 AM
heheheh! Great and fast Lennard! :bowdown:
This is for extruding: il possible to make a general script for all tools? :blush:
Tnx in advance!
tcastudios
09-11-2008, 11:14 AM
Try this then:) (For polygon selections, as of now)
var toolid = doc->GetActiveTool()->GetType(); // Get the Current Tool ID
var tool = doc->GetActiveTool(); // Get the Tool
var bc = tool->GetContainer(); // Get the Tool Container
SendModelingCommand(toolid, doc, op, bc, MODIFY_POLYGONSELECTION);// Do it!
Cheers
Lennart
MrBraun
09-11-2008, 01:05 PM
Tnx Lennart! :beer:
:bowdown:
CGTalk Moderation
09-11-2008, 01:05 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-2012, Jelsoft Enterprises Ltd.