This section describes how to create a Workspace and Toolbars using Rhino 6.
-
Create a separate workspace called
FlowsfromTools > Options > Toolbars -
Next step is to add a new toolbar called
Sample Flowas shown below
Note: Our goal is to connect the Sample Flow toolbar with a plugin of the same name.
- Then several buttons are added to the
Sample Flowtoolbar. Here each button represents a particular step in the flow.
For a detailed description on how to create macros for toolbars go here.
Note: The goal is to connect each step in the Sample Flow toolbar with a command in the plugin with the same name.
-
Open up the Flows folder in Visual Studio 2017.
-
Create new project in Visual Studio 2017
File > New > Project
-
Open the
SampleFlow.slnfile fromFlows/folder and rename the solution toFlows -
Go to the auto generated SampleFlow Visual C++ project and in the
stdafx.hfile, uncomment line 19#define RHINO_SDK_MFC. We need to uncomment this line as we would be using the MFC UI functionality.Note: Rhino 6 is almost MFC free except for the RhinoUI library which requires MFC as the Rhino Application is based on MFC
-
Go to file
SampleFlowPlugIn.cppand comment the line 46 so that the plugin compiles. Note that in general delete this line after filling in the appropriate information asked for. -
In Visual Studio 2017 go to
Project > Propertiesand then inC/C++ > Languagechange theC++ Language StandardtoISO C++14Standard (/std:c++14)and apply
Followed by build, this should compile the SampleFlow Rhino plugin project successfully.
-
In the next step go to the
Flows.ruiworkspace and open theWorkspace Editorand go to theMenus, then add the Menu and Menu-Item. -
To connect the menu item
Sample Flowto the plugin we use theWorkspace Editorin Rhino to create the corresponding C++ code.
- Then transfer the code to the SampleFlow plugin project into the following files :
FlowsRuiOnUpdateMenuItems.h, FlowsRuiOnUpdateMenuItems.cpp
#include "stdafx.h"
#include "FlowsRuiOnUpdateMenuItems.h"
#include "SampleFlowPlugIn.h"
CFlowsRuiOnUpdateMenuItems::CFlowsRuiOnUpdateMenuItems()
{
// Register OnUpdateMenuItem callback for this item
RegisterMenuItem(CSampleFlowPlugIn::m_idFile, CSampleFlowPlugIn::m_idMenuFlows, CSampleFlowPlugIn::m_idMenuItemSampleFlow);
}
void CFlowsRuiOnUpdateMenuItems::OnUpdateMenuItem(CRuiUpdateUi& cmdui)
{
// Enable menu item
if (CSampleFlowPlugIn::m_idMenuItemSampleFlow == cmdui.MenuItemUUID())
{
cmdui.Enable(true);
}
}
and the following static const variables are added to SampleFlowPlugIn.cpp
const UUID CSampleFlowPlugIn::m_idFile = { 0x6fbd18ca, 0xbdce, 0x44ae, { 0xba, 0x8f, 0x3c, 0x2c, 0x46, 0x3e, 0x52, 0xf9 } };
const UUID CSampleFlowPlugIn::m_idMenuFlows = { 0x130a9a5b, 0x5620, 0x4588, { 0x96, 0x41, 0x13, 0xd6, 0x7d, 0x4a, 0x19, 0x07 } };
const UUID CSampleFlowPlugIn::m_idMenuItemSampleFlow = { 0x7648b550, 0xb008, 0x42ab, { 0xb2, 0xb3, 0xf1, 0xb8, 0xf4, 0xac, 0xe5, 0x97 } };Now we would like to connect the Menu-item Sample Flow with the corresponding Sample Flow toolbar.
- First we open the
Workspace Editorfor theFlows.ruiand then gotoMenus. - Click on
Flows > Sample Flow > Item Properties
-
After this in the
Commandsection ofItem PropertiesforSample Flowcall the correct commands such that the Toolbar pops up.
TODO
The next step would be to connect the Simple Flow toolbar with the plugin with the same name.
Create and Deploy Toolbars
In this section we will describe the steps to programmatically connect Start Flow button in the Sample Flow Toolbar to the Sample Flow plugin in Rhino. The design is based on the Command pattern.
-
For the
Start Flowbutton we create a corresponding commandcmdStartFlow.cppin theFlows.sln. -
For the
Start Flowbutton we create a new Viewport for ourSample Flowplugin. This is done by using the Command Pattern and creating a separate class calledCSampleFlowViewReceiversuch that from the classCCommandStartFlowwe invoke theactionmethod on aCSampleFlowViewReceiverobject. -
The next step then is to connect the
Start Flowcommand in theSample Flowplugin to theStart Flowbutton






