Rhino C++ API
8.13
|
#include <rhinoSdkGet.h>
Public Types | |
enum | result { no_result = 0, cancel = 1, nothing = 2, option, number, color, undo, miss, point, point2d, line2d, rect2d, object, string, winmsg, timeout, circle, plane, cylinder, sphere, angle, distance, direction, frame, number_preview, point_preview, user1 = 0xFFFFFFFF, user2 = 0xFFFFFFFE, user3 = 0xFFFFFFFD, user4 = 0xFFFFFFFC, user5 = 0xFFFFFFFB, exit_rhino = 0x0FFFFFFF } |
enum | TYPE { get_string = 1, get_point = 2, get_object = 3, get_meshes = 4, get_option = 5, get_number = 6, get_color = 7, force_32bit_enum = 0xFFFFFFFF } |
Public Member Functions | |
CRhinoGet (TYPE) | |
CRhinoGet (TYPE, const CRhinoGet &) | |
virtual | ~CRhinoGet () |
void | AcceptColor (BOOL32 b=true) |
bool | AcceptCustomWindowsMessage (UINT winmsg_id) |
void | AcceptNothing (BOOL32 b=true) |
void | AcceptNumber (bool b=true, bool bAcceptZero=true) |
void | AcceptPoint (BOOL32 b=true) |
void | AcceptString (BOOL32 b=true) |
void | AcceptUndo (BOOL32 b=true) |
call to allow user undo previous selection. More... | |
int | AddCommandOption (CRhinoCommandOptionName option_name, CRhinoCommandOptionValue option_value=CRhinoCommandOptionValue(nullptr, nullptr), BOOL32 bHiddenOption=false) |
int | AddCommandOption (CRhinoCommandOptionName option_name, double number_value) |
int | AddCommandOption (CRhinoCommandOptionName option_name, int number_value) |
int | AddCommandOptionColor (CRhinoCommandOptionName option_name, ON_Color *color_value, const wchar_t *option_prompt=nullptr) |
int | AddCommandOptionInteger (CRhinoCommandOptionName option_name, int *integer_value, const wchar_t *option_prompt=nullptr, double lower_limit=ON_UNSET_VALUE, double upper_limit=ON_UNSET_VALUE) |
int | AddCommandOptionList (CRhinoCommandOptionName option_name, const ON_SimpleArray< CRhinoCommandOptionValue > &list_values, int list_current_index) |
int | AddCommandOptionList (CRhinoCommandOptionName option_name, int list_current_index, CRhinoCommandOptionValue list0_value=CRhinoCommandOptionValue(nullptr, nullptr), CRhinoCommandOptionValue list1_value=CRhinoCommandOptionValue(nullptr, nullptr), CRhinoCommandOptionValue list2_value=CRhinoCommandOptionValue(nullptr, nullptr), CRhinoCommandOptionValue list3_value=CRhinoCommandOptionValue(nullptr, nullptr), CRhinoCommandOptionValue list4_value=CRhinoCommandOptionValue(nullptr, nullptr), CRhinoCommandOptionValue list5_value=CRhinoCommandOptionValue(nullptr, nullptr), CRhinoCommandOptionValue list6_value=CRhinoCommandOptionValue(nullptr, nullptr), CRhinoCommandOptionValue list7_value=CRhinoCommandOptionValue(nullptr, nullptr), CRhinoCommandOptionValue list8_value=CRhinoCommandOptionValue(nullptr, nullptr), CRhinoCommandOptionValue list9_value=CRhinoCommandOptionValue(nullptr, nullptr)) |
int | AddCommandOptionList (CRhinoCommandOptionName option_name, int list_values_count, const CRhinoCommandOptionValue *list_values, int list_current_index) |
int | AddCommandOptionNumber (CRhinoCommandOptionName option_name, double *number_value, const wchar_t *option_prompt=nullptr, BOOL32 bIntegerValue=false, double lower_limit=ON_UNSET_VALUE, double upper_limit=ON_UNSET_VALUE, int number_format=0) |
int | AddCommandOptionToggle (CRhinoCommandOptionName option_name, CRhinoCommandOptionValue option_off_value, CRhinoCommandOptionValue option_on_value, bool bToggleState, bool *bCurrentToggleState=nullptr) |
int | AddCommandOptionToggle (CRhinoCommandOptionName option_name, CRhinoCommandOptionValue option_off_value, CRhinoCommandOptionValue option_on_value, BOOL32 bToggleState, BOOL32 *bCurrentToggleState=nullptr) |
void | AddHiddenCommandOptionAlias (int option_index, const wchar_t *alias1, const wchar_t *alias2=nullptr, const wchar_t *alias3=nullptr, const wchar_t *alias4=nullptr) |
low level tool More... | |
void | ClearCommandOptions () |
Clear all command line options. More... | |
void | ClearDefault () |
ON_Color | Color () const |
Used to get color if Get*() returns CRhinoGet::color. More... | |
CRhinoCommand::result | CommandResult () const |
const ON_Color & | DefaultColor () const |
double | DefaultNumber () const |
unsigned int | DocumentRuntimeSerialNumber () const |
void | EnableTransparentCommands (BOOL32 bEnableTransparentCommands) |
BOOL32 | GotDefault () const |
bool | In2dGet () const |
these functions are used by CRhinoView::OnMouseDown/Move/Up - pretend they don't exist More... | |
bool | IsGetColor () const |
bool | IsGetMeshes () const |
bool | IsGetNumber () const |
bool | IsGetObject () const |
bool | IsGetOption () const |
bool | IsGetPoint () const |
bool | IsGetString () const |
RH_LINE | Line2d () const |
double | Number () const |
const CRhinoCommandOption * | Option () const |
int | OptionCount () const |
Get the number of available command line options. This information is useful when command flow depends on the existence of command line options. More... | |
int | OptionCurrentListOptionIndex () const |
int | OptionIndex () const |
CRhinoCommandOption::COMMAND_OPTION_TYPE | OptionType () const |
ON_4iRect | PickRect () const |
ON_3dPoint | Point () const |
Used to get point if Get*() returns CRhinoGet::point. More... | |
ON_2iPoint | Point2d () const |
ON_4iRect | Rectangle2d () const |
CRhinoGet::result | Result () const |
returns result of the Get*() call More... | |
unsigned int | SerialNumber () const |
low level tool used to identify the get More... | |
void | SetCommandPrompt (const wchar_t *prompt) |
void | SetCommandPromptDefault (const wchar_t *default_value) |
void | SetDefaultColor (ON_Color default_color) |
void | SetDefaultColor (ON_Color default_color, bool bUseAlpha) |
void | SetDefaultInteger (int default_integer) |
void | SetDefaultNumber (double default_number, const wchar_t *format=nullptr) |
void | SetDefaultPoint (ON_3dPoint default_point) |
void | SetDefaultString (const wchar_t *default_string) |
void | SetDocument (unsigned int rhino_doc_sn) |
void | SetOptionVaries (int option_index, bool bVaries) |
Set option that uses "option_name=value" format to show the value as "Varies". More... | |
void | SetVector (const ON_3dVector &v) |
void | SetWaitDuration (double seconds) |
const wchar_t * | String () const |
TYPE | Type () const |
ON_3dVector | Vector () const |
CRhinoView * | View () const |
MSG | WindowsMessage () const |
ON_3dPoint | WorldPoint1 () const |
ON_3dPoint | WorldPoint2 () const |
Static Public Member Functions | |
static BOOL32 | IsValidOptionName (const wchar_t *option_name) |
static BOOL32 | IsValidOptionValueName (const wchar_t *option_value) |
static void | PostCustomWindowsMessage (UINT Msg, WPARAM wParam, LPARAM lParam) |
Public Attributes | |
class CRhGetSdkExtension * | m__rhino_get_sdk_extension |
Protected Member Functions | |
CRhinoGet::result | AutoProcessOption () |
const CRhinoCommandOption * | CommandOptionAtIndex (int option_index) const |
int | CommandOptionCount () const |
see source for comments More... | |
virtual ON_Plane | GetCS (bool bWorldCoordinates, bool bRelativeCoordinates) |
Helper used by IsAcceptableInput when parsing points. More... | |
CRhinoGet::result | IsAcceptableInput (const class CRhEventToken &, BOOL32 bAcceptNumber, BOOL32 *bUpdatedOptionValue, CRhinoHistory *history) |
CRhinoGet & | operator= (const CRhinoGet &) |
void | PreGet () |
void | RemoveCommandOptions (int option_index) |
see source for comments More... | |
virtual void | SetCommandWndPrompt () const |
void | SetOptionAccelerators () |
Base class for CRhinoGetObject, CRhinoGetPoint, CRhinoGetSphere, etc.
You will never directly create a CRhinoGet but you will use its member functions after calling CRhinoGetObject::GetObject(), CRhinoGetPoint::GetPoint(), and so on.
Provides tools to set command prompt, set command options, and specify if the "get" can optionally accept numbers, nothing (pressing enter), and undo.
enum CRhinoGet::result |
Possible results from CRhinoGetObject::GetObject(), CRhinoGetPoint::GetPoint(), etc.
Enumerator | |
---|---|
no_result | |
cancel | user wants to cancel current command |
nothing | user pressed enter - typically used to accpt defaults |
option | user specified an option - call Option() to get option index |
number | user entered a real number - call Number() to get value |
color | user entered a color - call Color() to get value |
undo | user pressed undo |
miss | user clicked and missed |
point | user picked 3d point - call Point() to get 3d point |
point2d | user picked 2d window point in CRhinoGetPoint::Get2dPoint() call Point2d() to get the point and View() to get the view. |
line2d | user picked a 2d line in CRhinoGetPoint::Get2dLine() call Line2d() to get the line and View() to get the view. |
rect2d | user picked a 2d rectangle in CRhinoGetPoint::Get2dRectangle() call Rectangle2d() to get the rectangle and View() to get the view. |
object | user selected an object - call Object() to get object |
string | user typed a string - call String() to get the string |
winmsg | Windows posted a message id that was in the list passed to CRhinoGet::AcceptWindowsMessage(). Call CRhinoGet::WndMsg() to get the message. |
timeout | The getter waited for the amount of time specified in CRhinoGet::SetWaitDuration() and then gave up. |
circle | call CRhinoGetCircle::GetCircle() to get the circle higher level stuff |
plane | call CRhinoGetPlane::GetPlane() to get the plane |
cylinder | call CRhinoGetCylinder::GetCylinder() to get the cylinder |
sphere | call CRhinoGetSphere::GetSphere() to get the sphere |
angle | call CRhinoGetAngle::Angle() to get the angle in radians (CRhinoGetAngle() returns this for typed number, too) |
distance | call CRhinoGetDistance::Distance() to get the distance value |
direction | call CRhinoGetDirection::Direction() to get the direction vector |
frame | call CRhinoGetFrame::Frame() to get the frame that was picked |
number_preview | internal, user is typing a number - call Number() to get value |
point_preview | internal, user is typing a 3d point - call Point() to get 3d point |
user1 | |
user2 | |
user3 | |
user4 | |
user5 | |
exit_rhino | stop now, do not cleanup, just return ASAP. |
enum CRhinoGet::TYPE |
CRhinoGet::CRhinoGet | ( | TYPE | ) |
|
virtual |
void CRhinoGet::AcceptColor | ( | BOOL32 | b = true | ) |
If you want to allow the user to be able to type in a color r,g,b or name during CRhinoGetPoint::GetPoint(), CRhinoGetObject::GetObject(), etc., then call AcceptNumber() before calling GetPoint()/GetObject(). If the user chooses to type in a color, then the result code CRhinoGet::color is returned and you can use CRhinoGet::Color() to get the value of the color. If the get accepts points, then the user will not be able to type in r,g,b colors but will be able to type color names.
bool CRhinoGet::AcceptCustomWindowsMessage | ( | UINT | winmsg_id | ) |
Description: Expert user tool that allows GetPoint, GetObject, GetString, etc., to return if a registered Windows message is posted by the static function CRhinoGet::PostCustomWindowsMessage Parameters: winmsg_id - [in] Windows message id in the range 0xC000 throught 0xFFFF. Returns: true if the message id is in the permitted range. Remarks: Study the Windows documentation for RegisterWindowMessage. AcceptWindowsMessage is intended to be used by experts. Support is not available. If Windows posts a message with matching id while GetPoint, etc., is waiting for input, the the getter returns CRhinoGet::winmsg.
Call CRhinoGet::WndMsg() to get the message.
void CRhinoGet::AcceptNothing | ( | BOOL32 | b = true | ) |
If you want to allow the user to be able to press enter in order to skip selecting a something in CRhinoGetPoint::GetPoint(), CRhinoGetObject::GetObject(), etc., then call AcceptNothing() before calling GetPoint()/GetObject().
void CRhinoGet::AcceptNumber | ( | bool | b = true , |
bool | bAcceptZero = true |
||
) |
If you want to allow the user to be able to type in a number during CRhinoGetPoint::GetPoint(), CRhinoGetObject::GetObject(), etc., then call AcceptNumber() before calling GetPoint()/GetObject(). If the user chooses to type in a number, then the result code CRhinoGet::number is returned and you can use CRhinoGet::Number() to get the value of the number. If you are using GetPoint and you want "0" to return (0,0,0) instead of the number zero, then set bAcceptZero = false.
void CRhinoGet::AcceptPoint | ( | BOOL32 | b = true | ) |
If you want to allow the user to be able to type in a point then call AcceptNumber() before calling GetPoint()/GetObject(). If the user chooses to type in a number, then the result code CRhinoGet::point is returned and you can use CRhinoGet::Point() to get the value of the point.
void CRhinoGet::AcceptString | ( | BOOL32 | b = true | ) |
If you want to allow the user to be able to type in a string during CRhinoGetPoint::GetPoint(), CRhinoGetObject::GetObject(), etc., then call AcceptString() before calling GetPoint()/GetObject(). If the user chooses to type in a string, then the result code CRhinoGet::string is returned and you can use CRhinoGet::String() to get the value of the string.
void CRhinoGet::AcceptUndo | ( | BOOL32 | b = true | ) |
call to allow user undo previous selection.
If you want to allow the user to have an undo option in CRhinoGetPoint::GetPoint(), CRhinoGetObject::GetObject(), etc., then call AcceptUndo() before calling GetPoint()/GetObject().
int CRhinoGet::AddCommandOption | ( | CRhinoCommandOptionName | option_name, |
CRhinoCommandOptionValue | option_value = CRhinoCommandOptionValue(nullptr, nullptr) , |
||
BOOL32 | bHiddenOption = false |
||
) |
Description: Add a command line option. If you are adding an option to get a number, string, toggle, or list value, then use the tools listed in the see also section. Parameters: option_name - [in] option_value - [in] optional description of current value (not automaically localized - use RHSTR() when appropriate.) bHiddenOption - [in] if true, the option is not displayed on the command line and the full option name must be typed in order to activate the option.
Returns: option index value (>0) or 0 if option cannot be added. Example: CRhinoGetPoint gp; int grain_option_index = gp.AddCommandOption( RhLocalizeCommandOptionName( L"Grain", 43545), RhLocalizeCommandOptionValue( L"rice", 43546) ); int fruit_option_index = gp.AddCommandOption( RhLocalizeCommandOptionName( L"Fruit", 43547), RhLocalizeCommandOptionValue( L"banana", 43548) ); gp.GetPoint(); if ( gp.Result() == CRhinoGet::option ) { CRhinoCommandOption* opt = gp.Option(); if ( opt->m_option_index == grain_option_index ) { ... ask about grains } else if ( opt->m_option_index == grain_option_index ) { ... ask about fruits } }
int CRhinoGet::AddCommandOption | ( | CRhinoCommandOptionName | option_name, |
double | number_value | ||
) |
Description: Add a simple command line option with a number as a value. Parameters: option_name - [in] english option description automatic localization uses command option string table number_value - [in] current value Returns: option index value (>0) or 0 if option cannot be added. Remarks: In most cases it is easier to use AddCommandOptionNumber(). Example: ON_3dPoint center; static radius r = 1.0; for(;;) { CRhinoGetPoint gp; gp.SetCommandPrompt(RhLocalizeString( L"Center point", 43549)); int radius_option_index = gp.AddCommandOption( RhLocalizeCommandOptionName( L"Radius", 43550), r ); gp.GetPoint(); if ( gp.Result() == CRhinoGet::option ) { CRhinoCommandOption* opt = gp.Option(); if ( opt->m_option_index == radius_option_index ) { /user typed "Radius" - manually prompt for new number CRhinoGetNumber gn; gn.SetCommandPrompt(RhLocalizeString( "Radius", 56330)); gn.SetDefault(r); gn.GetNumber(); if ( gn.Result() == CRhinoGet::number ) r = gn.Number(); } continue; } if ( gp.Result() == CRhinoGet::point ) { center = gp.Point(); break; } }
int CRhinoGet::AddCommandOption | ( | CRhinoCommandOptionName | option_name, |
int | number_value | ||
) |
int CRhinoGet::AddCommandOptionColor | ( | CRhinoCommandOptionName | option_name, |
ON_Color * | color_value, | ||
const wchar_t * | option_prompt = nullptr |
||
) |
Description: Add a command line option to get colors and automatically save the value. Parameters: option_name - [in] english option description Automatic localization uses command option string table. color_value - [in/out] pointer to current value of the number. If the user changes the integer's value, the value of integer_value is changed but the current call to GetPoint/GetString/... does not return. option_prompt - [in] option prompt shown if the user selects this option. If NULL, then option_name.m_local_option_name is used as the get number prompt.
Example: CRhinoGetPoint gp; ... ON_Color favorite_color(0,0,0); gp.AddCommandOptionColor( RhLocalizeCommandOptionName( L"FavoriteColor", 43556), &favorite_color, RhLocalizeString( L"What is your favorite color?", 43557) ); ... Returns: option index value (>0) or 0 if option cannot be added.
int CRhinoGet::AddCommandOptionInteger | ( | CRhinoCommandOptionName | option_name, |
int * | integer_value, | ||
const wchar_t * | option_prompt = nullptr , |
||
double | lower_limit = ON_UNSET_VALUE , |
||
double | upper_limit = ON_UNSET_VALUE |
||
) |
Description: Add a command line option to get integers and automatically save the value. Parameters: option_name - [in] english option description Automatic localization uses command option string table. integer_value - [in/out] pointer to current value of the number. If the user changes the integer's value, the value of integer_value is changed but the current call to GetPoint/GetString/... does not return. option_prompt - [in] option prompt shown if the user selects this option. If NULL, then option_name.m_local_option_name is used as the get number prompt. lower_limit - [in] (default=ON_UNSET_VALUE which means no lower limit) if set, the returned integer must be >= lower_limit upper_limit - [in] (default=ON_UNSET_VALUE which means no upper limit) if set, the returned integer must be <= upper_limit Returns: option index value (>0) or 0 if option cannot be added.
Example: CRhinoGetPoint gp; ... int favorite_integer = 8; gp.AddCommandOptionInteger( RhLocalizeCommandOptionName( L"FavoriteInteger", 43554), &favorite_integer, RhLocalizeString( L"What is your favorite integer?", 43555) ); ... Remarks: If you need to explicitly react to a changed number, then use override of CRhinoGet::AddCommandOption that takes a number as an option value. See the CRhinoGet::AddCommandOption examples.
int CRhinoGet::AddCommandOptionList | ( | CRhinoCommandOptionName | option_name, |
const ON_SimpleArray< CRhinoCommandOptionValue > & | list_values, | ||
int | list_current_index | ||
) |
int CRhinoGet::AddCommandOptionList | ( | CRhinoCommandOptionName | option_name, |
int | list_current_index, | ||
CRhinoCommandOptionValue | list0_value = CRhinoCommandOptionValue(nullptr, nullptr) , |
||
CRhinoCommandOptionValue | list1_value = CRhinoCommandOptionValue(nullptr, nullptr) , |
||
CRhinoCommandOptionValue | list2_value = CRhinoCommandOptionValue(nullptr, nullptr) , |
||
CRhinoCommandOptionValue | list3_value = CRhinoCommandOptionValue(nullptr, nullptr) , |
||
CRhinoCommandOptionValue | list4_value = CRhinoCommandOptionValue(nullptr, nullptr) , |
||
CRhinoCommandOptionValue | list5_value = CRhinoCommandOptionValue(nullptr, nullptr) , |
||
CRhinoCommandOptionValue | list6_value = CRhinoCommandOptionValue(nullptr, nullptr) , |
||
CRhinoCommandOptionValue | list7_value = CRhinoCommandOptionValue(nullptr, nullptr) , |
||
CRhinoCommandOptionValue | list8_value = CRhinoCommandOptionValue(nullptr, nullptr) , |
||
CRhinoCommandOptionValue | list9_value = CRhinoCommandOptionValue(nullptr, nullptr) |
||
) |
Description: Add a command line list option. This version of AddCommandOptionList simply makes the appropriate array out of list0_value, ..., list9_value and Parameters: option_name - [in] english option description automatic localization uses command option string table list_current_index - [in] zero based index of current option All the listN_value parameters for N <= list_current_index must be provided. list0_value - [in] NULL or value for list_values[0] list1_value - [in] NULL or value for list_values[1] list2_value - [in] NULL or value for list_values[2] list3_value - [in] NULL or value for list_values[3] list4_value - [in] NULL or value for list_values[4] list5_value - [in] NULL or value for list_values[5] list6_value - [in] NULL or value for list_values[6] list7_value - [in] NULL or value for list_values[7] list8_value - [in] NULL or value for list_values[8] list9_value - [in] NULL or value for list_values[9] Returns: option index value (>0) or 0 if option cannot be added. Example: ON_3dPoint center; int fruit_index = 0; const wchar_t* fruits[3] = {L"banana",L"apple",L"orange"}; for(;;) { CRhinoGetPoint gp; gp.SetCommandPrompt(RhLocalizeString( L"Center point", 43567)); int fruit_option_index = gp.AddCommandOptionList( RhLocalizeCommandOptionName( L"Fruit", 43568), fruit_index, RhLocalizeCommandOptionValue( L"banana", 43569), RhLocalizeCommandOptionValue( L"apple", 43570), RhLocalizeCommandOptionValue( L"orange", 43571) ); gp.GetPoint(); if ( gp.Result() == CRhinoGet::option ) { CRhinoCommandOption* opt = gp.Option(); if ( opt->m_option_index == fruit_option_index ) { .. get new fruit from list } continue; } if ( gp.Result() == CRhinoGet::point ) { center = gp.Point(); break; } }
int CRhinoGet::AddCommandOptionList | ( | CRhinoCommandOptionName | option_name, |
int | list_values_count, | ||
const CRhinoCommandOptionValue * | list_values, | ||
int | list_current_index | ||
) |
Description: Add a command line list option Parameters: option_name - [in] english option description automatic localization uses command option string table list_values_count - [in] number of values option_values[] array list_values - [in] array of english option values automatic localization uses command option string table list_current_index - [in] zero based index of current option Returns: option index value (>0) or 0 if option cannot be added. Example: ON_3dPoint center; int fruit_index = 0; CRhinoCommandOptionValue fruits[3]; fruits[0] = RhLocalizeCommandOptionValue( L"banana", 43562); fruits[1] = RhLocalizeCommandOptionValue( L"apple", 43563); fruits[2] = RhLocalizeCommandOptionValue( L"orange", 43564); for(;;) { CRhinoGetPoint gp; gp.SetCommandPrompt(RhLocalizeString( L"Center point", 43565)); int fruit_option_index = gp.AddCommandOptionList( RhLocalizeCommandOptionName( L"Fruit", 43566), 3, fruits, fruit_index ); gp.GetPoint(); if ( gp.Result() == CRhinoGet::option ) { const CRhinoCommandOption* opt = gp.Option(); if ( opt->m_option_index == fruit_option_index ) { / .. get new fruit from list fruit_index = opt->m_list_option_current; } continue; } if ( gp.Result() == CRhinoGet::point ) { center = gp.Point(); break; } }
int CRhinoGet::AddCommandOptionNumber | ( | CRhinoCommandOptionName | option_name, |
double * | number_value, | ||
const wchar_t * | option_prompt = nullptr , |
||
BOOL32 | bIntegerValue = false , |
||
double | lower_limit = ON_UNSET_VALUE , |
||
double | upper_limit = ON_UNSET_VALUE , |
||
int | number_format = 0 |
||
) |
Description: Add a command line option to get numbers and automatically save the value. Parameters: option_name - [in] english option description Automatic localization uses command option string table. number_value - [in/out] pointer to current value of the number. If the user changes the nubmer's value, the value of number_value is changed but the current call to GetPoint/GetString/... does not return. option_prompt - [in] option prompt shown if the user selects this option. If NULL, then option_name.m_local_option_name is used as the get number prompt. bIntegerValue - [in] (default=false) if true, number must be an integer lower_limit - [in] (default=ON_UNSET_VALUE which means no lower limit) if set, the returned number must be >= lower_limit upper_limit - [in] (default=ON_UNSET_VALUE which means no upper limit) if set, the returned number must be <= upper_limit number_format - [in] This controls how strings are parsed to get a number and how the number is displayed in the command prompt.
0 = general - RhinoParseNumber - decimal display 1 = distance - RhinoParseNumber - decimal display with doc units 2 = angle in degrees - RhinoParseAngleDegrees - decimal degrees display 3 = angle in radians - RhinoParseAngle - decimal radians display Returns: option index value (>0) or 0 if option cannot be added. Remarks: If you need to explicitly react to a changed number, then use override of CRhinoGet::AddCommandOption that takes a number as an option value. See the CRhinoGet::AddCommandOption examples. Example: ON_3dPoint center; static radius r = 1.0; double min_radius = 1.0e-12; for(;;) { CRhinoGetPoint gp; gp.SetCommandPrompt(RhLocalizeString( L"Center point", 43551)); int radius_option_index = gp.AddCommandOptionNumber( RhLocalizeCommandOptionName( L"Radius", 43552), &r, RhLocalizeString( L"New radius", 43553), false, min_radius ); gp.GetPoint(); if ( gp.Result() == CRhinoGet::point ) { center = gp.Point(); break; } if ( gp.Result() == CRhinoGet::option ) { const CRhinoCommandOption* opt = gp.Option(); if ( opt->m_option_index == radius_option_index ) { / r has been changed to a number >= min_radius. Do / any additional validation or changes here. } } if ( gp.Result() == CRhinoGet::cancel ) break; ///< user pressed ESCAPE to cancel get point ... }
int CRhinoGet::AddCommandOptionToggle | ( | CRhinoCommandOptionName | option_name, |
CRhinoCommandOptionValue | option_off_value, | ||
CRhinoCommandOptionValue | option_on_value, | ||
bool | bToggleState, | ||
bool * | bCurrentToggleState = nullptr |
||
) |
int CRhinoGet::AddCommandOptionToggle | ( | CRhinoCommandOptionName | option_name, |
CRhinoCommandOptionValue | option_off_value, | ||
CRhinoCommandOptionValue | option_on_value, | ||
BOOL32 | bToggleState, | ||
BOOL32 * | bCurrentToggleState = nullptr |
||
) |
Description: Add a command line option to toggle a setting. Parameters: option_name - [in] english option description automatic localization uses command option string table option_off_value - [in] english "off" value automatic localization uses command option string table option_on_value - [in] english "on" value automatic localization uses command option string table bToggleState - [in] current toggle state (true = on) pbCurrentState - [in/out] if not NULL, then the value of pbCurrentState is kept set to the current state. Returns: option index value (>0) or 0 if option cannot be added. Example: ON_3dPoint center; static bLights = true; for(;;) { CRhinoGetPoint gp; gp.SetCommandPrompt(RhLocalizeString( L"Center point", 43558)); int togglelights_option_index = gp.AddCommandOptionToggle( RhLocalizeCommandOptionName( L"Lights", 43559), RhLocalizeCommandOptionValue( L"Off", 43560), RhLocalizeCommandOptionValue( L"On", 43561), bLights, &bLights ); gp.GetPoint(); if ( gp.Result() == CRhinoGet::option ) { CRhinoCommandOption* opt = gp.Option(); if ( opt->m_option_index == togglelights_option_index ) { / opt->m_toggle_option_value = current state of toggle / because we passed &bLights as the last argument, bLights / is automatically set to opt->m_toggle_option_value. / Do whatever else needs to be done here. ... } continue; } if ( gp.Result() == CRhinoGet::point ) { center = gp.Point(); break; } }
void CRhinoGet::AddHiddenCommandOptionAlias | ( | int | option_index, |
const wchar_t * | alias1, | ||
const wchar_t * | alias2 = nullptr , |
||
const wchar_t * | alias3 = nullptr , |
||
const wchar_t * | alias4 = nullptr |
||
) |
low level tool
|
protected |
Helper for used by IsAcceptableInput for autoprocessing number/toggle/list command options
void CRhinoGet::ClearCommandOptions | ( | ) |
Clear all command line options.
clear all command options
void CRhinoGet::ClearDefault | ( | ) |
Description: Clears any defaults se using SetDefaultPoint, SetDefaultNumber, SetDefaultString, or SetCommandPromptDefault
ON_Color CRhinoGet::Color | ( | ) | const |
Used to get color if Get*() returns CRhinoGet::color.
|
protected |
|
protected |
see source for comments
CRhinoCommand::result CRhinoGet::CommandResult | ( | ) | const |
Description: Handy tool for getting command result value from getter results. Returns: @untitled table CRhinoCommand::cancel if CRhinoGet::Result() == CRhinoGet::cancel CRhinoCommand::exit_rhino if CRhinoGet::Result() == CRhinoGet::exit_rhino CRhinoCommand::success otherwise
const ON_Color& CRhinoGet::DefaultColor | ( | ) | const |
Returns: Get the default color value that will be returned if the user presses ENTER key during the get.
double CRhinoGet::DefaultNumber | ( | ) | const |
Returns: Get the default number value that will be returned if the user presses ENTER key during the get.
unsigned int CRhinoGet::DocumentRuntimeSerialNumber | ( | ) | const |
Returns; 0 or the specific document for this get. Remarks: If no document is specified and no event has happened in something specifically associated with a document, then 0 is returned.
void CRhinoGet::EnableTransparentCommands | ( | BOOL32 | bEnableTransparentCommands | ) |
STEP 2: specify types of keyboard input can be accepted Description: Control the availability of transparent commands during the get. Parameters: bEnableTransparentCommands - [in] If true, then transparent commands can be run during the get. If false, then transparent commands cannot be run during the get. Remarks: Some Rhino commands are "transparent" and can be run inside of other commands. Examples of transparent commands include the view manipulation commands like ZoomExtents, Top, etc., and the selection commands like SelAll, SelPoint, etc. By default transparent commands can be run during any get. If you want to disable this feature, then call EnableTransparentCommands(false) before calling GetString, GetPoint, GetObject, etc.
|
protectedvirtual |
Helper used by IsAcceptableInput when parsing points.
Reimplemented in CRhinoGetPoint.
BOOL32 CRhinoGet::GotDefault | ( | ) | const |
Returns: true if user pressed ENTER to accept a default point, number, or string set using SetDefaultPoint, SetDefaultNumber, or SetDefaultString.
bool CRhinoGet::In2dGet | ( | ) | const |
these functions are used by CRhinoView::OnMouseDown/Move/Up - pretend they don't exist
true if getting 2d point
|
protected |
Parameters: token - [in] event token to test bAcceptNumber - [in] if true, then a number is acceptable, even when m_bAcceptNumber is false. This happens with GetPoint ortho distance constraints and automatic number options. bUpdatedOptionValue - [out] if an option with a valid value is specified, then *bUpdatedOptionValue is set to true. history - [out] (can be NULL) updated as needed. returns CRhinoGet::no_result if token is not acceptable input. CRhinoGet::option and sets m_option_index if token is a valid option. Use CRhinoGet::Option() to get option index. CRhinoGet::number if user typed a number and a number is acceptable input. CRhinoGet::string if user typed a string and a string is acceptable input. CRhinoGet::undo if user typed ^Z or "Undo" and undo is an acceptable option.
bool CRhinoGet::IsGetColor | ( | ) | const |
Returns: true if the get is or will be a CRhinoGetString::GetColor()
bool CRhinoGet::IsGetMeshes | ( | ) | const |
Returns: true if the get is or will be getting meshes.
bool CRhinoGet::IsGetNumber | ( | ) | const |
Returns: true if the get is or will be a CRhinoGetString::GetNumber()
bool CRhinoGet::IsGetObject | ( | ) | const |
Returns: true if the get is or will be a CRhinoGetObject::GetObject()
bool CRhinoGet::IsGetOption | ( | ) | const |
Returns: true if the get is or will be a CRhinoGetString::GetOption()
bool CRhinoGet::IsGetPoint | ( | ) | const |
Returns: true if the get is or will be a CRhinoGetPoint::GetPoint()
bool CRhinoGet::IsGetString | ( | ) | const |
Returns: true if the get is or will be a CRhinoGetString::GetString()
|
static |
Description: Test a string to see if it can be used as an option name in any of the CRhinoGet::AddCommandOption...() functions. Returns: true if string can be used as an option name.
|
static |
Description: Test a string to see if it can be used as an option value in CRhinoGet::AddCommandOption, CRhinoGet::AddCommandOptionToggle, or CRhinoGet::AddCommandOptionList. Returns: true if string can be used as an option value.
RH_LINE CRhinoGet::Line2d | ( | ) | const |
Returns: Location in view window of 2d line selected in CRhinoGetPoint::Get2dLine(). (0,0) = upper left corner of window Remarks: Call CRhinoGet::View() to get the view window.
double CRhinoGet::Number | ( | ) | const |
Used to get number if CRhinoGetPoint::GetPoint(), CRhinoGetObject::GetObject(), etc., returns CRhinoGet::number.
const CRhinoCommandOption* CRhinoGet::Option | ( | ) | const |
Used to get option if CRhinoGetPoint::GetPoint(), CRhinoGetObject::GetObject(), etc., returns CRhinoGet::option.
int CRhinoGet::OptionCount | ( | ) | const |
Get the number of available command line options. This information is useful when command flow depends on the existence of command line options.
int CRhinoGet::OptionCurrentListOptionIndex | ( | ) | const |
int CRhinoGet::OptionIndex | ( | ) | const |
Returns: If this->Result() = CRhinoGet::option, this->Option() is not nullptr, and this->Option()->m_option_index is greater than 0,
then this->Option()->m_option_index is returned. Otherwise 0 is returned.
CRhinoCommandOption::COMMAND_OPTION_TYPE CRhinoGet::OptionType | ( | ) | const |
Returns: If this->Result() = CRhinoGet::option, this->Option() is not nullptr, and this->Option()->m_option_index is greater than zero, then this->Option()->m_type is returned. Otherwise CRhinoCommandOption::COMMAND_OPTION_TYPE::force_32bit_enum is returned.
ON_4iRect CRhinoGet::PickRect | ( | ) | const |
Returns: If the get was a GetObjects() and the mouse was used to select the objects, then the returned rect has left < right and top < bottom. This rect is the Windows GDI screen coordinates of the picking rectangle. View()->Viewport().GetPickXform( m_pick_rect, pick_xform ) will calculate the picking transformation that was used. In all other cases, left=right=top=bottom=0;
ON_3dPoint CRhinoGet::Point | ( | ) | const |
Used to get point if Get*() returns CRhinoGet::point.
ON_2iPoint CRhinoGet::Point2d | ( | ) | const |
Returns: Location in view of point in selected in CRhinoGetPoint::GetPoint() or CRhinoGetPoint::Get2dPoint(). (0,0) = upper left corner of window Remarks: Call CRhinoGet::View() to get the view window.
|
static |
Description: Posts a Windows message that can terminate a call tooGetPoint, GetObject, GetString, etc. Parameters: Msg - [in] Windows message id in the range 0xC000 throught 0xFFFF. wParam - [in] lParam - [in]
|
protected |
ON_4iRect CRhinoGet::Rectangle2d | ( | ) | const |
Returns: Location in view of 2d rectangle selected in CRhinoGetPoint::Get2dRectangle(). rect.left < rect.right and rect.top < rect.bottom (0,0) = upper left corner of window Remarks: Call CRhinoGet::View() to get the view window.
|
protected |
see source for comments
CRhinoGet::result CRhinoGet::Result | ( | ) | const |
returns result of the Get*() call
STEP N: Get options/numbers if user specified on of the alternate objects. Used to get result code returned by CRhinoGetPoint::GetPoint(), CRhinoGetObject::GetObject(), etc.
unsigned int CRhinoGet::SerialNumber | ( | ) | const |
low level tool used to identify the get
void CRhinoGet::SetCommandPrompt | ( | const wchar_t * | prompt | ) |
STEP 1: specify optional command prompt and command options Description: Set prompt message that appears in the command prompt window. Parameters: prompt - [in] command prompt message. Use the RHSTR macro if you want the message to be automatically localized. Example: CRhinoGetPoint gp; gp.SetCommandPrompt( RhLocalizeString( L"Center point", 43543) );
void CRhinoGet::SetCommandPromptDefault | ( | const wchar_t * | default_value | ) |
Description: Set message that describes what default value will be used if the user presses enter. This description appears in angle brackets <> in the command prompt window. You do not need to provide a default value description unless you explicitly enable AcceptNothing. Parameters: default_value - [in] description of default value. Example: ON_3dPoint default_center(2,3,4); CRhinoGetPoint gp; gp.SetCommandPrompt( RhLocalizeString( L"Center point", 43544) ); gp.SetCommandPromptDefault( L"(2,3,4)" ); gp.AcceptNothing(true); gp.GetPoint(); if ( gp.Result() == CRhinoGet::nothing ) point = default_center; Remarks: If you have a simple default point, number, or string, it is easier to use SetDefaultPoint, SetDefaultNumber, or SetDefaultString. SetCommandPromptDefault and AcceptNothing can be used for providing more advanced UI behavior.
|
protectedvirtual |
void CRhinoGet::SetDefaultColor | ( | ON_Color | default_color | ) |
Description: Set a color as default value that will be returned if the user presses ENTER key during the get. Parameters: default_color - [in] value for default color Remarks: Calling SetDefaultColor will automatically handle setting the command prompt default and reacting to the user pressing ENTER. If the user presses ENTER to accept the default color, CRhinoGet::color is returned and CRhinoGet::GotDefault() will return true. Calling SetDefaultColor will clear any previous calls to SetDefaultString or SetDefaultPoint.
void CRhinoGet::SetDefaultColor | ( | ON_Color | default_color, |
bool | bUseAlpha | ||
) |
Description: Set a color as default value that will be returned if the user presses ENTER key during the get. Parameters: default_color - [in] value for default color bUseAlpha - [in] set to true to use the alpha value Remarks: Calling SetDefaultColor will automatically handle setting the command prompt default and reacting to the user pressing ENTER. If the user presses ENTER to accept the default color, CRhinoGet::color is returned and CRhinoGet::GotDefault() will return true. Calling SetDefaultColor will clear any previous calls to SetDefaultString or SetDefaultPoint.
void CRhinoGet::SetDefaultInteger | ( | int | default_integer | ) |
Description: Set a number as default value that will be returned if the user presses ENTER key during the get. Parameters: default_integer - [in] value for default number Remarks: Calling SetDefaultInteger will automatically handle setting the command prompt default and reacting to the user pressing ENTER. If the user presses ENTER to accept the default integer, CRhinoGet::number is returned and CRhinoGet::GotDefault() will return true. Calling SetDefaultNumber will clear any previous calls to SetDefaultString or SetDefaultPoint.
void CRhinoGet::SetDefaultNumber | ( | double | default_number, |
const wchar_t * | format = nullptr |
||
) |
Description: Set a number as default value that will be returned if the user presses ENTER key during the get. Parameters: default_number - [in] value for default number format - [in] If null, RhinoFormatNumber() is used to format the number. If not null, format is used to format the number. For example, if you want the default to always have "%g" format, then you would pass L"%g" as the format string. A non-null format string must have EXACTLY one %...e, %...f, or %...g in it. Remarks: Calling SetDefaultNumber will automatically handle setting the command prompt default and reacting to the user pressing ENTER. If the user presses ENTER to accept the default number, CRhinoGet::number is returned and CRhinoGet::GotDefault() will return true. Calling SetDefaultNumber will clear any previous calls to SetDefaultString or SetDefaultPoint.
void CRhinoGet::SetDefaultPoint | ( | ON_3dPoint | default_point | ) |
Description: Set a point as default value that will be returned if the user presses the ENTER key during the get. Parameters: default_point - [in] value for default point Remarks: Calling SetDefaultPoint will automatically handle setting the command prompt default and reacting to the user pressing ENTER. If the user presses enter to accept the default point, CRhinoGet::point is returned and CRhinoGet::GotDefault() will return true. Calling SetDefaultPoint will clear any previous calls to SetDefaultString or SetDefaultNumber.
void CRhinoGet::SetDefaultString | ( | const wchar_t * | default_string | ) |
Description: Set a string as default value that will be returned if the user presses ENTER key during the get. Parameters: default_string - [in] value for default string Remarks: Calling SetDefaultString will automatically handle setting the command prompt default and reacting to the user pressing ENTER. If the user presses ENTER to accept the default string, CRhinoGet::string is returned and CRhinoGet::GotDefault() will return true. Calling SetDefaultString will clear any previous calls to SetDefaultNumber or SetDefaultPoint.
void CRhinoGet::SetDocument | ( | unsigned int | rhino_doc_sn | ) |
Description: Set the document targeted by this get. Parameters: rhino_doc_sn - [in]
|
protected |
void CRhinoGet::SetOptionVaries | ( | int | option_index, |
bool | bVaries | ||
) |
Set option that uses "option_name=value" format to show the value as "Varies".
void CRhinoGet::SetVector | ( | const ON_3dVector & | v | ) |
Description: Set m_vector field. Parameters: v - [in];
void CRhinoGet::SetWaitDuration | ( | double | seconds | ) |
Description: Expert user function to limit the amount of time GetPoint, GetObjects, GetString, etc., will wait for input. Parameters: seconds - [in] number of seconds to wait. By default the getters will wait indefinitely. Remarks: If a getter times out, then CRhinoGet::timeout is returned by GetPoint, GetObjects, GetString, etc.
const wchar_t* CRhinoGet::String | ( | ) | const |
Used to get string if CRhinoGetPoint::GetPoint(), CRhinoGetObject::GetObject(), etc., returns CRhinoGet::string.
TYPE CRhinoGet::Type | ( | ) | const |
ON_3dVector CRhinoGet::Vector | ( | ) | const |
Used to get direction if Get*() returns CRhinoGet::point. (Set by some digitizers, but in general it's (0,0,0);
CRhinoView* CRhinoGet::View | ( | ) | const |
Used to get view user clicked in during CRhinoGetPoint::GetPoint(), CRhinoGetObject::GetObject(), etc.
MSG CRhinoGet::WindowsMessage | ( | ) | const |
Description: Used to get Windows message if Get*() returns CRhinoGet::winmsg. Returns: Windows message.
ON_3dPoint CRhinoGet::WorldPoint1 | ( | ) | const |
Returns: Value of first 3d world point typed in the command line during a Get2dPoint()....if not set, value will be ON_unset_point
ON_3dPoint CRhinoGet::WorldPoint2 | ( | ) | const |
Returns: Value of second 3d world point typed in the command line during a Get2dPoint()....if not set, value will be ON_unset_point
|
protected |
true to clamp 2d coordinates to window
|
protected |
0 = none, 1 = corner-to-corner rect, 2 = center-to-corner rect, 3 = start-to-end line, 4 = middle-to-end line
|
protected |
|
protected |
first 2d rect corner-center / 2d line end
|
protected |
second 2d rect corner / 2d line end
|
protected |
|
protected |
0 = none, 1 = get first point, 2 get second point, 3 = done
|
protected |
first 3d world point input during 2d get point
|
protected |
second 3d world point input during 2d get point
|
protected |
2d window point (used by CRhinoGetPoint::Get2dPoint)
class CRhGetSdkExtension* CRhinoGet::m__rhino_get_sdk_extension |
|
protected |
2d screen point (used by CRhinoGet2dPoint)
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
3d world point
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
true if getting point on mouse up
|
protected |
|
protected |
|
protected |
if not NULL, Get2dPoint()/Get2dRectangle() will use this view
|
protected |
if left < right and top < bottom, this is the Windows GDI screen coordinates of the picking rectangle. m_view->Viewport().GetPickXform( m_pick_rect, pick_xform ) will calculate the picking transformation that was used.
|
protected |
3d world point
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
3d world vector (from some digitizers)
|
protected |
milliseconds
|
protected |
list of windows message ids (in the range 0xC000 - 0xFFFF) to wait for. These are set by calling CRhinoGet::AcceptWindowsMessage() before calling GetPoint/GetObjects/GetOption/GetString/...