Grasshopper

algorithmic modeling for Rhino

The double click popup window for inserting components accepts a number of different input formats. If you provide a plain component name (or the abbreviation or a word used in the description) then you will see a list of potential matches, sorted from most relevant to least relevant:

Some components and objects support initialisation codes, which means you can assign certain values directly from the popup box. You can do this by adding an equals symbol after the name and then the value you wish to assign. For example, the [Curve Offset] component allows you to specify the offset distance via the popup box by typing =5 after the offset command:

However the popup box also supports a set of special formats that allow you to create specific objects without even typing their names. As of 0.9.0077 (which hasn't been released yet at the time of writing) you can use the following shortcuts to create special objects. In the notation below optional parts of a format will be surrounded by square brackets and hashes (#) will be used to indicate numeric values. So #,#[,#] means;

at least two numeric values separated by a comma, with an optional second comma and third number.

A complete list of special formats (not all of these are supported yet in 0.9.0076):

  • "∙∙∙
    If the format starts with a double quote, then the entire contents (minus any other double quotes) will be placed into a Text Panel.
  • //
    If the format starts with two forward slashes, then the entire contents will be placed in a Text Panel.
  • ~
    If the format starts with a tilde, then the entire contents will be placed in a Scribble object.
  • #,#[,#]
    If the format contains two or three numerics separated by commas, a Point parameter will be created with the specified coordinates.
  • +[#]
    If the format starts with a plus symbol followed by a numeric, then an Addition component will be created.
  • -[#]
    If the format starts with a minus symbol followed by a numeric, then a Subtraction component will be created.
  • *[#]
    If the format starts with an asterisk symbol followed by a numeric, then a Multiplication component will be created.
  • /[#]
    If the format starts with a forward slash symbol followed by a numeric, then a Division component will be created.
  • \[#]
    If the format starts with a backward slash symbol followed by a numeric, then an Integer Division component will be created.
  • %[#]
    If the format starts with a percent symbol followed by a numeric, then a Modulus component will be created.
  • &[]
    If the format starts with an ampersand symbol, then a Concatenation component will be created.
  • =[]
    If the format starts with an equals symbol, then an Equality component will be created.
  • <[*]
    If the format starts with a smaller than symbol, then a Smaller Than component will be created.
  • >[*]
    If the format starts with a larger than symbol, then a Larger Than component will be created.
  • [# *] Pi
    If the format contains the text "Pi" with an optional multiplication factor, then a Pi component will be created.
  • #
    If the format can be evaluated as a single numeric value, then a Slider will be created with the specified initial value and sensible™ lower and upper limits.
  • #<#
    If the format contains two numerics separated by a smaller than symbol, a Slider with the specified limits will be created. The initial slider value will be equal to the lower limit.
  • #<#<#
    If the format contains three numerics separated by a smaller than symbol, a Slider with the specified limits will be created. The initial slider value will be the value in the middle.
  • #..#
    If the format contains two numerics separated by two or more consecutive dots, a Slider with the specified limits will be created. The initial slider value will be equal to the lower limit.
  • #..#..#
    If the format contains three numerics separated by two or more consecutive dots, a Slider with the specified limits will be created. The initial slider value will be the value in the middle.
  • #/#/[#]
    If the format contains two or three numerics separated by  forward slashes, a Calendar object will be created. The order of value is day/month/year. If year is omitted then the current year is used. Note that a second slash is required because #/# is interpreted as a number and thus results in a Slider.
  • #:#[:#] [am/pm]
    If the format contains at least two numerics separated by a colon, a Clock object is created. Seconds are optional, as are am/pm suffixes.

  • f([...[,...[,...]]]) [= *]
    If the format starts with a lower case f followed by an opening bracket, an Expression component is created. A list of comma separated arguments can be provided as inputs, and anything after the optional equals symbol becomes the expression string.

Note that decimal places will be harvested from formats that indicate sliders. I.e. the format 0..2..10 is not the same as 0..2..10.00, as the former will create an integer slider from zero to ten whereas the latter will create a floating point slider with two decimal places from zero to ten.

Views: 12450

Replies to This Discussion

Thanks for this!  May I request that this become the official Popup shortcut thread?  Can we add to this all of the slider shortcuts and anything else that might exist?

Absolutely, better to have it all in one place. I just added three more shortcuts I just implemented (<, > and =) and also added some information about slider decimal places. Any further changes to the popup shortcuts will be included here.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David. This is amazing. Would it be possible to add an expression pop-up shortcut? I believe it would be very usefull as well.

What would it look like?

would it not be something like:

Expression=contains(x,y)

shorthand:

Exp=contains(x,y) or !=contains(x,y)

where the exclamation mark is expressive.... get it? :)

you would have to handle a second '=' for situations like:

Exp=if(x=0,y,z)

It's sort of difficult to figure out which bits of text represent variables, and even then the input order will probably be just the order in which the variables first appear, which may not be desirable. Since it's annoying to 'swap' two inputs, it would be great if this could be defined directly as well.

How about the following notation:

f(x, y) = x^2 + sin(y)

The 'f(*) = ' pattern tells me an expression is called for, the contents in between the brackets tell me which variables will be inputs and in what order they should appear, and everything after the first equals sign will become the expression proper.

And of course this would also allow you to fairly quickly set up just the inputs, if you want to omit the expression at first:

f(x, y, t)

that actually seems mathematically quite coherent. I for one will surely appreciate it.

Ok done.

excelent. thanks David

Nice one

Along the same lines can Merge and Entwine have a bracketed value for the number of inputs. e.g.

Entwine(5) gives an new Entwine component with 5 inputs. And similarly Entwine(2) would reduce the the number from the default.

EDIT: I suppose it could be Entwine=5 or Entwine=2 

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service