application

AddAlias(alias, macro)
Add new command alias to Rhino. Command aliases can be added manually by
    using Rhino's Options command and modifying the contents of the Aliases tab.
Parameters:
alias = name of new command alias. Cannot match command names or existing
        aliases.
macro = The macro to run when the alias is executed.
Returns:
True or False indicating success or failure.
Example:
import rhinoscriptsyntax as  rs
rs.AddAlias("OriginLine",  "!_Line 0,0,0")
AddSearchPath(folder, index=-1)
Add new path to Rhino's search path list. Search paths can be added by
    using Rhino's Options command and modifying the contents of the files tab.
Parameters:
folder = A valid folder, or path, to add.
index [opt] = Zero-based position in the search path list to insert.
              If omitted, path will be appended to the end of the
              search path list.
Returns:
The index where the item was inserted if success.
-1 on failure.
Example:
import rhinoscriptsyntax as rs
rs.AddSearchPath("C:\\My Python Scripts")
AliasCount()
Returns number of command aliases in Rhino.
Parameters:
None
Returns:
the number of command aliases in Rhino.
Example:
import rhinoscriptsyntax as rs
print "alias count = ", rs.AliasCount()
AliasMacro(alias, macro=None)
Returns or modifies the macro of a command alias.
Parameters:
alias = The name of an existing command alias.
macro [opt] = The new macro to run when the alias is executed.
Returns:
If a new macro is not specified, the existing macro if successful.
If a new macro is specified, the previous macro if successful.
None on error
Example:
import rhinoscriptsyntax as rs
aliases = rs.AliasNames()
for alias in aliases:
print alias, " -> ", rs.AliasMacro(alias)
AliasNames()
Returns a list of command alias names.
Parameters:
None
Returns:
a list of command alias names.
Example:
import rhinoscriptsyntax as rs
aliases = rs.AliasNames()
for alias in aliases: print alias
AppearanceColor(item, color=None)
Returns or modifies an application interface item's color.
Parameters:
item = Item number to either query or modify
       0  = View background
       1  = Major grid line
       2  = Minor grid line
       3  = X-Axis line
       4  = Y-Axis line
       5  = Selected Objects
       6  = Locked Objects
       7  = New layers
       8  = Feedback
       9  = Tracking
       10 = Crosshair
       11 = Text
       12 = Text Background
       13 = Text hover
color[opt] = The new color value
Returns:
if color is not specified, the current item color
if color is specified, the previous item color
Example:
import rhinoscriptsyntax as rs
oldColor = rs.AppearanceColor(0)
newColor = rs.GetColor(oldColor)
if newColor is not None:
rs.AppearanceColor(0, newColor)
rs.Redraw()
See Also:
AutosaveFile(filename=None)
Returns or changes the file name used by Rhino's automatic file saving
Parameters:
filename [opt] = name of the new autosave file
Returns:
if filename is not specified, the name of the current autosave file
if filename is specified, the name of the previous autosave file
Example:
import rhinoscriptsyntax as rs
file = rs.AutosaveFile()
print "The current autosave file is", file
AutosaveInterval(minutes=None)
Returns or changes how often the document will be saved when Rhino's
    automatic file saving mechanism is enabled
Parameters:
minutes [opt] = the number of minutes between saves
Returns:
if minutes is not specified, the current interval in minutes
if minutes is specified, the previous interval in minutes
Example:
import rhinoscriptsyntax as rs
minutes = rs.AutosaveInterval()
if minutes>20: rs.AutosaveInterval(20)
BuildDate()
Returns the build date of Rhino
Parameters:
None
Returns:
the build date of Rhino
Example:
import rhinoscriptsyntax as rs
build = rs.BuildDate()
print "Rhino Build:", build
See Also:
ClearCommandHistory()
Clears contents of Rhino's command history window. You can view the
    command history window by using the CommandHistory command in Rhino.
Parameters:
None
Returns:
None
Example:
import rhinoscriptsyntax as rs
rs.ClearCommandHistory()
See Also:
Command(commandString, echo=True)
Runs a Rhino command script. All Rhino commands can be used in command
    scripts. The command can be a built-in Rhino command or one provided by a
    3rd party plug-in.
Parameters:
commandString = a Rhino command including any arguments
echo[opt] = the command echo mode
Returns:
True or False indicating success or failure

Write command scripts just as you would type the command sequence at the
command line. A space or a new line acts like pressing  at the
command line. For more information, see "Scripting" in Rhino help.

Note, this function is designed to run one command and one command only.
Do not combine multiple Rhino commands into a single call to this method.
  WRONG:
    rs.Command("_Line _SelLast _Invert")
  CORRECT:
    rs.Command("_Line")
    rs.Command("_SelLast")
    rs.Command("_Invert")

Also, the exclamation point and space character ( ! ) combination used by
button macros and batch-driven scripts to cancel the previous command is
not valid.
  WRONG:
    rs.Command("! _Line _Pause _Pause")
  CORRECT:
    rs.Command("_Line _Pause _Pause")
After the command script has run, you can obtain the identifiers of most
recently created or changed object by calling LastCreatedObjects.
Example:
import rhinoscriptsyntax as rs
rs.Command("_Line 0,0,0 2,2,2")
rs.Command("_Line _Pause _Pause")
CommandHistory()
Returns the contents of Rhino's command history window
Parameters:
None
Returns:
the contents of Rhino's command history window
Example:
import rhinoscriptsyntax as rs
print rs.CommandHistory()
DefaultRenderer(renderer=None)
Returns or changes the default render plug-in
Parameters:
renderer [opt] = the name of the renderer to set as default renderer
Returns:
uuid of default renderer
Example:
import rhinoscriptsyntax as rs
rs.DefaultRenderer("MyRenderPlugIn")
See Also:
DeleteAlias(alias)
Delete an existing alias from Rhino.
Parameters:
alias = the name of an existing alias
Returns:
True or False indicating success
Example:
import rhinoscriptsyntax as rs
print rs.DeleteAlias("Hello")
DeleteSearchPath(folder)
Removes existing path from Rhino's search path list. Search path items
    can be removed manually by using Rhino's options command and modifying the
    contents of the files tab
Parameters:
folder = a folder to remove
Returns:
True or False indicating success
Example:
import rhinoscriptsyntax as rs
rs.DeleteSearchPath("C:\\My RhinoScripts")
DisplayOleAlerts( enable )
Enables/disables OLE Server Busy/Not Responding dialog boxes
Parameters:
enable = whether alerts should be visible (True or False)
Returns:
None
Example:
import System
import rhinoscriptsyntax as rs
rs.DisplayOleAlerts( False )
t = System.Type.GetTypeFromProgID("Excel.Application")
objExcel = System.Activator.CreateObject(t)
...
See Also:
EdgeAnalysisColor(color=None)
Returns or modifies edge analysis color displayed by the ShowEdges command
Parameters:
color [opt] = the new color
Returns:
if color is not specified, the current edge analysis color
if color is specified, the previous edge analysis color
Example:
import rhinoscriptsyntax as rs
oldcolor = rs.EdgeAnalysisColor()
newcolor = rs.GetColor(oldcolor)
if newcolor is not None:
rs.EdgeAnalysisColor(newcolor)
See Also:
EdgeAnalysisMode(mode=None)
Returns or modifies edge analysis mode displayed by the ShowEdges command
Parameters:
mode [opt] = the new display mode. The available modes are
             0 - display all edges
             1 - display naked edges
Returns:
if mode is not specified, the current edge analysis mode
if mode is specified, the previous edge analysis mode
Example:
import rhinoscriptsyntax as rs
previous_mode = rs.EdgeAnalysisMode(1)
See Also:
EnableAutosave(enable=True)
Enables or disables Rhino's automatic file saving mechanism
Parameters:
enable = the autosave state
Returns:
the previous autosave state
Example:
import rhinoscriptsyntax as rs
prevstate = rs.EnableAutosave()
EnablePlugIn(plugin, enable=None)
Enables or disables a Rhino plug-in
Parameters:
plugin = id of the plugin
enable [opt] = load silently if True
Returns:
True if set to load silently otherwise False
Example:
import rhinoscriptsyntax as rs
print rs.EnablePlugIn("RhinoCrasher", False)
ExeFolder()
Returns the full path to Rhino's executable folder.
Parameters:
None
Returns:
the full path to Rhino's executable folder.
Example:
import rhinoscriptsyntax as rs
folder = rs.ExeFolder()
print folder
See Also:
ExePlatform()
Returns the platform of the Rhino executable
Parameters:
None
Returns:
the platform of the Rhino executable
Example:
import rhinoscriptsyntax as rs
if rs.ExePlatform() == 1:
print "You are using a 64-bit version of Rhino."
else:
print "You are using a 32-bit version of Rhino."
ExeServiceRelease()
Returns the service release number of the Rhino executable
Parameters:
None
Returns:
the service release number of the Rhino executable
Example:
import rhinoscriptsyntax as rs
print "Build date:", rs.BuildDate()
print "SDK Version:", rs.SdkVersion()
print "SDK Service Release:", rs.SdkServiceRelease()
print "Executable Version:", rs.ExeVersion()
print "Executable Service Release:", rs.ExeServiceRelease()
print "Serial Number:", rs.SerialNumber()
print "Node Type:", rs.NodeType()
print "Install Type:", rs.InstallType()
ExeVersion()
Returns the major version number of the Rhino executable
Parameters:
None
Returns:
the major version number of the Rhino executable
Example:
import rhinoscriptsyntax as rs
print "Build date:", rs.BuildDate()
print "SDK Version:", rs.SdkVersion()
print "SDK Service Release:", rs.SdkServiceRelease()
print "Executable Version:", rs.ExeVersion()
print "Executable Service Release:", rs.ExeServiceRelease()
print "Serial Number:", rs.SerialNumber()
print "Node Type:", rs.NodeType()
print "Install Type:", rs.InstallType()
Exit()
Closes the rhino application
Parameters:
None
Returns:
None
Example:
import rhinoscriptsyntax as rs
rs.Exit()
See Also:
FindFile(filename)
Searches for a file using Rhino's search path. Rhino will look for a
    file in the following locations:
      1. The current document's folder.
      2. Folder's specified in Options dialog, File tab.
      3. Rhino's System folders
Parameters:
filename = short file name to search for
Returns:
full path on success
Example:
import rhinoscriptsyntax as rs
path = rs.FindFile("Rhino.exe")
print path
See Also:
GetPlugInObject(plug_in)
Returns a scriptable object from a specified plug-in. Not all plug-ins
    contain scriptable objects. Check with the manufacturer of your plug-in
    to see if they support this capability.
Parameters:
plug_in = name or Id of a registered plug-in that supports scripting.
          If the plug-in is registered but not loaded, it will be loaded
Returns:
scriptable object if successful
None on error
Example:
import rhinoscriptsyntax as rs
objPlugIn = rs.GetPlugInObject("SomePlugIn")
if objPlugIn is not None:
print objPlugIn.About()
See Also:
InCommand(ignore_runners=True)
Determines if Rhino is currently running a command. Because Rhino allows
    for transparent commands (commands run from inside of other commands), this
    method returns the total number of active commands.
Parameters:
ignore_runners [opt] = If true, script running commands, such as
    LoadScript, RunScript, and ReadCommandFile will not counted.
Returns:
the number of active commands
Example:
import rhinoscriptsyntax as rs
commands = rs.InCommand()
if commands > 0:
print "Rhino is running", commands, "command(s)."
else:
print "Rhino is not running any command(s)."
See Also:
InstallFolder()
The full path to Rhino's installation folder
Parameters:
None
Returns:
the full path to Rhino's installation folder
Example:
import rhinoscriptsyntax as rs
print rs.InstallFolder()
See Also:
IsAlias(alias)
Verifies that a command alias exists in Rhino
Parameters:
alias = the name of an existing command alias
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
print rs.IsAlias("Hello")
IsCommand(command_name)
Verifies that a command exists in Rhino. Useful when scripting commands
    found in 3rd party plug-ins.
Parameters:
command_name = the command name to test
Returns:
True of False
Example:
import rhinoscriptsyntax as rs
GetString("Command name to test")
if cmdname is not None:
iscmd = rs.IsCommand(cmdname)
if iscmd:
print "The", cmdname, "command exists."
else:
print "The", cmdname, "command does not exist."
See Also:
IsPlugIn(plugin)
Verifies that a plug-in is registered
Parameters:
plugin = id of the plug-in
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
plugin = rs.GetString("Plug-in name")
IsRunningOnWindows()
Returns True if this script is being executed on a Windows platform
Parameters:
None
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
if rs.IsRunngingOnWindows():
print "Running on Windows"
else:
print "Running on Mac"
See Also:
LastCommandName()
Returns the name of the last executed command
Parameters:
None
Returns:
the name of the last executed command
Example:
import rhinoscriptsyntax as rs
rs.Command( "Line" )
print "The last command was the", rs.LastCommandName(), "command."
LastCommandResult()
Returns the result code for the last executed command
    0 = success (command successfully completed)
    1 = cancel (command was cancelled by the user)
    2 = nothing (command did nothing, but was not cancelled)
    3 = failure (command failed due to bad input, computational problem...)
    4 = unknown command (the command was not found)
Parameters:
None
Returns:
the result code for the last executed command
Example:
import rhinoscriptsyntax as rs
rs.Command( "Line" )
result = rs.LastCommandResult()
if result==0:
print "The command completed."
else:
print "The command did not complete."
LocaleID()
Returns the current language used for the Rhino interface.  The current
    language is returned as a locale ID, or LCID, value.
      1029  Czech
      1031  German-Germany
      1033  English-United States
      1034  Spanish-Spain
      1036  French-France
      1040  Italian-Italy
      1041  Japanese
      1042  Korean
      1045  Polish
Parameters:
None
Returns:
the current language used fro the Rhino interface as a locale ID, or LCID.
Example:
import rhinoscriptsyntax as rs
lcid = rs.LocaleID()
if lcid==1029:
print "message in Czech"
elif lcid==1031:
print "message in German"
elif lcid==1033:
print "message in English"
elif lcid==1034:
print "message in Spanish"
elif lcid==1036:
print "message in Italian"
elif lcid==1040:
print "message in Japanese"
elif lcid==1042:
print "message in Korean"
elif lcid==1045:
print "message in Polish"
See Also:
Ortho(enable=None)
Enables or disables Rhino's ortho modeling aid.
Parameters:
enable [opt] = the new enabled status (True or False)
Returns:
if enable is not specified, then the current ortho status
if enable is secified, then the previous ortho status
Example:
import rhinoscriptsyntax as rs
if not rs.Ortho(): rs.Ortho(True)
See Also:
Osnap(enable=None)
Enables or disables Rhino's object snap modeling aid.
    Object snaps are tools for specifying points on existing objects.
Parameters:
enable [opt] = the new enabled status (True or False)
Returns:
if enable is not specified, then the current osnap status
if enable is secified, then the previous osnap status
Example:
import rhinoscriptsyntax as rs
if not rs.Osnap(): rs.Osnap(True)
OsnapDialog(visible=None)
Shows or hides Rhino's dockable object snap bar
Parameters:
visible [opt] = the new visibility state (True or False)
Returns:
if visible is not specified, then the current visible state
if visible is secified, then the previous visible state
Example:
import rhinoscriptsyntax as rs
if not rs.OsnapDialog(): rs.OsnapDialog(True)
OsnapMode(mode=None)
Returns or sets the object snap mode. Object snaps are tools for
    specifying points on existing objects
Parameters:
mode [opt] = The object snap mode or modes to set. Object snap modes
             can be added together to set multiple modes
             0     None
             1     Near
             2     Focus
             4     Center
             8     Knot
             16    Quadrant
             32    Midpoint
             64    Intersection
             128   End
             256   Perpendicular
             512   Tangent
             1024  Point
             2048  Vertex
Returns:
if mode is not specified, then the current object snap mode(s)
if mode is specified, then the previous object snap mode(s)
Example:
import rhinoscriptsyntax as rs
rhOsnapModeEnd = 128
mode = rs.OsnapMode()
if not (mode & rhOSnapModeEnd):
mode = mode + rhOsnapModeEnd
rs.OsnapMode(mode)
Planar(enable=None)
Enables or disables Rhino's planar modeling aid
Parameters:
enable = the new enable status (True or False)
Returns:
if enable is not specified, then the current planar status
if enable is secified, then the previous planar status
Example:
import rhinoscriptsyntax as rs
if not rs.Planar(): rs.Planar(True)
See Also:
PlugInId(plugin)
Returns the identifier of a plug-in given the plug-in name
Parameters:
plugin = name of the plug-in
Returns:
the id of the plug-in or None if the plug-in isn't valid
Example:
import rhinoscriptsyntax as rs
plugins = rs.PlugIns(0, 1)
if plugins:
PlugIns(types=0, status=0)
Returns a list of registered Rhino plug-ins
Parameters:
types [opt] = type of plug-ins to return. 0=all, 1=render, 2=file export,
  4=file import, 8=digitizer, 16=utility
status [opt] = 0=both loaded and unloaded, 1=loaded, 2=unloaded
Returns:
list of registered Rhino plug-ins
Example:
import rhinoscriptsyntax as rs
plugins = rs.PlugIns(0, 1)
See Also:
ProjectOsnaps(enable=None)
Enables or disables object snap projection
Parameters:
enable [opt] = the new enabled status (True or False)
Returns:
if enable is not specified, the current object snap projection status
if enable is specified, the previous object snap projection status
Example:
import rhinoscriptsyntax as rs
if not rs.ProjectOsnaps(): rs.ProjectOsnaps(True)
Prompt(message=None)
Change Rhino's command window prompt
Parameters:
message [opt] = the new prompt
Returns:
None
Example:
import rhinoscriptsyntax as rs
rs.Prompt("Hello Rhino!")
See Also:
ScreenSize()
Returns current width and height, of the screen of the primary monitor.
Parameters:
None
Returns:
Tuple containing two numbers identifying the width and height
Example:
import rhinoscriptsyntax as rs
size = rs.ScreenSize()
print "Screen Width:", size[0], "pixels"
print "Screen Height:", size[1], "pixels"
See Also:
SdkVersion()
Returns version of the Rhino SDK supported by the executing Rhino.
    Rhino SDK versions are 9 digit numbers in the form of YYYYMMDDn.
Parameters:
None
Returns:
the version of the Rhino SDK supported by the executing Rhino
Example:
import rhinoscriptsyntax as rs
print "Required SDK Version:", rs.SdkVersion()
See Also:
SearchPathCount()
Returns the number of path items in Rhino's search path list.
    See "Options Files settings" in the Rhino help file for more details.
Parameters:
None
Returns:
the number of path items in Rhino's search path list
Example:
import rhinoscriptsyntax as rs
count = rs.SearchPathCount()
if count>0:
paths = rs.SearchPathList()
SearchPathList()
Returns all of the path items in Rhino's search path list.
    See "Options Files settings" in the Rhino help file for more details.
Parameters:
None
Returns:
list of search paths
Example:
import rhinoscriptsyntax as rs
count = rs.SearchPathCount()
if count>0:
paths = rs.SearchPathList()
SendKeystrokes(keys=None, add_return=True)
Sends a string of printable characters to Rhino's command line
Parameters:
keys [opt] = A string of characters to send to the command line.
add_returns [opt] = Append a return character to the end of the string.
Returns:
None
Example:
import rhinoscriptsyntax as rs
rs.SendKeystroke( "Hello Rhino!" )
rs.SendKeystrokes( 25/4 )
See Also:
Snap(enable=None)
Enables or disables Rhino's grid snap modeling aid
Parameters:
enable [opt] = the new enabled status (True or False)
Returns:
if enable is not specified, the current grid snap status
if enable is specified, the previous grid snap status
Example:
import rhinoscriptsyntax as rs
if not rs.Snap(): rs.Snap(True)
See Also:
StatusBarDistance(distance=0)
Sets Rhino's status bar distance pane
Parameters:
distance [opt] = distance to set the status bar
Returns:
None
Example:
import rhinoscriptsyntax as rs
rs.StatusBarDistance(3.14159)
StatusBarMessage(message=None)
Sets Rhino's status bar message pane
Parameters:
message [opt] = message value
Returns:
None
Example:
import rhinoscriptsyntax as rs
rs.StatusBarMessage("Hello Rhino!")
StatusBarPoint(point=None)
Sets Rhino's status bar point coordinate pane
Parameters:
point [opt] = point value
Returns:
None
Example:
import rhinoscriptsyntax as rs
pt = (1.1, 2.2, 3.3)
rs.StatusBarPoint(pt)
StatusBarProgressMeterShow(label, lower, upper, embed_label=True, show_percent=True)
Start the Rhino status bar progress meter
Parameters:
label = short description of the progesss
lower = lower limit of the progress meter's range
upper = upper limit of the progress meter's range
embed_label[opt] = if True, the label will show inside the meter.
  If false, the label will show to the left of the meter
show_percent[opt] = show the percent complete
Returns:
True or False indicating success or failure
Example:
See Also:
StatusBarProgressMeterUpdate(position, absolute=True)
Set the current position of the progress meter
Parameters:
position = new position in the progress meter
absolute[opt] = position is an absolute or relative
Returns:
previous position setting
Example:
See Also:
StatusBarProgressMeterHide()
Hide the progress meter
Parameters:
None
Returns:
None
Example:
See Also:
TemplateFile(filename=None)
Returns or sets Rhino's default template file. This is the file used
    when Rhino starts.
Parameters:
filename[opt] = The name of the new default template file (must exist)
Returns:
if filename is not specified, then the current default template file
if filename is specified, then the previous default template file
Example:
import rhinoscriptsyntax as rs
folder = rs.TemplateFolder()
filename = folder + "\\Millimeters.3dm"
rs.TemplateFile(filename)
See Also:
TemplateFolder(folder=None)
Returns or sets the location of Rhino's template folder
Parameters:
The location of Rhino's template files. Note, the location must exist
Returns:
if folder is not specified, then the current template file folder
if folder is specified, then the previous template file folder
Example:
import rhinoscriptsyntax as rs
folder = rs.TemplateFolder()
filename = folder + "\\Millimeters.3dm"
rs.TemplateFile(filename)
See Also:
WindowHandle()
Returns the windows handle of Rhino's main window
Parameters:
None
Returns:
the windows handle of Rhino's main window
Example:
import rhinoscriptsyntax as rs
handle = rs.WindowHandle()
print handle
See Also:
WorkingFolder(folder=None)
Returns or sets Rhino's working folder (directory).
    The working folder is the default folder for all file operations.
Parameters:
folder[opt] = the new working folder
Returns:
if folder is not specified, then the current working folder
if folder is specified, then the previous working folder
Example:
import rhinoscriptsyntax as  rs
folder = rs.WorkingFolder()
folder = rs.BrowseForFolder(folder,  "Directory", "Select Directory")
if folder is not None:
rs.WorkingFolder(folder)
See Also:

block

AddBlock(object_ids, base_point, name=None, delete_input=False)
Adds a new block definition to the document
Parameters:
object_ids = objects that will be included in the block
base_point = 3D base point for the block definition
name(opt) = name of the block definition. If omitted a name will be
  automatically generated
delete_input(opt) = if True, the object_ids will be deleted
Returns:
name of new block definition on success
Example:
import rhinoscriptsyntax as rs
objs = rs.GetObjects("Select objects to define block")
if objs:
point = rs.GetPoint("Block base point")
if point:
block = rs.AddBlock(objs, point, None, True)
rs.InsertBlock(block, point)
See Also:
BlockContainerCount(block_name)
Returns number of block definitions that contain a specified
    block definition
Parameters:
block_name = the name of an existing block definition
Returns:
the number of block definitions that contain a specified block definition
Example:
import rhinoscriptscriptsyntax as rs
block = rs.GetString("Block name to query")
if rs.IsBlock(block):
count = rs.BlockContainerCount(block)
print "This block is nested in", count, "block(s)."
BlockContainers(block_name)
Returns names of the block definitions that contain a specified block
    definition.
Parameters:
block_name = the name of an existing block definition
Returns:
A list of block definition names
Example:
import rhinoscriptsyntax as rs
blockname = rs.GetString("Block name to query")
if rs.IsBlock(blockname):
blocks = rs.BlockContainers(blockname)
for block in blocks: print block
BlockCount()
Returns the number of block definitions in the document
Parameters:
None
Returns:
the number of block definitions in the document
Example:
import rhinoscriptsyntax as rs
count = rs.BlockCount()
print "There are", count, " blocks."
See Also:
BlockDescription(block_name, description=None)
Returns or sets the description of a block definition
Parameters:
block_name = the name of an existing block definition
description[opt] = The new description.
Returns:
if description is not specified, the current description
if description is specified, the previous description
Example:
import rhinoscriptsyntax as rs
blockname = rs.GetString("Block name to list description")
if rs.IsBlock(blockname):
desc = rs.BlockDescription(blockname)
if desc is None: print "No description"
else: print desc
See Also:
BlockInstanceCount(block_name,where_to_look=0)
Counts number of instances of the block in the document.
    Nested instances are not included in the count.
Parameters:
block_name = the name of an existing block definition
where_to_look [opt] =
  0 = get top level references in active document.
  1 = get top level and nested references in active document.
  2 = check for references from other instance definitions
Returns:
the number of instances of the block in the document
Example:
import rhinoscriptsyntax as rs
blockname = rs.GetString("Block to count")
if rs.IsBlock(blockname):
count = rs.BlockInstanceCount(blockname)
print count, "block(s) found."
BlockInstanceInsertPoint(object_id)
Returns the insertion point of a block instance.
Parameters:
object_id = The identifier of an existing block insertion object
Returns:
list representing 3D point if successful
Example:
import rhinoscriptsyntax as rs
strObject = rs.GetObject("Select block")
if rs.IsBlockInstance(strObject):
rs.AddPoint( rs.BlockInstanceInsertPoint(strObject) )
BlockInstanceName(object_id)
Returns the block name of a block instance
Parameters:
object_id = The identifier of an existing block insertion object
Returns:
the block name of a block instance
Example:
import rhinoscriptsyntax as rs
strObject = rs.GetObject("Select block")
if rs.IsBlockInstance(strObject):
print rs.BlockInstanceName(strObject)
BlockInstances(block_name)
Returns the identifiers of the inserted instances of a block.
Parameters:
block_name = the name of an existing block definition
Returns:
list of guids identifying the instances of a block
Example:
import rhinoscriptsyntax as rs
strBlock = rs.GetString("Block to select")
if rs.IsBlock(strBlock):
arrObjects = rs.BlockInstances(strBlock)
if arrobjects:
rs.SelectObjects(arrObjects)
BlockInstanceXform(object_id)
Returns the location of a block instance relative to the world coordinate
    system origin (0,0,0). The position is returned as a 4x4 transformation
    matrix
Parameters:
object_id = The identifier of an existing block insertion object
Returns:
the location, as a transform matrix, of a block instance relative to the world coordinate
system origin
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select block to query")
if rs.IsBlockInstance(obj):
arrMatrix = rs.BlockInstanceXform(obj)
if arrMatrix is not None:
pointId = rs.AddPoint([0,0,0])
rs.TransformObject( pointId, arrMatrix)
BlockNames( sort=False )
Returns the names of all block definitions in the document
Parameters:
sort = return a sorted list
Returns:
the names of all block definitions in the document
Example:
import rhinoscriptsyntax as rs
names = rs.BlockNames(True)
if names:
See Also:
BlockObjectCount(block_name)
Returns number of objects that make up a block definition
Parameters:
block_name = name of an existing block definition
Returns:
the number of objects that make up a block definition
Example:
import rhinoscriptsyntax as rs
count = rs.BlockObjectCount()
print "There are", count, " blocks."
BlockObjects(block_name)
Returns identifiers of the objects that make up a block definition
Parameters:
block_name = name of an existing block definition
Returns:
list of identifiers on success
Example:
import rhinoscriptsyntax as rs
strBlock = rs.GetString("Block name to list identifiers")
if rs.IsBlock(strBlock):
objects = rs.BlockObjects(strBlock)
if objects:
for item in objects: print item
BlockPath(block_name)
Returns path to the source of a linked or embedded block definition.
    A linked or embedded block definition is a block definition that was
    inserted from an external file.
Parameters:
block_name = name of an existing block definition
Returns:
path to the linked block on success
Example:
import rhinoscriptsyntax as rs
strBlock = rs.GetString("Block name to list path")
if rs.IsBlockEmbedded(strBlock):
print rs.BlockPath(strBlock)
BlockStatus(block_name)
Returns the status of a linked block
        Value Description
        -3    Not a linked block definition.
        -2    The linked block definition's file could not be opened or could not be read.
        -1    The linked block definition's file could not be found.
         0    The linked block definition is up-to-date.
         1    The linked block definition's file is newer than definition.
         2    The linked block definition's file is older than definition.
         3    The linked block definition's file is different than definition.
Parameters:
None
Returns:
the status of a linked block
Example:
import rhinoscriptsyntax as rs
block = rs.GetString("Block name to list description")
if rs.IsBlock(block):
status = rs.BlockStatus(block)
print "block status for", block, "is", status
See Also:
DeleteBlock(block_name)
Deletes a block definition and all of it's inserted instances.
Parameters:
block_name = name of an existing block definition
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
strBlock = rs.GetString("Block name to delete")
if rs.IsBlock(strBlock):
rs.DeleteBlock(strBlock)
ExplodeBlockInstance(object_id)
Explodes a block instance into it's geometric components. The
    exploded objects are added to the document.  Nested blocks are not exploded.
Parameters:
object_id = The identifier of an existing block insertion object
Returns:
identifiers for the newly exploded objects on success
Example:
import rhinoscriptsyntax as rs
strObject = rs.GetObject("Select block instance to explode")
if rs.IsBlockInstance(strObject):
rs.ExplodeBlockInstance(strObject)
InsertBlock( block_name, insertion_point, scale=(1,1,1), angle_degrees=0, rotation_normal=(0,0,1) )
Inserts a block whose definition already exists in the document
Parameters:
block_name = name of an existing block definition
insertion_point = insertion point for the block
scale [opt] = x,y,z scale factors
angle_degrees [opt] = rotation angle in degrees
rotation_normal [opt] = the axis of rotation.
Returns:
id for the block that was added to the doc
Example:
See Also:
InsertBlock2(block_name, xform)
Inserts a block whose definition already exists in the document
Parameters:
block_name = name of an existing block definition
xform = 4x4 transformation matrix to apply
Returns:
id for the block that was added to the doc on success
Example:
See Also:
IsBlock(block_name)
Verifies the existence of a block definition in the document.
Parameters:
block_name = name of an existing block definition
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
strBlock = rs.GetString("Block name")
if rs.IsBlock(strBlock):
print "The block definition exists."
else:
print "The block definition does not exist."
IsBlockEmbedded(block_name)
Verifies a block definition is embedded, or linked, from an external file.
Parameters:
block_name = name of an existing block definition
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
strBlock = rs.GetString("Block name")
if rs.IsBlock(strBlock):
if rs.IsBlockEmbedded(strBlock):
print "The block definition is embedded."
else:
print "The block definition is not embedded."
else:
print "The block definition does not exist."
IsBlockInstance(object_id)
Verifies an object is a block instance
Parameters:
object_id = The identifier of an existing block insertion object
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select block instance")
if rs.IsBlockInstance(obj):
print "The object is a block instance."
else:
print "The object is not a block instance."
IsBlockInUse(block_name, where_to_look=0)
Verifies that a block definition is being used by an inserted instance
Parameters:
block_name = name of an existing block definition
where_to_look [opt] = One of the following values
     0 = Check for top level references in active document
     1 = Check for top level and nested references in active document
     2 = Check for references in other instance definitions
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
strBlock = rs.GetString("Block name")
if rs.IsBlock(strBlock):
if rs.IsBlockInUse(strBlock):
print "The block definition is in use."
else:
print "The block definition is not in use."
else:
print "The block definition does not exist."
IsBlockReference(block_name)
Verifies that a block definition is from a reference file.
Parameters:
block_name = name of an existing block definition
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
strBlock = rs.GetString("Block name")
if rs.IsBlock(strBlock):
if rs.IsBlockReference(strBlock):
print "The block definition is a reference definition."
else:
print "The block definition is not a reference definition."
else:
print "The block definition does not exist."
RenameBlock( block_name, new_name )
Renames an existing block definition
Parameters:
block_name = name of an existing block definition
new_name = name to change to
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
strOldBlock = rs.GetString("Old block name")
if strOldBlock:
strNewBlock = rs.GetString("New block name")
if strNewBlock:
rs.RenameBlock (strOldBlock, strNewBlock)
See Also:

curve

AddArc(plane, radius, angle_degrees)
Adds an arc curve to the document
Parameters:
plane = plane on which the arc will lie. The origin of the plane will be
  the center point of the arc. x-axis of the plane defines the 0 angle
  direction.
radius = radius of the arc
angle_degrees = interval of arc
Returns:
id of the new curve object
Example:
import rhinoscriptsyntax as  rs
plane = rs.WorldXYPlane()
plane = rs.RotatePlane(plane,  45.0, [0,0,1])
rs.AddArc( plane, 5.0, 45.0  )
AddArc3Pt(start, end, point_on_arc)
Adds a 3-point arc curve to the document
Parameters:
start, end = endpoints of the arc
point_on_arc = a point on the arc
Returns:
id of the new curve object
Example:
import rhinoscriptsyntax as rs
start = rs.GetPoint("Start of arc")
if start is not None:
end = rs.GetPoint("End of arc")
if end is not None:
pton = rs.GetPoint("Point on arc")
if pton is not None:
rs.AddArc3Pt(start, end, pton)
AddArcPtTanPt(start, direction, end)
Adds an arc curve, created from a start point, a start direction, and an
    end point, to the document
Parameters:
start = the starting point of the arc
direction = the arc direction at start
end = the ending point of the arc
Returns:
id of the new curve object
Example:
import rhinoscriptsyntax as  rs
pick = rs.GetCurveObject("Select  curve to extend")
point = rs.GetPoint("End  of extension")
domain = rs.CurveDomain(pick[0])
if abs(pick[4]-domain[0]) <  abs(pick[4]-domain[1]):
origin  = rs.CurveStartPoint(pick[0])
tangent  = rs.VectorReverse(rs.CurveTangent(pick[0], domain[0]))
else:
origin  = rs.CurveEndPoint(pick[0])
tangent  = rs.CurveTangent(pick[0], domain[1])
rs.AddArcPtTanPt(origin, tangent,  point)
See Also:
AddBlendCurve(curves, parameters, reverses, continuities)
Makes a curve blend between two curves
Parameters:
curves = two curves
parameters = two curve parameters defining the blend end points
reverses = two boolean values specifying to use the natural or opposite direction of the curve
continuities = two numbers specifying continuity at end points
  0 = position, 1 = tangency, 2 = curvature
Returns:
identifier of new curve on success
Example:
import rhinoscriptsyntax as rs
curve0 = rs.AddLine((0,0,0), (0,9,0))
curve1 = rs.AddLine((1,10,0), (10,10,0))
curves = curve0, curve1
domain_crv0 = rs.CurveDomain(curve0)
domain_crv1 = rs.CurveDomain(curve1)
params = domain_crv0[1], domain_crv1[0]
revs = False, True
cont = 2,2
rs.AddBlendCurve( curves, params, revs, cont )
See Also:
AddCircle(plane_or_center, radius)
Adds a circle curve to the document
Parameters:
plane_or_center = plane on which the circle will lie. If a point is
  passed, this will be the center of the circle on the active
  construction plane
radius = the radius of the circle
Returns:
id of the new curve object
Example:
import rhinoscriptsyntax as rs
plane = rs.WorldXYPlane()
rs.AddCircle( plane, 5.0 )
AddCircle3Pt(first, second, third)
Adds a 3-point circle curve to the document
Parameters:
first, second, third = points on the circle
Returns:
id of the new curve object
Example:
import rhinoscriptsyntax as rs
point1 = rs.GetPoint("First point on circle")
if point1:
point2 = rs.GetPoint("Second point on circle")
if point2:
point3 = rs.GetPoint("Third point on circle")
if point3:
rs.AddCircle3Pt(point1, point2, point3)
AddCurve(points, degree=3)
Adds a control points curve object to the document
Parameters:
points = a list of points
degree[opt] = degree of the curve
Returns:
id of the new curve object
Example:
import rhinoscriptsyntax as rs
points = rs.GetPoints(True, message1="Pick curve point")
if points: rs.AddCurve(points)
AddEllipse(plane, radiusX, radiusY)
Adds an elliptical curve to the document
Parameters:
plane = the plane on which the ellipse will lie. The origin of
        the plane will be the center of the ellipse
radiusX, radiusY = radius in the X and Y axis directions
Returns:
id of the new curve object if successful
Example:
import rhinoscriptsyntax as rs
plane = rs.WorldXYPlane()
rs.AddEllipse( plane, 5.0, 10.0 )
AddEllipse3Pt(center, second, third)
Adds a 3-point elliptical curve to the document
Parameters:
center = center point of the ellipse
second = end point of the x axis
third  = end point of the y axis
Returns:
id of the new curve object if successful
Example:
import rhinoscriptsyntax as rs
center = (0,0,0)
second = (5,0,0)
third = (0,10,0)
rs.AddEllipse3Pt( center, second, third )
AddFilletCurve(curve0id, curve1id, radius=1.0, base_point0=None, base_point1=None)
Adds a fillet curve between two curve objects
Parameters:
curve0id = identifier of the first curve object
curve1id = identifier of the second curve object
radius [opt] = fillet radius
base_point0 [opt] = base point of the first curve. If omitted,
                    starting point of the curve is used
base_point1 [opt] = base point of the second curve. If omitted,
                    starting point of the curve is used
Returns:
id of the new curve object if successful
Example:
import rhinoscriptsyntax as rs
curve0 = rs.AddLine([0,0,0], [5,1,0])
curve1 = rs.AddLine([0,0,0], [1,5,0])
rs.AddFilletCurve( curve0, curve1 )
See Also:
AddInterpCrvOnSrf(surface_id, points)
Adds an interpolated curve object that lies on a specified
    surface.  Note, this function will not create periodic curves,
    but it will create closed curves.
Parameters:
surface_id = identifier of the surface to create the curve on
points = list of 3D points that lie on the specified surface.
         The list must contain at least 2 points
Returns:
id of the new curve object if successful
Example:
import rhinoscriptsyntax as rs
surface_id = rs.GetObject("Select surface to draw curve on", rs.filter.surface)
if surface_id:
point1 = rs.GetPointOnSurface( surface_id, "First point on surface")
if point1:
point2 = rs.GetPointOnSurface( surface_id, "Second point on surface")
if point2:
rs.AddInterpCrvOnSrf( surface_id, [point1, point2])
AddInterpCrvOnSrfUV(surface_id, points)
Adds an interpolated curve object based on surface parameters,
    that lies on a specified surface. Note, this function will not
    create periodic curves, but it will create closed curves.
Parameters:
surface_id = identifier of the surface to create the curve on
points = list of 2D surface parameters. The list must contain
         at least 2 sets of parameters
Returns:
id of the new curve object if successful
Example:
import rhinoscriptsyntax as rs
surface_id = rs.GetObject("Select surface to draw curve on", rs.filter.surface)
if surface_id:
u0 = domainU[0]/2
u1 = domainU[1]/2
domainV = rs.SurfaceDomain( surface_id, 1)
v0 = domainV[0]/2
V1 = domainV[1]/2
rs.AddInterpCrvOnSrfUV( surface_d, [[u0,v0],[u1,v1]])
AddInterpCurve(points, degree=3, knotstyle=0, start_tangent=None, end_tangent=None)
Adds an interpolated curve object to the document. Options exist to make
    a periodic curve or to specify the tangent at the endpoints. The resulting
    curve is a non-rational NURBS curve of the specified degree.
Parameters:
points = list containing 3D points to interpolate. For periodic curves,
    if the final point is a duplicate of the initial point, it is
    ignored. The number of control points must be >= (degree+1).
degree[opt] = The degree of the curve (must be >=1).
    Periodic curves must have a degree >= 2. For knotstyle = 1 or 2,
    the degree must be 3. For knotstyle = 4 or 5, the degree must be odd
knotstyle[opt]
    0 Uniform knots.  Parameter spacing between consecutive knots is 1.0.
    1 Chord length spacing.  Requires degree = 3 with arrCV1 and arrCVn1 specified.
    2 Sqrt (chord length).  Requires degree = 3 with arrCV1 and arrCVn1 specified.
    3 Periodic with uniform spacing.
    4 Periodic with chord length spacing.  Requires an odd degree value.
    5 Periodic with sqrt (chord length) spacing.  Requires an odd degree value.
start_tangent [opt] = 3d vector that specifies a tangency condition at the
    beginning of the curve. If the curve is periodic, this argument must be omitted.
end_tangent [opt] = 3d vector that specifies a tangency condition at the
    end of the curve. If the curve is periodic, this argument must be omitted.
Returns:
id of the new curve object if successful
Example:
import rhinoscriptsyntax as rs
points = (0,0,0), (1,1,0), (2,0,0), (3,1,0), (4,0,0), (5,1,0)
rs.AddInterpCurve(points)
AddLine(start, end)
Adds a line curve to the current model.
Parameters:
start, end = end points of the line
Returns:
id of the new curve object
Example:
import rhinoscriptsyntax as rs
start = rs.GetPoint("Start of line")
if start:
end = rs.GetPoint("End of line")
if end: rs.AddLine(start, end)
AddNurbsCurve(points, knots, degree, weights=None)
Adds a NURBS curve object to the document
Parameters:
points = list containing 3D control points
knots = Knot values for the curve. The number of elements in knots must
    equal the number of elements in points plus degree minus 1
degree = degree of the curve. must be greater than of equal to 1
weights[opt] = weight values for the curve. Number of elements should
    equal the number of elements in points. Values must be greater than 0
Returns:
the identifier of the new object if successful, otherwise None
Example:
import rhinoscriptsyntax as rs
curve_id = rs.GetObject("Pick a curve", rs.filter.curve)
if curve_id:
points = rs.CurvePoints(curve_id)
knots = rs.CurveKnots(curve_id)
degree = rs.CurveDegree(curve_id)
if newcurve: rs.SelectObject(newcurve)
AddPolyline(points, replace_id=None)
Adds a polyline curve to the current model
Parameters:
points = list of 3D points. Duplicate, consecutive points will be
         removed. The list must contain at least two points. If the
         list contains less than four points, then the first point and
         last point must be different.
replace_id[opt] = If set to the id of an existing object, the object
         will be replaced by this polyline
Returns:
id of the new curve object if successful
Example:
import rhinoscriptsyntax as rs
points = rs.GetPoints(True)
if points: rs.AddPolyline(points)
See Also:
AddRectangle(plane, width, height)
Add a rectangular curve to the document
Parameters:
plane = plane on which the rectangle will lie
width, height = width and height of rectangle as measured along the plane's
  x and y axes
Returns:
id of new rectangle
Example:
import rhinoscriptsyntax as rs
plane = rs.WorldXYPlane()
plane = rs.RotatePlane(plane, 45.0, [0,0,1])
rs.AddRectangle( plane, 5.0, 15.0 )
See Also:
AddSpiral(point0, point1, pitch, turns, radius0, radius1=None)
Adds a spiral or helical curve to the document
Parameters:
point0 = helix axis start point or center of spiral
point1 = helix axis end point or point normal on spiral plane
pitch = distance between turns. If 0, then a spiral. If > 0 then the
        distance between helix "threads"
turns = number of turns
radius0, radius1 = starting and ending radius
Returns:
id of new curve on success
Example:
import rhinoscriptsyntax as rs
point0 = (0,0,0)
point1 = (0,0,10)
pitch = 1
turns = 10
radius0 = 5.0
radius1 = 8.0
rs.AddSpiral(point0, point1, pitch, turns, radius0, radius1)
See Also:
AddSubCrv(curve_id, param0, param1)
Add a curve object based on a portion, or interval of an existing curve
    object. Similar in operation to Rhino's SubCrv command
Parameters:
curve_id = identifier of a closed planar curve object
param0, param1 = first and second parameters on the source curve
Returns:
id of the new curve object if successful
Example:
import rhinoscriptsyntax as rs
getresult = rs.GetCurveObject()
if getresult:
curve_id = retresult[0]
point0 = rs.GetPointOnCurve( curve_id )
if point0:
point1 = rs.GetPointOnCurve( curve_id )
if point1:
t0 = rs.CurveClosestPoint( curve_id, point0)
t1 = rs.CurveClosestPoint( curve_id, point1)
rs.AddSubCrv( curve_id, t0, t1 )
ArcAngle(curve_id, segment_index=-1)
Returns the angle of an arc curve object.
Parameters:
curve_id = identifier of a curve object
segment_index [opt] = identifies the curve segment if 
curve_id identifies a polycurve
Returns:
The angle in degrees if successful.
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select arc")
if rs.IsArc(id):
angle = rs.ArcAngle(id)
print "Arc angle:", angle
ArcCenterPoint(curve_id, segment_index=-1)
Returns the center point of an arc curve object
Parameters:
curve_id = identifier of a curve object
segment_index [opt] = identifies the curve segment if
curve_id identifies a polycurve
Returns:
The 3D center point of the arc if successful.
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select arc")
if rs.IsArc(id):
point = rs.ArcCenterPoint(id)
rs.AddPoint(point)
ArcMidPoint(curve_id, segment_index=-1)
Returns the mid point of an arc curve object
Parameters:
curve_id = identifier of a curve object
segment_index [opt] = identifies the curve segment if
curve_id identifies a polycurve
Returns:
The 3D mid point of the arc if successful.
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select arc")
if rs.IsArc(id):
point = rs.ArcMidPoint(id)
rs.AddPoint(point)
ArcRadius(curve_id, segment_index=-1)
Returns the radius of an arc curve object
Parameters:
curve_id = identifier of a curve object
segment_index [opt] = identifies the curve segment if 
curve_id identifies a polycurve
Returns:
The radius of the arc if successful.
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select arc")
if rs.IsArc(id):
radius = rs.ArcRadius(id)
CircleCenterPoint(curve_id, segment_index=-1, return_plane=False)
Returns the center point of a circle curve object
Parameters:
curve_id = identifier of a curve object
segment_index [opt] = identifies the curve segment if
return_plane [opt] = if True, the circle's plane is returned
curve_id identifies a polycurve
Returns:
The 3D center point of the circle if successful.
The plane of the circle if return_plane is True
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select circle")
if rs.IsCircle(id):
point = rs.CircleCenterPoint(id)
rs.AddPoint( point )
CircleCircumference(curve_id, segment_index=-1)
Returns the circumference of a circle curve object
Parameters:
curve_id = identifier of a curve object
segment_index [opt] = identifies the curve segment if
curve_id identifies a polycurve
Returns:
The circumference of the circle if successful.
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select circle")
if rs.IsCircle(id):
circumference = rs.CircleCircumference(id)
print "Circle circumference:", circumference
CircleRadius(curve_id, segment_index=-1)
Returns the radius of a circle curve object
Parameters:
curve_id = identifier of a curve object
segment_index [opt] = identifies the curve segment if
curve_id identifies a polycurve
Returns:
The radius of the circle if successful.
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select circle")
if rs.IsCircle(id):
radius = rs.CircleRadius(id)
print "Circle radius:", radius
CloseCurve(curve_id, tolerance=-1.0)
Closes an open curve object by making adjustments to the end points so
    they meet at a point
Parameters:
curve_id = identifier of a curve object
tolerance[opt] = maximum allowable distance between start and end
    point. If omitted, the current absolute tolerance is used
Returns:
id of the new curve object if successful
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select curve", rs.filter.curve)
if not rs.IsCurveClosed(obj) and rs.IsCurveClosable(obj):
rs.CloseCurve( obj )
ClosedCurveOrientation(curve_id, direction=(0,0,1))
Determine the orientation (counter-clockwise or clockwise) of a closed,
    planar curve
Parameters:
curve_id = identifier of a curve object
direction[opt] = 3d vector that identifies up, or Z axs, direction of
    the plane to test against
Returns:
1 if the curve's orientation is clockwise
-1 if the curve's orientation is counter-clockwise
0 if unable to compute the curve's orientation
Example:
See Also:
ConvertCurveToPolyline(curve_id, angle_tolerance=5.0, tolerance=0.01, delete_input=False, min_edge_length=0, max_edge_length=0)
Convert curve to a polyline curve
Parameters:
curve_id = identifier of a curve object
angle_tolerance [opt] = The maximum angle between curve tangents at line
  endpoints. If omitted, the angle tolerance is set to 5.0.
tolerance[opt] = The distance tolerance at segment midpoints. If omitted,
  the tolerance is set to 0.01.
delete_input[opt] = Delete the curve object specified by curve_id. If
  omitted, curve_id will not be deleted.
min_edge_length[opt] = Minimum segment length
max_edge_length[opt] = Maximum segment length
Returns:
The new curve if successful.
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
polyline = rs.ConvertCurveToPolyline(obj)
if polyline: rs.SelectObject(polyline)
See Also:
CurveArcLengthPoint(curve_id, length, from_start=True)
Returns the point on the curve that is a specified arc length
    from the start of the curve.
Parameters:
curve_id = identifier of a curve object
length = The arc length from the start of the curve to evaluate.
from_start[opt] = If not specified or True, then the arc length point is
    calculated from the start of the curve. If False, the arc length
    point is calculated from the end of the curve.
Returns:
Point3d if successful
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
length = rs.CurveLength(obj)
point = rs.CurveArcLengthPoint(obj, length/3.0)
rs.AddPoint( point )
CurveArea(curve_id)
Returns area of closed planar curves. The results are based on the
    current drawing units.
Parameters:
curve_id = The identifier of a closed, planar curve object.
Returns:
List of area information. The list will contain the following information:
  Element  Description
  0        The area. If more than one curve was specified, the
           value will be the cumulative area.
  1        The absolute (+/-) error bound for the area.
Example:
import rhinocsriptsyntax as rs
id = rs.GetObject("Select a curve", rs.filter.curve)
if id:
props = rs.CurveArea(id)
if props:
print "The curve area is:", props[0]
CurveAreaCentroid(curve_id)
Returns area centroid of closed, planar curves. The results are based
    on the current drawing units.
Parameters:
curve_id = The identifier of a closed, planar curve object.
Returns:
Tuple of area centroid information containing the following information:
  Element  Description
  0        The 3d centroid point. If more than one curve was specified,
           the value will be the cumulative area.
  1        A 3d vector with the absolute (+/-) error bound for the area
           centroid.
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select a curve", rs.filter.curve)
if id:
props = rs.CurveAreaCentroid(id)
if props:
print "The curve area centroid is:", props[0]
CurveArrows(curve_id, arrow_style=None)
Enables or disables a curve object's annotation arrows
Parameters:
curve_id = identifier of a curve
arrow_style[opt] = the style of annotation arrow to be displayed
  0 = no arrows
  1 = display arrow at start of curve
  2 = display arrow at end of curve
  3 = display arrow at both start and end of curve
Returns:
if arrow_style is not specified, the current annotation arrow style
if arrow_style is specified, the previos arrow style
Example:
import rhinoscriptsyntax as rs
See Also:
CurveBooleanDifference(curve_id_0, curve_id_1)
Calculates the difference between two closed, planar curves and
    adds the results to the document. Note, curves must be coplanar.
Parameters:
curve_id_0 = identifier of the first curve object.
curve_id_1 = identifier of the second curve object.
Returns:
The identifiers of the new objects if successful, None on error.
Example:
import rhinoscriptsyntax as rs
curveA = rs.GetObject("Select first curve", rs.filter.curve)
curveB = rs.GetObject("Select second curve", rs.filter.curve)
arrResult = rs.CurveBooleanDifference(curveA, curveB)
if arrResult:
rs.DeleteObject( curveA )
rs.DeleteObject( curveB )
CurveBooleanIntersection(curve_id_0, curve_id_1)
Calculates the intersection of two closed, planar curves and adds
    the results to the document. Note, curves must be coplanar.
Parameters:
curve_id_0 = identifier of the first curve object.
curve_id_1 = identifier of the second curve object.
Returns:
The identifiers of the new objects.
Example:
import rhinoscriptsyntax as rs
curveA = rs.GetObject("Select first curve", rs.filter.curve)
curveB = rs.GetObject("Select second curve", rs.filter.curve)
result = rs.CurveBooleanIntersection(curveA, curveB)
if result:
rs.DeleteObject( curveA )
rs.DeleteObject( curveB )
CurveBooleanUnion(curve_id)
Calculate the union of two or more closed, planar curves and
    add the results to the document. Note, curves must be coplanar.
Parameters:
curve_id = list of two or more close planar curves identifiers
Returns:
The identifiers of the new objects.
Example:
import rhinoscriptsyntax as rs
curve_ids = rs.GetObjects("Select curves to union", rs.filter.curve)
if curve_ids and len(curve_ids)>1:
result = rs.CurveBooleanUnion(curve_ids)
if result: rs.DeleteObjects(curve_ids)
CurveBrepIntersect(curve_id, brep_id, tolerance=None)
Intersects a curve object with a brep object. Note, unlike the
    CurveSurfaceIntersection function, this function works on trimmed surfaces.
Parameters:
curve_id = identifier of a curve object
brep_id = identifier of a brep object
tolerance [opt] = distance tolerance at segment midpoints.
                  If omitted, the current absolute tolerance is used.
Returns:
List of identifiers for the newly created intersection curve and
point objects if successful. None on error.
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a curve", rs.filter.curve)
if curve:
brep = rs.GetObject("Select a brep", rs.filter.surface + rs.filter.polysurface)
if brep: rs.CurveBrepIntersect( curve, brep )
CurveClosestObject(curve_id, object_ids)
Returns the 3D point locations on two objects where they are closest to
    each other. Note, this function provides similar functionality to that of
    Rhino's ClosestPt command.
Parameters:
curve_id = identifier of the curve object to test
object_ids = list of identifiers of point cloud, curve, surface, or
  polysurface to test against
Returns:
Tuple containing the results of the closest point calculation.
The elements are as follows:
  0    The identifier of the closest object.
  1    The 3-D point that is closest to the closest object. 
  2    The 3-D point that is closest to the test curve.
Example:
import rhinoscriptsyntax as rs
filter = rs.filter.curve | rs.filter.pointcloud | rs.filter.surface | rs.filter.polysurface
objects = rs.GetObjects("Select target objects for closest point", filter)
if objects:
curve = rs.GetObject("Select curve")
if curve:
results = rs.CurveClosestObject(curve, objects)
if results:
print "Curve id:", results[0]
rs.AddPoint( results[1] )
rs.AddPoint( results[2] )
CurveClosestPoint(curve_id, test_point, segment_index=-1 )
Returns parameter of the point on a curve that is closest to a test point.
Parameters:
curve_id = identifier of a curve object
point = sampling point
segment_index [opt] = curve segment if curve_id identifies a polycurve
Returns:
The parameter of the closest point on the curve
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select a curve")
if id:
point = rs.GetPointOnCurve(id, "Pick a test point")
if point:
param = rs.CurveClosestPoint(id, point)
print "Curve parameter:", param
CurveContourPoints(curve_id, start_point, end_point, interval=None)
Returns the 3D point locations calculated by contouring a curve object.
Parameters:
curve_id = identifier of a curve object.
start_point = 3D starting point of a center line.
end_point = 3D ending point of a center line.
interval [opt] = The distance between contour curves. If omitted, 
the interval will be equal to the diagonal distance of the object's
bounding box divided by 50.
Returns:
A list of 3D points, one for each contour
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select curve", rs.filter.curve)
start_point = rs.GetPoint("Base point of center line")
end_point = rs.GetPoint("Endpoint of center line", start_point)
contour = rs.CurveContourPoints(obj, start_point, end_point)
if contour: rs.AddPoints(contour)
See Also:
CurveCurvature(curve_id, parameter)
Returns the curvature of a curve at a parameter. See the Rhino help for
    details on curve curvature
Parameters:
curve_id = identifier of the curve
parameter = parameter to evaluate
Returns:
Tuple of curvature information on success
  element 0 = point at specified parameter
  element 1 = tangent vector
  element 2 = center of radius of curvature
  element 3 = radius of curvature
  element 4 = curvature vector
None on failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
point = rs.GetPointOnCurve(obj, "Pick a test point")
if point:
param = rs.CurveClosestPoint(obj, point)
if param:
data = rs.CurveCurvature(obj, param)
if data:
print "Curve curvature evaluation at parameter", param, ":"
print " 3-D Point:", data[0]
print " 3-D Tangent:", data[1]
print " Center of radius of curvature:", data[2]
print " Radius of curvature:", data[3]
print " 3-D Curvature:", data[4]
See Also:
CurveCurveIntersection(curveA, curveB=None, tolerance=-1)
Calculates intersection of two curve objects.
Parameters:
curveA = identifier of the first curve object.
curveB = identifier of the second curve object. If omitted, then a
         self-intersection test will be performed on curveA.
tolerance [opt] = absolute tolerance in drawing units. If omitted,
                  the document's current absolute tolerance is used.
Returns:
List of tuples of intersection information if successful.
The list will contain one or more of the following elements:
  Element Type     Description
  [n][0]  Number   The intersection event type, either Point (1) or Overlap (2).
  [n][1]  Point3d  If the event type is Point (1), then the intersection point 
                   on the first curve. If the event type is Overlap (2), then
                   intersection start point on the first curve.
  [n][2]  Point3d  If the event type is Point (1), then the intersection point
                   on the first curve. If the event type is Overlap (2), then
                   intersection end point on the first curve.
  [n][3]  Point3d  If the event type is Point (1), then the intersection point 
                   on the second curve. If the event type is Overlap (2), then
                   intersection start point on the second curve.
  [n][4]  Point3d  If the event type is Point (1), then the intersection point
                   on the second curve. If the event type is Overlap (2), then
                   intersection end point on the second curve.
  [n][5]  Number   If the event type is Point (1), then the first curve parameter.
                   If the event type is Overlap (2), then the start value of the
                   first curve parameter range.
  [n][6]  Number   If the event type is Point (1), then the first curve parameter.
                   If the event type is Overlap (2), then the end value of the
                   first curve parameter range.
  [n][7]  Number   If the event type is Point (1), then the second curve parameter.
                   If the event type is Overlap (2), then the start value of the
                   second curve parameter range.
  [n][8]  Number   If the event type is Point (1), then the second curve parameter.
                   If the event type is Overlap (2), then the end value of the 
                   second curve parameter range.
Example:
import rhinoscriptsyntax as rs
def ccx():
if curve1 is None: return
curve2 = rs.GetObject("Select second curve", rs.filter.curve)
if curve2 is None: return
intersection_list = rs.CurveCurveIntersection(curve1, curve2)
if intersection_list is None:
print "Selected curves do not intersect."
return
for intersection in intersection_list:
if intersection[0] == 1:
print "Point"
print "Intersection point on first curve: ", intersection[1]
print "Intersection point on second curve: ", intersection[3]
print "First curve parameter: ", intersection[5]
print "Second curve parameter: ", intersection[7]
else:
print "Overlap"
print "Intersection start point on first curve: ", intersection[1]
print "Intersection end point on first curve: ", intersection[2]
print "Intersection start point on second curve: ", intersection[3]
print "Intersection end point on second curve: ", intersection[4]
print "First curve parameter range: ", intersection[5], " to ", intersection[6]
print "Second curve parameter range: ", intersection[7], " to ", intersection[8]
ccx()
CurveDegree(curve_id, segment_index=-1)
Returns the degree of a curve object.
Parameters:
curve_id = identifier of a curve object.
segment_index [opt] = the curve segment if curve_id identifies a polycurve.
Returns:
The degree of the curve if successful. None on error.
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
degree = rs.CurveDegree(obj)
print "Curve degree:", degree
See Also:
CurveDeviation(curve_a, curve_b)
Returns the minimum and maximum deviation between two curve objects
Parameters:
curve_a, curve_b = identifiers of two curves
Returns:
tuple of deviation information on success
  element 0 = curve_a parameter at maximum overlap distance point
  element 1 = curve_b parameter at maximum overlap distance point
  element 2 = maximum overlap distance
  element 3 = curve_a parameter at minimum overlap distance point
  element 4 = curve_b parameter at minimum overlap distance point
  element 5 = minimum distance between curves
None on error
Example:
import rhinoscriptsyntax as rs
curveA = rs.GetObject("Select first curve to test", rs.filter.curve)
curveB = rs.GetObject("Select second curve to test", rs.filter.curve)
deviation = rs.CurveDeviation(curveA, curveB)
if deviation:
print "Minimum deviation =", deviation[5]
print "Maximum deviation =", deviation[2]
CurveDim(curve_id, segment_index=-1)
Returns the dimension of a curve object
Parameters:
curve_id = identifier of a curve object.
segment_index [opt] = the curve segment if curve_id identifies a polycurve.
Returns:
The dimension of the curve if successful. None on error.
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a curve")
if rs.IsCurve(curve):
print "Curve dimension =", rs.CurveDim(curve)
CurveDirectionsMatch(curve_id_0, curve_id_1)
Tests if two curve objects are generally in the same direction or if they
    would be more in the same direction if one of them were flipped. When testing
    curve directions, both curves must be either open or closed - you cannot test
    one open curve and one closed curve.
Parameters:
curve_id_0 = identifier of first curve object
curve_id_1 = identifier of second curve object
Returns:
True if the curve directions match, otherwise False.
Example:
import rhinoscriptsyntax as rs
curve1 = rs.GetObject("Select first curve to compare", rs.filter.curve)
curve2 = rs.GetObject("Select second curve to compare", rs.filter.curve)
if rs.CurveDirectionsMatch(curve1, curve2):
print "Curves are in the same direction"
else:
print "Curve are not in the same direction"
See Also:
CurveDiscontinuity(curve_id, style)
Search for a derivatitive, tangent, or curvature discontinuity in
    a curve object.
Parameters:
curve_id = identifier of curve object
style = The type of continuity to test for. The types of
    continuity are as follows:
    Value    Description
    1        C0 - Continuous function
    2        C1 - Continuous first derivative
    3        C2 - Continuous first and second derivative
    4        G1 - Continuous unit tangent
    5        G2 - Continuous unit tangent and curvature
Returns:
List 3D points where the curve is discontinuous
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a curve", rs.filter.curve)
if rs.IsCurve(curve):
points = rs.CurveDiscontinuity(curve, 2)
if points: rs.AddPoints( points )
See Also:
CurveDomain(curve_id, segment_index=-1)
Returns the domain of a curve object.
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve.
Returns:
the domain of the curve if successful, otherwise None
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
domain = rs.CurveDomain(obj)
print "Curve domain:", domain[0], "to", domain[1]
See Also:
CurveEditPoints(curve_id, return_parameters=False, segment_index=-1)
Returns the edit, or Greville, points of a curve object. 
    For each curve control point, there is a corresponding edit point.
Parameters:
curve_id = identifier of the curve object
return_parameters[opt] = if True, return as a list of curve parameters.
  If False, return as a list of 3d points
segment_index[opt] = the curve segment is curve_id identifies a polycurve
Returns:
curve parameters of 3d points on success
None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
points = rs.CurveEditPoints(obj)
CurveEndPoint(curve_id, segment_index=-1)
Returns the end point of a curve object
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
The 3-D end point of the curve if successful.
Example:
import rhinoscriptsyntax as rs
object = rs.GetObject("Select a curve")
if rs.IsCurve(object):
point = rs.CurveEndPoint(object)
rs.AddPoint(point)
CurveFilletPoints(curve_id_0, curve_id_1, radius=1.0, base_point_0=None, base_point_1=None, return_points=True)
Find points at which to cut a pair of curves so that a fillet of a
    specified radius fits. A fillet point is a pair of points (point0, point1)
    such that there is a circle of radius tangent to curve curve0 at point0 and
    tangent to curve curve1 at point1. Of all possible fillet points, this
    function returns the one which is the closest to the base point base_point_0,
    base_point_1. Distance from the base point is measured by the sum of arc
    lengths along the two curves.
Parameters:
curve_id_0 = identifier of the first curve object.
curve_id_1 = identifier of the second curve object.
radius [opt] = The fillet radius. If omitted, a radius
               of 1.0 is specified.
base_point_0 [opt] = The base point on the first curve.
               If omitted, the starting point of the curve is used.
base_point_1 [opt] = The base point on the second curve. If omitted,
               the starting point of the curve is used.
return_points [opt] = If True (Default), then fillet points are
               returned. Otherwise, a fillet curve is created and
               it's identifier is returned.
Returns:
If return_points is True, then a list of point and vector values
if successful. The list elements are as follows:
      
0    A point on the first curve at which to cut (arrPoint0).
1    A point on the second curve at which to cut (arrPoint1).
2    The fillet plane's origin (3-D point). This point is also
     the center point of the fillet
3    The fillet plane's X axis (3-D vector).
4    The fillet plane's Y axis (3-D vector).
5    The fillet plane's Z axis (3-D vector).
      
If return_points is False, then the identifier of the fillet curve
if successful.
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
curve0 = rs.AddLine([0,0,0], [5,1,0])
curve1 = rs.AddLine([0,0,0], [1,5,0])
fillet = rs.CurveFilletPoints(curve0, curve1)
if fillet:
rs.AddPoint( fillet[0] )
rs.AddPoint( fillet[1] )
rs.AddPoint( fillet[2] )
See Also:
CurveFrame(curve_id, parameter, segment_index=-1)
Returns the plane at a parameter of a curve. The plane is based on the
    tangent and curvature vectors at a parameter.
Parameters:
curve_id = identifier of the curve object.
parameter = parameter to evaluate.
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
The plane at the specified parameter if successful. 
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
curve = rs.GetCurveObject("Select a curve")
if curve:
plane = rs.CurveFrame(curve[0], curve[4])
rs.AddPlaneSurface(plane, 5.0, 3.0)
See Also:
CurveKnotCount(curve_id, segment_index=-1)
Returns the knot count of a curve object.
Parameters:
curve_id = identifier of the curve object.
segment_index [opt] = the curve segment if curve_id identifies a polycurve.
Returns:
The number of knots if successful.
None if not successful or on error.
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
count = rs.CurveKnotCount(obj)
print "Curve knot count:", count
See Also:
CurveKnots(curve_id, segment_index=-1)
Returns the knots, or knot vector, of a curve object
Parameters:
curve_id = identifier of the curve object.
segment_index [opt] = the curve segment if curve_id identifies a polycurve.
Returns:
knot values if successful.
None if not successful or on error.
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
knots = rs.CurveKnots(obj)
if knots:
CurveLength(curve_id, segment_index=-1, sub_domain=None)
Returns the length of a curve object.
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
sub_domain [opt] = list of two numbers identifing the sub-domain of the
    curve on which the calculation will be performed. The two parameters
    (sub-domain) must be non-decreasing. If omitted, the length of the
    entire curve is returned.
Returns:
The length of the curve if successful.
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
object = rs.GetObject("Select a curve")
if rs.IsCurve(object):
length = rs.CurveLength(object)
print "Curve length:", length
See Also:
CurveMidPoint(curve_id, segment_index=-1)
Returns the mid point of a curve object.
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
The 3D mid point of the curve if successful.
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
object = rs.GetObject("Select a curve")
if rs.IsCurve(object):
point = rs.CurveMidPoint(pbject)
rs.AddPoint( point )
CurveNormal(curve_id, segment_index=-1)
Returns the normal direction of the plane in which a planar curve object lies.
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
The 3D normal vector if sucessful.
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
object = rs.GetObject("Select a planar curve")
if rs.IsCurve(object) and rs.IsCurvePlanar(object):
normal = rs.CurveNormal(object)
if normal: print "Curve Normal:", normal
CurveNormalizedParameter(curve_id, parameter)
Converts a curve parameter to a normalized curve parameter;
    one that ranges between 0-1
Parameters:
curve_id = identifier of the curve object
parameter = the curve parameter to convert
Returns:
normalized curve parameter
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select curve")
if rs.IsCurve(obj):
domain = rs.CurveDomain(obj)
parameter = (domain[0]+domain[1])/2.0
print "Curve parameter:", parameter
normalized = rs.CurveNormalizedParameter(obj, parameter)
print "Normalized parameter:", normalized
CurveParameter(curve_id, parameter)
Converts a normalized curve parameter to a curve parameter;
    one within the curve's domain
Parameters:
curve_id = identifier of the curve object
parameter = the normalized curve parameter to convert
Returns:
curve parameter
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select curve")
if rs.IsCurve(obj):
normalized = 0.5
print "Normalized parameter:", normalized
parameter = rs.CurveParameter(obj, normalized)
print "Curve parameter:", parameter
CurvePerpFrame(curve_id, parameter)
Returns the perpendicular plane at a parameter of a curve. The result
    is relatively parallel (zero-twisting) plane
Parameters:
curve_id = identifier of the curve object
parameter = parameter to evaluate
Returns:
Plane on success
None on error
Example:
import rhinoscriptsyntax as rs
crv = rs.GetCurveObject("Select a curve")
if crv:
plane = rs.CurvePerpFrame(crv[0], crv[4])
rs.AddPlaneSurface( plane, 1, 1 )
See Also:
CurvePlane(curve_id, segment_index=-1)
Returns the plane in which a planar curve lies. Note, this function works
    only on planar curves.
Parameters:
curve_id = identifier of the curve object
segment_index[opt] = the curve segment if curve_id identifies a polycurve
Returns:
The plane in which the curve lies if successful.
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a curve", rs.filter.curve)
if rs.IsCurvePlanar(curve):
plane = rs.CurvePlane(curve)
rs.ViewCPlane(None, plane)
CurvePointCount(curve_id, segment_index=-1)
Returns the control points count of a curve object.
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
Number of control points if successful.
None if not successful
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
count = rs.CurvePointCount(obj)
print "Curve point count:", count
See Also:
CurvePoints(curve_id, segment_index=-1)
Returns the control points, or control vertices, of a curve object.
    If the curve is a rational NURBS curve, the euclidean control vertices
    are returned.
Parameters:
curve_id = the object's identifier
segment_index [opt] = if curve_id identifies a polycurve object, then intIndex identifies the curve segment of the polycurve to query
Returns:
the control points, or control vertices, of a curve object
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
points = rs.CurvePoints(obj)
if points: [rs.AddPoint(pt) for pt in points]
CurveRadius(curve_id, test_point, segment_index=-1)
Returns the radius of curvature at a point on a curve.
Parameters:
curve_id = identifier of the curve object
test_point = sampling point
segment_index[opt] = the curve segment if curve_id identifies a polycurve
Returns:
The radius of curvature at the point on the curve if successful.
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
point = rs.GetPointOnCurve(obj, "Pick a test point")
if point:
radius = rs.CurveRadius(obj, point)
print "Radius of curvature:", radius
See Also:
CurveSeam(curve_id, parameter)
Adjusts the seam, or start/end, point of a closed curve.
Parameters:
curve_id = identifier of the curve object
parameter = The parameter of the new start/end point. 
            Note, if successful, the resulting curve's
            domain will start at dblParameter.
Returns:
True or False indicating success or failure.
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select closed curve", rs.filter.curve)
if rs.IsCurveClosed(obj):
domain = rs.CurveDomain(obj)
parameter = (domain[0] + domain[1])/2.0
rs.CurveSeam( obj, parameter )
CurveStartPoint(curve_id, segment_index=-1, point=None)
Returns the start point of a curve object
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
point [opt] = new start point
Returns:
The 3D starting point of the curve if successful.
Example:
import rhinoscriptsyntax as rs
object = rs.GetObject("Select a curve")
if rs.IsCurve(object):
point = rs.CurveStartPoint(object)
rs.AddPoint(point)
CurveSurfaceIntersection(curve_id, surface_id, tolerance=-1, angle_tolerance=-1)
Calculates intersection of a curve object with a surface object.
    Note, this function works on the untrimmed portion of the surface.
Parameters:
curve_id = The identifier of the first curve object.
surface_id = The identifier of the second curve object. If omitted,
    the a self-intersection test will be performed on curve.
tolerance [opt] = The absolute tolerance in drawing units. If omitted, 
    the document's current absolute tolerance is used.
angle_tolerance [opt] = angle tolerance in degrees. The angle
    tolerance is used to determine when the curve is tangent to the
    surface. If omitted, the document's current angle tolerance is used.
Returns:
Two-dimensional list of intersection information if successful.
The list will contain one or more of the following elements:
  Element Type     Description
  (n, 0)  Number   The intersection event type, either Point(1) or Overlap(2).
  (n, 1)  Point3d  If the event type is Point(1), then the intersection point 
                   on the first curve. If the event type is Overlap(2), then
                   intersection start point on the first curve.
  (n, 2)  Point3d  If the event type is Point(1), then the intersection point
                   on the first curve. If the event type is Overlap(2), then
                   intersection end point on the first curve.
  (n, 3)  Point3d  If the event type is Point(1), then the intersection point 
                   on the second curve. If the event type is Overlap(2), then
                   intersection start point on the surface.
  (n, 4)  Point3d  If the event type is Point(1), then the intersection point
                   on the second curve. If the event type is Overlap(2), then
                   intersection end point on the surface.
  (n, 5)  Number   If the event type is Point(1), then the first curve parameter.
                   If the event type is Overlap(2), then the start value of the
                   first curve parameter range.
  (n, 6)  Number   If the event type is Point(1), then the first curve parameter.
                   If the event type is Overlap(2), then the end value of the
                   curve parameter range.
  (n, 7)  Number   If the event type is Point(1), then the U surface parameter.
                   If the event type is Overlap(2), then the U surface parameter
                   for curve at (n, 5).
  (n, 8)  Number   If the event type is Point(1), then the V surface parameter.
                   If the event type is Overlap(2), then the V surface parameter
                   for curve at (n, 5).
  (n, 9)  Number   If the event type is Point(1), then the U surface parameter.
                   If the event type is Overlap(2), then the U surface parameter
                   for curve at (n, 6).
  (n, 10) Number   If the event type is Point(1), then the V surface parameter.
                   If the event type is Overlap(2), then the V surface parameter
                   for curve at (n, 6).
Example:
import rhinoscriptsyntax as rs
def csx():
curve = rs.GetObject("Select curve", rs.filter.curve)
if curve is None: return
surface = rs.GetObject("Select surface", rs.filter.surface)
if surface is None: return
intersection_list = rs.CurveSurfaceIntersection(curve, surface)
if intersection_list is None:
print "Curve and surface do not intersect."
return
for intersection in intersection_list:
if intersection[0]==1:
print "Point"
print "Intersection point on curve:", intersection[1]
print "Intersection point on surface:", intersection[3]
print "Curve parameter:", intersection[5]
print "Surface parameter:", intersection[7], ",", intersection[8]
else:
print "Overlap"
print "Intersection start point on curve:", intersection[1]
print "Intersection end point on curve:", intersection[2]
print "Intersection start point on surface:", intersection[3]
print "Intersection end point on surface:", intersection[4]
print "Curve parameter range:", intersection[5], "to", intersection[6]
print "Surface parameter range:", intersection[7], ",", intersection[8], "to", intersection[9], ",", intersection[10]
csx()
CurveTangent(curve_id, parameter, segment_index=-1)
Returns a 3D vector that is the tangent to a curve at a parameter.
Parameters:
curve_id = identifier of the curve object
parameter = parameter to evaluate
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
A 3D vector if successful.
None on error.
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve", rs.filter.curve)
if obj:
point = rs.GetPointOnCurve(obj)
if point:
param = rs.CurveClosestPoint(obj, point)
normal = rs.CurveTangent(obj, param)
print normal
CurveWeights(curve_id, segment_index=-1)
Returns list of weights that are assigned to the control points of a curve
Parameters:
curve_id = identifier of the curve object
segment_index[opt] = the curve segment if curve_id identifies a polycurve
Returns:
The weight values of the curve if successful.
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
weights = rs.CurveWeights(obj)
if weights:
for weight in weights:
print "Curve control point weight value:", weight
See Also:
DivideCurve(curve_id, segments, create_points=False, return_points=True)
Divides a curve object into a specified number of segments.
Parameters:
curve_id = identifier of the curve object
segments = The number of segments.
create_points [opt] = Create the division points. If omitted or False,
    points are not created.
return_points [opt] = If omitted or True, points are returned.
    If False, then a list of curve parameters are returned.
Returns:
If return_points is not specified or True, then a list containing 3D
division points.
If return_points is False, then an array containing division curve
parameters.
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if obj:
points = rs.DivideCurve(obj, 4)
DivideCurveEquidistant(curve_id, distance, create_points=False, return_points=True)
Divides a curve such that the linear distance between the points is equal.
Parameters:
curve_id = the object's identifier
distance = linear distance between division points
create_points[opt] = create the division points
return_points[opt] = If True, return a list of points.
    If False, return a list of curve parameters
Returns:
A list of points or curve parameters based on the value of return_points
None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve", rs.filter.curve)
if obj:
points = rs.DivideCurveEquidistant(obj, 4, True)
DivideCurveLength(curve_id, length, create_points=False, return_points=True)
Divides a curve object into segments of a specified length.
Parameters:
curve_id = identifier of the curve object
length = The length of each segment.
create_points [opt] = Create the division points. If omitted or False,
    points are not created.
return_points [opt] = If omitted or True, points are returned.
    If False, then a list of curve parameters are returned.
Returns:
If return_points is not specified or True, then a list containing 3D
division points if successful.
If return_points is False, then an array containing division curve
parameters if successful.
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
length = rs.CurveLength(obj) / 4
points = rs.DivideCurveLength(obj, length)
for point in points: rs.AddPoint(point)
EllipseCenterPoint(curve_id)
Returns the center point of an elliptical-shaped curve object.
Parameters:
curve_id = identifier of the curve object.
Returns:
The 3D center point of the ellipse if successful.
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select ellipse")
if rs.IsEllipse(obj):
point = rs.EllipseCenterPoint(obj)
rs.AddPoint( point )
EllipseQuadPoints(curve_id)
Returns the quadrant points of an elliptical-shaped curve object.
Parameters:
curve_id = identifier of the curve object.
Returns:
Four 3D points identifying the quadrants of the ellipse
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select ellipse")
if rs.IsEllipse(obj):
rs.AddPoints( rs.EllipseQuadPoints(obj) )
EvaluateCurve(curve_id, t, segment_index=-1)
Evaluates a curve at a parameter and returns a 3D point
Parameters:
curve_id = identifier of the curve object
t = the parameter to evaluate
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
a 3-D point if successful, otherwise None
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
domain = rs.CurveDomain(obj)
t = domain[1]/2.0
point = rs.EvaluateCurve(obj, t)
rs.AddPoint( point )
ExplodeCurves(curve_ids, delete_input=False)
Explodes, or un-joins, one curves. Polycurves will be exploded into curve
    segments. Polylines will be exploded into line segments. ExplodeCurves will
    return the curves in topological order.
Parameters:
curve_ids = the curve object(s) to explode.
delete_input[opt] = Delete input objects after exploding.
Returns:
List identifying the newly created curve objects
Example:
import rhinoscriptsyntax as rs
crv = rs.GetObject("Select curve to explode", rs.filter.curve)
if rs.IsCurve(crv): rs.ExplodeCurves(crv)
ExtendCurve(curve_id, extension_type, side, boundary_object_ids)
Extends a non-closed curve object by a line, arc, or smooth extension
    until it intersects a collection of objects.
Parameters:
curve_id: identifier of curve to extend
extension_type: 0 = line, 1 = arc, 2 = smooth
side: 0=extend from the start of the curve, 1=extend from the end of the curve
boundary_object_ids: curve, surface, and polysurface objects to extend to
Returns:
The identifier of the new object if successful.
None if not successful
Example:
import rhinoscriptsyntax as rs
filter = rs.filter.curve | rs.filter.surface | rs.filter.polysurface
objects = rs.GetObjects("Select boundary objects", filter)
if objects:
curve = rs.GetObject("Select curve to extend", rs.filter.curve)
ExtendCurveLength(curve_id, extension_type, side, length)
Extends a non-closed curve by a line, arc, or smooth extension for a
    specified distance
Parameters:
curve_id: curve to extend
extension_type: 0 = line, 1 = arc, 2 = smooth
side: 0=extend from start of the curve, 1=extend from end of the curve, 2=Extend from both ends
length: distance to extend
Returns:
The identifier of the new object
None if not successful
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select curve to extend", rs.filter.curve)
if curve:
length = rs.GetReal("Length to extend", 3.0)
ExtendCurvePoint(curve_id, side, point)
Extends a non-closed curve by smooth extension to a point
Parameters:
curve_id: curve to extend
side: 0=extend from start of the curve, 1=extend from end of the curve
point: point to extend to
Returns:
The identifier of the new object if successful.
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select curve to extend", rs.filter.curve)
if curve:
point = rs.GetPoint("Point to extend to")
if point: rs.ExtendCurvePoint(curve, 1, point)
FairCurve(curve_id, tolerance=1.0)
Fairs a curve. Fair works best on degree 3 (cubic) curves. Fair attempts
    to remove large curvature variations while limiting the geometry changes to
    be no more than the specified tolerance. Sometimes several applications of
    this method are necessary to remove nasty curvature problems.
Parameters:
curve_id = curve to fair
tolerance[opt] = fairing tolerance
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
curves = rs.GetObjects("Select curves to fair", rs.filter.curve)
if curves:
[rs.FairCurve(curve) for curve in curves]
See Also:
FitCurve(curve_id, degree=3, distance_tolerance=-1, angle_tolerance=-1)
Reduces number of curve control points while maintaining the curve's same
    general shape. Use this function for replacing curves with many control
    points. For more information, see the Rhino help for the FitCrv command.
Parameters:
curve_id = Identifier of the curve object
degree [opt] = The curve degree, which must be greater than 1.
               The default is 3.
distance_tolerance [opt] = The fitting tolerance. If distance_tolerance
    is not specified or <= 0.0, the document absolute tolerance is used.
angle_tolerance [opt] = The kink smoothing tolerance in degrees. If
    angle_tolerance is 0.0, all kinks are smoothed. If angle_tolerance
    is > 0.0, kinks smaller than angle_tolerance are smoothed. If
    angle_tolerance is not specified or < 0.0, the document angle
    tolerance is used for the kink smoothing.
Returns:
The identifier of the new object
None if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
oldCurve = rs.GetObject("Select curve to fit", rs.filter.curve)
if oldCurve:
newCurve = rs.FitCurve(oldCurve)
if newCurve: rs.DeleteObject(oldCurve)
See Also:
InsertCurveKnot(curve_id, parameter, symmetrical=False )
Inserts a knot into a curve object
Parameters:
curve_id = identifier of the curve object
parameter = parameter on the curve
symmetrical[opt] = if True, then knots are added on both sides of
    the center of the curve
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select curve for knot insertion", rs.filter.curve)
if obj:
point = rs.GetPointOnCurve(obj, "Point on curve to add knot")
if point:
parameter = rs.CurveClosestPoint(obj, point)
rs.InsertCurveKnot( obj, parameter )
IsArc(curve_id, segment_index=-1)
Verifies an object is an arc curve
Parameters:
curve_id = Identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select an arc")
if rs.IsArc(obj):
print "The object is an arc."
else:
print "The object is not an arc."
IsCircle(curve_id, tolerance=None)
Verifies an object is a circle curve
Parameters:
curve_id = Identifier of the curve object
tolerance [opt] = If the curve is not a circle, then the tolerance used
  to determine whether or not the NURBS form of the curve has the
  properties of a circle. If omitted, Rhino's internal zero tolerance is used
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a circle")
if rs.IsCircle(obj):
print "The object is a circle."
else:
print "The object is not a circle."
IsCurve(object_id)
Verifies an object is a curve
Parameters:
object_id = the object's identifier
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
object = rs.GetObject("Select a curve")
if rs.IsCurve(object):
else:
print "The object is not a curve."
IsCurveClosable(curve_id, tolerance=None)
Decide if it makes sense to close off the curve by moving the end point
    to the start point based on start-end gap size and length of curve as
    approximated by chord defined by 6 points
Parameters:
curve_id = identifier of the curve object
tolerance[opt] = maximum allowable distance between start point and end
  point. If omitted, the document's current absolute tolerance is used
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
crv = rs.GetObject("Select curve", rs.filter.curve)
if not rs.IsCurveClosed(crv) and rs.IsCurveClosable(crv):
IsCurveClosed(object_id)
Verifies an object is a closed curve object
Parameters:
object_id = the object's identifier
Returns:
True if succussful otherwise False.  None on error
Example:
import rhinoscriptsyntax as rs
object = rs.GetObject("Select a curve")
if rs.IsCurve(object):
if rs.IsCurveClosed(oObject):
print "The object is a closed curve."
else:
print "The object is not a closed curve."
else:
print "The object is not a curve."
IsCurveInPlane(object_id, plane=None)
Test a curve to see if it lies in a specific plane
Parameters:
object_id = the object's identifier
plane[opt] = plane to test. If omitted, the active construction plane is used
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj) and rs.IsCurvePlanar(obj):
if rs.IsCurveInPlane(obj):
print "The curve lies in the current cplane."
else:
print "The curve does not lie in the current cplane."
else:
print "The object is not a planar curve."
IsCurveLinear(object_id, segment_index=-1)
Verifies an object is a linear curve
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select a curve")
if rs.IsCurve(id):
if rs.IsCurveLinear(id):
print "The object is a linear curve."
else:
print "The object is not a linear curve."
else:
print "The object is not a curve."
IsCurvePeriodic(curve_id, segment_index=-1)
Verifies an object is a periodic curve object
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
if rs.IsCurvePeriodic(obj):
print "The object is a periodic curve."
else:
print "The object is not a periodic curve."
else:
print "The object is not a curve."
IsCurvePlanar(curve_id, segment_index=-1)
Verifies an object is a planar curve
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
if rs.IsCurvePlanar(obj):
print "The object is a planar curve."
else:
print "The object is not a planar curve."
else:
print "The object is not a curve."
IsCurveRational(curve_id, segment_index=-1)
Verifies an object is a rational NURBS curve
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
if rs.IsCurveRational(obj):
print "The object is a rational NURBS curve."
else:
print "The object is not a rational NURBS curve."
else:
print "The object is not a curve."
IsEllipse(object_id, segment_index=-1)
Verifies an object is an elliptical-shaped curve
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select an ellipse")
if rs.IsEllipse(obj):
print "The object is an ellipse."
else:
print "The object is not an ellipse."
IsLine(object_id, segment_index=-1)
Verifies an object is a line curve
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a line")
if rs.IsLine(obj):
print "The object is a line."
else:
print "The object is not a line."
See Also:
IsPointOnCurve(object_id, point, segment_index=-1)
Verifies that a point is on a curve
Parameters:
curve_id = identifier of the curve object
point = the test point
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve")
if rs.IsCurve(obj):
point = rs.GetPoint("Pick a test point")
if point:
if rs.IsPointOnCurve(obj, point):
print "The point is on the curve"
else:
print "The point is not on the curve"
See Also:
IsPolyCurve(object_id, segment_index=-1)
Verifies an object is a PolyCurve curve
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a polycurve")
if rs.IsPolyCurve(obj):
print "The object is a polycurve."
else:
print "The object is not a polycurve."
See Also:
IsPolyline( object_id, segment_index=-1 )
Verifies an object is a Polyline curve object
Parameters:
curve_id = identifier of the curve object
segment_index [opt] = the curve segment if curve_id identifies a polycurve
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a polyline")
if rs.IsPolyline(obj):
print "The object is a polyline."
else:
print "The object is not a polyline."
JoinCurves(object_ids, delete_input=False, tolerance=None)
Joins multiple curves together to form one or more curves or polycurves
Parameters:
object_ids = list of multiple curves
delete_input[opt] = delete input objects after joining
tolerance[opt] = join tolerance. If omitted, 2.1 * document absolute
    tolerance is used
Returns:
List of Guids representing the new curves
Example:
import rhinoscriptsyntax as rs
objs = rs.GetObjects("Select curves to join", rs.filter.curve)
if objs: rs.JoinCurves(objs)
LineFitFromPoints(points)
Returns a line that was fit through an array of 3D points
Parameters:
points = a list of at least two 3D points
Returns:
line on success
Example:
import rhinoscriptsyntax as rs
points = rs.GetPoints()
if points and len(points)>1:
line=rs.LineFitFromPoints(points)
if line: rs.AddLine(line.From, line.To)
MakeCurveNonPeriodic(curve_id, delete_input=False)
Makes a periodic curve non-periodic. Non-periodic curves can develop
    kinks when deformed
Parameters:
curve_id = identifier of the curve object
delete_input[opt] = delete the input curve
Returns:
id of the new or modified curve if successful
None on error
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a curve", rs.filter.curve)
See Also:
MeanCurve(curve0, curve1, tolerance=None)
Creates an average curve from two curves
Parameters:
curve0, curve1 = identifiers of two curves
tolerance[opt] = angle tolerance used to match kinks between curves
Returns:
id of the new or modified curve if successful
None on error
Example:
import rhinoscriptsyntax as rs
curve0 = rs.GetObject("Select the first curve", rs.filter.curve)
curve1 = rs.GetObject("Select the second curve", rs.filter.curve)
See Also:
MeshPolyline(polyline_id)
Creates a polygon mesh object based on a closed polyline curve object.
    The created mesh object is added to the document
Parameters:
polyline_id = identifier of the polyline curve object
Returns:
identifier of the new mesh object
None on error
Example:
import rhinoscriptsyntax as rs
polyline = rs.GetObject("Select a polyline", rs.filter.curve)
if polyline:
if rs.IsPolyline(polyline) and rs.IsCurveClosed(polyline):
rs.MeshPolyline( polyline )
OffsetCurve(object_id, direction, distance, normal=None, style=1)
Offsets a curve by a distance. The offset curve will be added to Rhino
Parameters:
object_id = identifier of a curve object
direction = point describing direction of the offset
distance = distance of the offset
normal[opt] = normal of the plane in which the offset will occur.
    If omitted, the normal of the active construction plane will be used
style[opt] = the corner style
    0 = None, 1 = Sharp, 2 = Round, 3 = Smooth, 4 = Chamfer
Returns:
List of ids for the new curves on success
None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve", rs.filter.curve)
if rs.IsCurve(obj):
rs.OffsetCurve( obj, [0,0,0], 1.0 )
OffsetCurveOnSurface(curve_id, surface_id, distance_or_parameter)
Offset a curve on a surface. The source curve must lie on the surface.
    The offset curve or curves will be added to Rhino
Parameters:
curve_id, surface_id = curve and surface identifiers
distance_or_parameter = If a single number is passed, then this is the
  distance of the offset. Based on the curve's direction, a positive value
  will offset to the left and a negative value will offset to the right.
  If a tuple of two values is passed, this is interpreted as the surface
  U,V parameter that the curve will be offset through
Returns:
Identifiers of the new curves if successful
None on error
Example:
import rhinoscriptsyntax as rs
def TestOffset():
curve = rs.GetObject("Select curve on a surface", rs.filter.curve)
if curve is None: return False
surface = rs.GetObject("Select base surface", rs.filter.surface)
if surface is None: return False
point = rc.GetPointOnSurface( surface, "Through point" )
if point is None: return False
parameter = rs.SurfaceClosestPoint(surface, point)
rc = rs.OffsetCurveOnSurface( curve, surface, parameter )
return rc is not None
      
TestOffset()
PlanarClosedCurveContainment(curve_a, curve_b, plane=None, tolerance=None)
Determines the relationship between the regions bounded by two coplanar
    simple closed curves
Parameters:
curve_a, curve_b = identifiers of two planar, closed curves
plane[opt] = test plane. If omitted, the currently active construction
  plane is used
tolerance[opt] = if omitted, the document absolute tolerance is used
Returns:
a number identifying the relationship if successful
  0 = the regions bounded by the curves are disjoint
  1 = the two curves intersect
  2 = the region bounded by curve_a is inside of curve_b
  3 = the region bounded by curve_b is inside of curve_a
None if not successful
Example:
import rhinoscriptsyntax as rs
curve1 = rs.GetObject("Select first curve", rs.filter.curve )
curve2 = rs.GetObject("Select second curve", rs.filter.curve )
if rs.IsCurvePlanar(curve1) and rs.IsCurvePlanar(curve2):
if rs.IsCurveInPlane(curve1) and rs.IsCurveInPlane(curve2):
result = rs.PlanarClosedCurveContainment(curve1, curve2)
PlanarCurveCollision(curve_a, curve_b, plane=None, tolerance=None)
Determines if two coplanar curves intersect
Parameters:
curve_a, curve_b = identifiers of two planar curves
plane[opt] = test plane. If omitted, the currently active construction
  plane is used
tolerance[opt] = if omitted, the document absolute tolerance is used
Returns:
True if the curves intersect; otherwise False
Example:
import rhinoscriptsyntax as rs
curve1 = rs.GetObject("Select first curve")
curve2 = rs.GetObject("Select second curve")
print "The coplanar curves intersect."
else:
print "The coplanar curves do not intersect."
PointInPlanarClosedCurve(point, curve, plane=None, tolerance=None)
Determines if a point is inside of a closed curve, on a closed curve, or
    outside of a closed curve
Parameters:
point = text point
curve = identifier of a curve object
plane[opt] = plane containing the closed curve and point. If omitted,
    the currently active construction plane is used
tolerance[opt] = it omitted, the document abosulte tolerance is used
Returns:
number identifying the result if successful
    0 = point is outside of the curve
    1 = point is inside of the curve
    2 = point in on the curve
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a planar, closed curve", rs.filter.curve)
if rs.IsCurveClosed(curve) and rs.IsCurvePlanar(curve):
point = rs.GetPoint("Pick a point")
if point:
result = rs.PointInPlanarClosedCurve(point, curve)
PolyCurveCount(curve_id, segment_index=-1)
Returns the number of curve segments that make up a polycurve
Parameters:
curve_id = the object's identifier
segment_index [opt] = if curve_id identifies a polycurve object, then segment_index identifies the curve segment of the polycurve to query.
Returns:
the number of curve segments in a polycurve if successful, otherwise None
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a polycurve")
if rs.IsPolyCurve(obj):
count = rs.PolyCurveCount(obj)
if count: print "The polycurve contains", count, " curves."
See Also:
PolylineVertices(curve_id, segment_index=-1)
Returns the vertices of a polyline curve on success
Parameters:
curve_id = the object's identifier
segment_index [opt] = if curve_id identifies a polycurve object, then segment_index identifies the curve segment of the polycurve to query.
Returns:
an  array of Point3d vertex points if successful, otherwise None
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a polyline")
if rs.IsPolyline(obj):
points = rs.PolylineVertices(obj)
if points:
for point in points: rs.AddPoint(point)
ProjectCurveToMesh(curve_ids, mesh_ids, direction)
Projects one or more curves onto one or more surfaces or meshes
Parameters:
curve_ids = identifiers of curves to project
mesh_ids = identifiers of meshes to project onto
direction = projection direction
Returns:
list of identifiers
Example:
import rhinoscriptsyntax as rs
mesh = rs.GetObject("Select mesh to project onto", rs.filter.mesh)
curve= rs.GetObject("Select curve to project", rs.filter.curve)
#Project down...
results = rs.ProjectCurveToMesh(curve, mesh, (0,0,-1))
ProjectCurveToSurface(curve_ids, surface_ids, direction)
Projects one or more curves onto one or more surfaces or polysurfaces
Parameters:
curve_ids = identifiers of curves to project
surface_ids = identifiers of surfaces to project onto
direction = projection direction
Returns:
list of identifiers
Example:
import rhinoscriptsyntax as rs
surface = rs.GetObject("Select surface to project onto", rs.filter.surface)
curve = rs.GetObject("Select curve to project", rs.filter.curve)
# Project down...
results = rs.ProjectCurveToSurface(curve, surface, (0,0,-1))
RebuildCurve(curve_id, degree=3, point_count=10)
Rebuilds a curve to a given degree and control point count. For more
    information, see the Rhino help for the Rebuild command.
Parameters:
curve_id = identifier of the curve object
degree[opt] = new degree (must be greater than 0)
point_count [opt] = new point count, which must be bigger than degree.
Returns:
True of False indicating success or failure
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select curve to rebuild", rs.filter.curve)
if curve: rs.RebuildCurve(curve, 3, 10)
See Also:
ReverseCurve(curve_id)
Reverses the direction of a curve object. Same as Rhino's Dir command
Parameters:
curve_id = identifier of the curve object
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a curve to reverse")
if rs.IsCurve(curve): rs.ReverseCurve(curve)
SimplifyCurve(curve_id, flags=0)
Replace a curve with a geometrically equivalent polycurve.
    
    The polycurve will have the following properties:
     - All the polycurve segments are lines, polylines, arcs, or NURBS curves.
     - The NURBS curves segments do not have fully multiple interior knots.
     - Rational NURBS curves do not have constant weights.
     - Any segment for which IsCurveLinear or IsArc is True is a line, polyline segment, or an arc.
     - Adjacent co-linear or co-circular segments are combined.
     - Segments that meet with G1-continuity have there ends tuned up so that they meet with G1-continuity to within machine precision.
     - If the polycurve is a polyline, a polyline will be created

        flag options
        Value Description
        0     Use all methods.
        1     Do not split NURBS curves at fully multiple knots.
        2     Do not replace segments with IsCurveLinear = True with line curves.
        4     Do not replace segments with IsArc = True with arc curves.
        8     Do not replace rational NURBS curves with constant denominator with an equivalent non-rational NURBS curve.
        16    Do not adjust curves at G1-joins.
        32    Do not merge adjacent co-linear lines or co-circular arcs or combine consecutive line segments into a polyline.
Parameters:
curve_id = the object's identifier
flags [opt] = the simplification methods to use. By default, all methods are used (flags = 0)
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a curve to simplify", rs.filter.curve)
See Also:
SplitCurve(curve_id, parameter, delete_input=True)
Splits, or divides, a curve at a specified parameter. The parameter must
    be in the interior of the curve's domain
Parameters:
curve_id = the curve to split
parameter = one or more parameters to split the curve at
delete_input[opt] = delete the input curve
Returns:
list of new curves on success
None on error
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a curve to split", rs.filter.curve)
if rs.IsCurve(curve):
domain = rs.CurveDomain(curve)
parameter = domain[1] / 2.0
rs.SplitCurve( curve, parameter )
See Also:
TrimCurve(curve_id, interval, delete_input=True)
Trims a curve by removing portions of the curve outside a specified interval
Parameters:
curve_id = the curve to trim
interval = two numbers indentifying the interval to keep. Portions of
  the curve before domain[0] and after domain[1] will be removed. If the
  input curve is open, the interval must be increasing. If the input
  curve is closed and the interval is decreasing, then the portion of
  the curve across the start and end of the curve is returned
delete_input[opt] = delete the input curve
Returns:
identifier of the new curve on success
None on failure
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a curve to trim", rs.filter.curve)
if rs.IsCurve(curve):
domain = rs.CurveDomain(curve)
domain[1] /= 2.0
rs.TrimCurve( curve, domain )
See Also:

dimension

AddAlignedDimension(start_point, end_point, point_on_dimension_line, style=None)
Adds an aligned dimension object to the document. An aligned dimension
    is a linear dimension lined up with two points
Parameters:
start_point: first point of dimension
end_point: second point of dimension
point_on_dimension_line: location point of dimension line
style[opt]: name of dimension style
Returns:
identifier of new dimension on success
None on error
Example:
import rhinoscriptsyntax as rs
origin = 1, 1, 0
offset = 11, 5, 0
point = 1, 3, 0
rs.AddAlignedDimension( origin, offset, point )
See Also:
AddDimStyle(dimstyle_name=None)
Adds a new dimension style to the document. The new dimension style will
    be initialized with the current default dimension style properties.
Parameters:
dimstyle_name [opt] = name of the new dimension style. If omitted, Rhino automatically generates the dimension style name
Returns:
name of the new dimension style on success
None on error
Example:
import rhinoscriptsyntax as rs
print "New dimension style: ", rs.AddDimStyle()
print "New dimension style: ", rs.AddDimStyle("MyDimStyle")
AddLeader(points, view_or_plane=None, text=None)
Adds a leader to the document. Leader objects are planar.
    The 3D points passed to this function should be co-planar
Parameters:
points = list of (at least 2) 3D points
view_or_plane [opt] = If a view is specified, points will be constrained
  to the view's construction plane. If a view is not specified, points
  will be constrained to a plane fit through the list of points
text [opt] = leader's text string
Returns:
identifier of the new leader on success
None on error
Example:
import rhinoscriptsyntax as rs
points = rs.GetPoints(True, False, "Select leader points")
if points: rs.AddLeader( points )
See Also:
AddLinearDimension(start_point, end_point, point_on_dimension_line)
Adds a linear dimension to the document
Returns:
identifier of the new object on success
None on error
Example:
import rhinoscriptsyntax as  rs
points = rs.GetPoints(True,  False, "Select 3 dimension points")
if points and len(points)>2:
rs.AddLinearDimension(rs.WorldXYPlane(),  points[0], points[1], points[2] )
See Also:
CurrentDimStyle( dimstyle_name=None )
Returns or changes the current default dimension style
Parameters:
dimstyle_name[opt] = name of an existing dimension style to make current
Returns:
if dimstyle_name is not specified, name of the current dimension style
if dimstyle_name is specified, name of the previous dimension style
None on error
Example:
import rhinoscriptsyntax as rs
rs.AddDimStyle("MyDimStyle")
rs.CurrentDimStyle("MyDimStyle")
DeleteDimStyle(dimstyle_name)
Removes an existing dimension style from the document. The dimension style
    to be removed cannot be referenced by any dimension objects.
Parameters:
dimstyle_name = the name of an unreferenced dimension style
Returns:
The name of the deleted dimension style if successful
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.GetString("Dimension style to remove")
DimensionStyle(object_id, dimstyle_name=None)
Returns or modifies the dimension style of a dimension object
Parameters:
object_id = identifier of the object
dimstyle_name[opt] = the name of an existing dimension style
Returns:
if dimstyle_name is specified, the object's current dimension style name
if dimstyle_name is not specified, the object's previous dimension style name
None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a dimension")
if rs.IsDimension(obj): rs.DimensionStyle(obj, "Default")
DimensionText(object_id)
Returns the text displayed by a dimension object
Parameters:
object_id = identifier of the object
Returns:
the text displayed by a dimension object
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a dimension")
if rs.IsDimension(obj):
print rs.DimensionText(obj)
DimensionUserText(object_id, usertext=None)
Returns of modifies the user text string of a dimension object. The user
    text is the string that gets printed when the dimension is defined
Parameters:
object_id = identifier of the object
usertext[opt] = the new user text string value
Returns:
if usertext is not specified, the current usertext string
if usertext is specified, the previous usertext string
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a dimension")
if rs.IsDimension(obj):
usertext = "<> " + chr(177) + str(rs.UnitAbsoluteTolerance())
rs.DimensionUserText( obj, usertext )
DimensionValue(object_id)
Returns the value of a dimension object
Parameters:
object_id = identifier of the object
Returns:
numeric value of the dimension if successful
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a dimension")
if rs.IsDimension(obj):
print rs.DimensionValue(obj)
DimStyleAnglePrecision(dimstyle, precision=None)
Returns or changes the angle display precision of a dimension style
Parameters:
dimstyle = the name of an existing dimension style
precision[opt] = the new angle precision value. If omitted, the current angle
  precision is returned
Returns:
If a precision is not specified, the current angle precision
If a precision is specified, the previous angle precision
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
precision = rs.DimStyleAnglePrecision(dimstyle)
if precision>2:
rs.DimStyleAnglePrecision( dimstyle, 2 )
DimStyleArrowSize(dimstyle, size=None)
Returns or changes the arrow size of a dimension style
Parameters:
dimstyle = the name of an existing dimension style
size[opt] = the new arrow size. If omitted, the current arrow size is returned
Returns:
If size is not specified, the current arrow size
If size is specified, the previous arrow size
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
size = rs.DimStyleArrowSize(dimstyle)
DimStyleCount()
Returns the number of dimension styles in the document
Parameters:
None
Returns:
the number of dimension styles in the document
Example:
import rhinoscriptsyntax as rs
count = rs.DimStyleCount()
print "There are", count, "dimension styles."
DimStyleExtension(dimstyle, extension=None)
Returns or changes the extension line extension of a dimension style
Parameters:
dimstyle = the name of an existing dimension style
extension[opt] = the new extension line extension
Returns:
if extension is not specified, the current extension line extension
if extension is specified, the previous extension line extension
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
extension = rs.DimStyleExtension(dimstyle)
DimStyleFont(dimstyle, font=None)
Returns or changes the font used by a dimension style
Parameters:
dimstyle = the name of an existing dimension style
font[opt] = the new font face name
Returns:
if font is not specified, the current font if successful
if font is specified, the previous font if successful
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
font = rs.DimStyleFont(dimstyle)
DimStyleLeaderArrowSize(dimstyle, size=None)
Returns or changes the leader arrow size of a dimension style
Parameters:
dimstyle = the name of an existing dimension style
size[opt] = the new leader arrow size
Returns:
if size is not specified, the current leader arrow size
if size is specified, the previous leader arrow size
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
size = rs.DimStyleLeaderArrowSize(dimstyle)
DimStyleLengthFactor(dimstyle, factor=None)
Returns or changes the length factor of a dimension style. Length factor
    is the conversion between Rhino units and dimension units
Parameters:
dimstyle = the name of an existing dimension style
factor[opt] = the new length factor
Returns:
if factor is not defined, the current length factor
if factor is defined, the previous length factor
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
factor = rs.DimStyleLengthFactor(dimstyle)
DimStyleLinearPrecision(dimstyle, precision=None)
Returns or changes the linear display precision of a dimension style
Parameters:
dimstyle = the name of an existing dimension style
precision[opt] = the new linear precision value
Returns:
if precision is not specified, the current linear precision value
if precision is specified, the previous linear precision value
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
precision = rs.DimStyleLinearPrecision(dimstyle)
DimStyleNames(sort=False)
Returns the names of all dimension styles in the document
Parameters:
sort [opt] = sort the list if True, not sorting is the default (False)
Returns:
the names of all dimension styles in the document
Example:
import rhinoscriptsyntax as rs
dimstyles = rs.DimStyleNames()
if dimstyles:
for dimstyle in dimstyles: print dimstyle
DimStyleNumberFormat(dimstyle, format=None)
Returns or changes the number display format of a dimension style
Parameters:
dimstyle = the name of an existing dimension style
format[opt] = the new number format
   0 = Decimal
   1 = Fractional
   2 = Feet and inches
Returns:
if format is not specified, the current display format
if format is specified, the previous display format
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
format = rs.DimStyleNumberFormat(dimstyle)
DimStyleOffset(dimstyle, offset=None)
Returns or changes the extension line offset of a dimension style
Parameters:
dimstyle = the name of an existing dimension style
offset[opt] = the new extension line offset
Returns:
if offset is not specified, the current extension line offset
if offset is specified, the previous extension line offset
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
offset = rs.DimStyleOffset(dimstyle)
DimStylePrefix(dimstyle, prefix=None)
Returns or changes the prefix of a dimension style - the text to
    prefix to the dimension text.
Parameters:
dimstyle = the name of an existing dimstyle
prefix[opt] = the new prefix
Returns:
if prefix is not specified, the current prefix
if prefix is specified, the previous prefix
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
rs.DimStylePrefix( dimstyle, "[" )
DimStyleSuffix(dimstyle, suffix=None)
Returns or changes the suffix of a dimension style - the text to
    append to the dimension text.
Parameters:
dimstyle = the name of an existing dimstyle
suffix[opt] = the new suffix
Returns:
if suffix is not specified, the current suffix
if suffix is specified, the previous suffix
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
rs.DimStyleSuffix( dimstyle, "}" )
DimStyleTextAlignment(dimstyle, alignment=None)
Returns or changes the text alignment mode of a dimension style
Parameters:
dimstyle = the name of an existing dimension style
alignment[opt] = the new text alignment
    0 = Normal (same as 2)
    1 = Horizontal to view
    2 = Above the dimension line
    3 = In the dimension line
Returns:
if alignment is not specified, the current text alignment
if alignment is specified, the previous text alignment
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
alignment = rs.DimStyleTextAlignment(dimstyle)
DimStyleTextGap(dimstyle, gap=None)
Returns or changes the text gap used by a dimension style
Parameters:
dimstyle = the name of an existing dimension style
gap[opt] = the new text gap
Returns:
if gap is not specified, the current text gap
if gap is specified, the previous text gap
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
gap = rs.DimStyleTextGap(dimstyle)
DimStyleTextHeight(dimstyle, height=None)
Returns or changes the text height used by a dimension style
Parameters:
dimstyle = the name of an existing dimension style
height[opt] = the new text height
Returns:
if height is not specified, the current text height
if height is specified, the previous text height
None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.CurrentDimStyle()
height = rs.DimStyleTextHeight(dimstyle)
IsAlignedDimension(object_id)
Verifies an object is an aligned dimension object
Parameters:
object_id = the object's identifier
Returns:
True or False.  None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a dimension")
if rs.IsAlignedDimension(obj):
print "The object is an aligned dimension."
else:
print "The object is not an aligned dimension."
IsAngularDimension(object_id)
Verifies an object is an angular dimension object
Parameters:
object_id = the object's identifier
Returns:
True or False. None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a dimension")
if rs.IsAngularDimension(obj):
print "The object is an angular dimension."
else:
print "The object is not an angular dimension."
IsDiameterDimension(object_id)
Verifies an object is a diameter dimension object
Parameters:
object_id = the object's identifier
Returns:
True or False.  None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a dimension")
if rs.IsDiameterDimension(obj):
print "The object is a diameter dimension."
else:
print "The object is not a diameter dimension."
IsDimension(object_id)
Verifies an object is a dimension object
Parameters:
object_id = the object's identifier
Returns:
True or False.  None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a dimension")
if rs.IsDimension(obj):
print "The object is a dimension."
else:
print "The object is not a dimension."
IsDimStyle(dimstyle)
Verifies the existance of a dimension style in the document
Parameters:
dimstyle = the name of a dimstyle to test for
Returns:
True or False. None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.GetString("Dimension style to test")
if rs.IsDimStyle(dimstyle):
if rs.IsDimStyleReference(dimstyle):
print "The dimension style is from a reference file."
else:
print "The dimension style is not from a reference file."
else:
print "The dimension style does not exist."
IsDimStyleReference(dimstyle)
Verifies that an existing dimension style is from a reference file
Parameters:
dimstyle = the name of an existing dimension style
Returns:
True or False. None on error
Example:
import rhinoscriptsyntax as rs
dimstyle = rs.GetString("Dimension style to test")
if rs.IsDimStyle(dimstyle):
if rs.IsDimStyleReference(dimstyle):
print "The dimension style is from a reference file."
else:
print "The dimension style is not from a reference file."
else:
print "The dimension style does not exist."
See Also:
IsLeader(object_id)
Verifies an object is a dimension leader object
Parameters:
object_id = the object's identifier
Returns:
True or False. None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a leader")
if rs.IsLeader(obj):
print "The object is a leader."
else:
print "The object is not a leader."
See Also:
IsLinearDimension(object_id)
Verifies an object is a linear dimension object
Parameters:
object_id = the object's identifier
Returns:
True or False. None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a dimension")
if rs.IsLinearDimension(obj):
print "The object is a linear dimension."
else:
print "The object is not a linear dimension."
IsOrdinateDimension(object_id)
Verifies an object is an ordinate dimension object
Parameters:
object_id = the object's identifier
Returns:
True or False. None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a dimension")
if rs.IsOrdinateDimension(obj):
print "The object is an ordinate dimension."
else:
print "The object is not an ordinate dimension."
IsRadialDimension(object_id)
Verifies an object is a radial dimension object
Parameters:
object_id = the object's identifier
Returns:
True or False. None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a dimension")
if rs.IsRadialDimension(obj):
print "The object is a radial dimension."
else:
print "The object is not a radial dimension."
LeaderText(object_id, text=None)
Returns or modifies the text string of a dimension leader object
Parameters:
object_id = the object's identifier
text[opt] = the new text string
Returns:
if text is not specified, the current text string
if text is specified, the previous text string
None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a leader")
See Also:
RenameDimStyle(oldstyle, newstyle)
Renames an existing dimension style
Parameters:
oldstyle = the name of an existing dimension style
newstyle = the new dimension style name
Returns:
the new dimension style name if successful
None on error
Example:
import rhinoscriptsyntax as rs
oldstyle = rs.GetString("Old dimension style name")
if oldstyle:
newstyle = rs.GetString("New dimension style name")

document

CreatePreviewImage(filename, view=None, size=None, flags=0, wireframe=False)
Create a bitmap preview image of the current model
Parameters:
filename = name of the bitmap file to create
view[opt] = title of the view. If omitted, the active view is used
size[opt] = two integers that specify width and height of the bitmap
flags[opt] = Bitmap creation flags. Can be the combination of:
    1 = honor object highlighting
    2 = draw construction plane
    4 = use ghosted shading
wireframe[opt] = If True then a wireframe preview image. If False,
    a rendered image will be created
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as  rs
result = rs.CreatePreviewImage("test.jpg")
if result:
print  "test.jpg created successfully."
else:
print  "Unable to create preview image."
DocumentModified(modified=None)
Returns or sets the document's modified flag. This flag indicates whether
    or not any changes to the current document have been made. NOTE: setting the
    document modified flag to False will prevent the "Do you want to save this
    file..." from displaying when you close Rhino.
Parameters:
modified [optional] = the modified state, either True or False
Returns:
if no modified state is specified, the current modified state
if a modified state is specified, the previous modified state
Example:
import rhinoscriptsyntax as rs
modified = rs.IsDocumentModified()
if not modified: rs.DocumentModified(True)
See Also:
DocumentName()
Returns the name of the currently loaded Rhino document (3DM file)
Parameters:
None
Returns:
the name of the currently loaded Rhino document (3DM file)
Example:
import rhinoscriptsyntax as rs
name = rs.DocumentName()
print name
See Also:
DocumentPath()
Returns path of the currently loaded Rhino document (3DM file)
Parameters:
None
Returns:
the path of the currently loaded Rhino document (3DM file)
Example:
import rhinoscriptsyntax as rs
path = rs.DocumentPath()
print path
See Also:
EnableRedraw(enable=True)
Enables or disables screen redrawing
Parameters:
enable [opt] = True to enable, False to disable
Returns:
previous screen redrawing state
Example:
import rhinoscriptsyntax as rs
redraw = rs.EnableRedraw(True)
See Also:
ExtractPreviewImage(filename, modelname=None)
Extracts the bitmap preview image from the specified model (.3dm)
Parameters:
filename = name of the bitmap file to create. The extension of
   the filename controls the format of the bitmap file created.
   (.bmp, .tga, .jpg, .jpeg, .pcx, .png, .tif, .tiff)
modelname [opt] = The model (.3dm) from which to extract the
   preview image. If omitted, the currently loaded model is used.
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
result = rs.ExtractPreviewImage("test.jpg")
if result:
print "Test.jpg created successfully."
else:
print "Unable to extract preview image."
See Also:
IsDocumentModified()
Verifies that the current document has been modified in some way
Parameters:
None
Returns:
True or False. None on error
Example:
import rhinoscriptsyntax as rs
modified = rs.IsDocumentModified()
if not modified: rs.DocumentModified(True)
See Also:
Notes(newnotes=None)
Returns or sets the document's notes. Notes are generally created
    using Rhino's Notes command
Parameters:
newnotes[opt] = new notes to set
Returns:
if newnotes is omitted, the current notes if successful
if newnotes is specified, the previous notes if successful
Example:
import rhinoscriptsyntax as rs
notes = rs.Notes()
if notes: rs.MessageBox(notes)
See Also:
ReadFileVersion()
Returns the file version of the current document. Use this function to
    determine which version of Rhino last saved the document. Note, this
    function will not return values from referenced or merged files.
Parameters:
None
Returns:
the file version of the current document
Example:
import rhinoscriptsyntax as rs
print "ReadFileVersion =", rs.ReadFileVersion()
Redraw()
Redraws all views
Parameters:
None
Returns:
None
Example:
import rhinoscriptsyntax as rs
rs.Redraw()
See Also:
RenderAntialias(style=None)
Returns or sets render antialias style
Parameters:
style[opt] = level of antialiasing (0=none, 1=normal, 2=best)
Returns:
if style is not specified, the current antialias style
if style is specified, the previous antialias style
Example:
import rhinoscriptsyntax as rs
rs.RenderAntialias(1)
RenderColor(item, color=None)
Returns or sets the render ambient light or background color
Parameters:
item = 0=ambient light color, 1=background color
color[opt] = the new color value. If omitted, the curren item color is returned
Returns:
if color is not specified, the current item color
if color is specified, the previous item color
Example:
import rhinoscriptsyntax as rs
render_background_color = 1
rs.RenderColor( render_background_color, (0,0,255) )
RenderResolution(resolution=None)
Returns or sets the render resolution
Parameters:
resolution[opt] = width and height of render
Returns:
if resolution is not specified, the current resolution width,height
if resolution is specified, the previous resolution width, height
Example:
import rhinoscriptsyntax as rs
sizex, sizey = rs.Viewsize()
RenderSettings(settings=None)
Returns or sets render settings
Parameters:
settings[opt] = render settings to modify.
  0=none,
  1=create shadows,
  2=use lights on layers that are off,
  4=render curves and isocurves,
  8=render dimensions and text
Returns:
if settings are not specified, the current render settings
if settings are specified, the previous render settings
Example:
import rhinoscriptsyntax as rs
render_annotations = 8
settings = rs.RenderSettings()
if settings & render_annotations:
settings = settings - render_annotations
rs.RenderSettings( settings )
UnitAbsoluteTolerance(tolerance=None, in_model_units=True)
Resturns or sets the document's absolute tolerance. Absolute tolerance
    is measured in drawing units. See Rhino's document properties command
    (Units and Page Units Window) for details
Parameters:
tolerance [opt] = the absolute tolerance to set
in_model_units[opt] = Return or modify the document's model units (True)
                      or the document's page units (False)
Returns:
if tolerance is not specified, the current absolute tolerance
if tolerance is specified, the previous absolute tolerance
Example:
import rhinoscriptsyntax as rs
tol = rs.UnitAbsoluteTolerance()
if tol<0.01:
rs.UnitAbsoluteTolerance( 0.01 )
UnitAngleTolerance(angle_tolerance_degrees=None, in_model_units=True)
Return or set the document's angle tolerance. Angle tolerance is
    measured in degrees. See Rhino's DocumentProperties command
    (Units and Page Units Window) for details
Parameters:
angle_tolerance_degrees [opt] = the angle tolerance to set
in_model_units [opt] = Return or modify the document's model units (True)
                       or the document's page units (False)
Returns:
if angle_tolerance_degrees is not specified, the current angle tolerance
if angle_tolerance_degrees is specified, the previous angle tolerance
Example:
import rhinoscriptsyntax as rs
tol = rs.UnitAngleTolerance()
if tol<3.0:
rs.UnitAngleTolerance(3.0)
UnitDistanceDisplayPrecision(precision=None, model_units=True)
Return or set the document's distance display precision
Parameters:
precision [opt] = The distance display precision.  If the current distance display mode is Decimal, then precision is the number of decimal places.  If the current distance display mode is Fractional (including Feet and Inches), then the denominator = (1/2)^precision.  Use UnitDistanceDisplayMode to get the current distance display mode.
model_units [opt] = Return or modify the document's model units (True) or the document's page units (False). The default is True.
Returns:
If precision is not specified, the current distance display precision if successful. If precision is specified, the previous distance display precision if successful. If not successful, or on error.
Example:
import rhinoscriptsyntax as rs
precision = 3
rs.UnitDistanceDisplayPrecision( precision )
UnitRelativeTolerance(relative_tolerance=None, in_model_units=True)
Return or set the document's relative tolerance. Relative tolerance
    is measured in percent. See Rhino's DocumentProperties command
    (Units and Page Units Window) for details
Parameters:
relative_tolerance [opt] = the relative tolerance in percent
in_model_units [opt] = Return or modify the document's model units (True)
                       or the document's page units (False)
Returns:
if relative_tolerance is not specified, the current tolerance in percent
if relative_tolerance is specified, the previous tolerance in percent
Example:
import rhinoscriptsyntax as rs
tol = rs.UnitRelativeTolerance()
if tol<1.0:
rs.UnitRelativeTolerance(1.0)
UnitScale(to_system, from_system=None)
Return the scale factor for changing between unit systems.
Parameters:
to_system = The unit system to convert to. The unit systems are are:
   0 - No unit system
   1 - Microns (1.0e-6 meters)
   2 - Millimeters (1.0e-3 meters)
   3 - Centimeters (1.0e-2 meters)
   4 - Meters
   5 - Kilometers (1.0e+3 meters)
   6 - Microinches (2.54e-8 meters, 1.0e-6 inches)
   7 - Mils (2.54e-5 meters, 0.001 inches)
   8 - Inches (0.0254 meters)
   9 - Feet (0.3408 meters, 12 inches)
  10 - Miles (1609.344 meters, 5280 feet)
  11 - *Reserved for custom Unit System*
  12 - Angstroms (1.0e-10 meters)
  13 - Nanometers (1.0e-9 meters)
  14 - Decimeters (1.0e-1 meters)
  15 - Dekameters (1.0e+1 meters)
  16 - Hectometers (1.0e+2 meters)
  17 - Megameters (1.0e+6 meters)
  18 - Gigameters (1.0e+9 meters)
  19 - Yards (0.9144  meters, 36 inches)
  20 - Printer point (1/72 inches, computer points)
  21 - Printer pica (1/6 inches, (computer picas)
  22 - Nautical mile (1852 meters)
  23 - Astronomical (1.4959787e+11)
  24 - Lightyears (9.46073e+15 meters)
  25 - Parsecs (3.08567758e+16)
from_system [opt] = the unit system to convert from (see above). If omitted,
    the document's current unit system is used
Returns:
scale factor for changing between unit systems
Example:
import rhinoscriptsyntax as rs
UnitSystem(unit_system=None, scale=False, in_model_units=True)
Return or set the document's unit system. See Rhino's DocumentProperties
    command (Units and Page Units Window) for details
Parameters:
unit_system = The unit system to set the document to. The unit systems are:
   0 - No unit system
   1 - Microns (1.0e-6 meters)
   2 - Millimeters (1.0e-3 meters)
   3 - Centimeters (1.0e-2 meters)
   4 - Meters
   5 - Kilometers (1.0e+3 meters)
   6 - Microinches (2.54e-8 meters, 1.0e-6 inches)
   7 - Mils (2.54e-5 meters, 0.001 inches)
   8 - Inches (0.0254 meters)
   9 - Feet (0.3408 meters, 12 inches)
  10 - Miles (1609.344 meters, 5280 feet)
  11 - *Reserved for custom Unit System*
  12 - Angstroms (1.0e-10 meters)
  13 - Nanometers (1.0e-9 meters)
  14 - Decimeters (1.0e-1 meters)
  15 - Dekameters (1.0e+1 meters)
  16 - Hectometers (1.0e+2 meters)
  17 - Megameters (1.0e+6 meters)
  18 - Gigameters (1.0e+9 meters)
  19 - Yards (0.9144  meters, 36 inches)
  20 - Printer point (1/72 inches, computer points)
  21 - Printer pica (1/6 inches, (computer picas)
  22 - Nautical mile (1852 meters)
  23 - Astronomical (1.4959787e+11)
  24 - Lightyears (9.46073e+15 meters)
  25 - Parsecs (3.08567758e+16)
scale [opt] = Scale existing geometry based on the new unit system.
    If not specified, any existing geometry is not scaled (False)
in_model_units [opt] = Return or modify the document's model units (True)
    or the document's page units (False). The default is True.
Returns:
if unit_system is not specified, the current unit system
if unit_system is specified, the previous unit system
None on error
Example:
import rhinoscriptsyntax as rs
rhUnitMillimeters = 2
rhUnitInches = 8
current_system = rs.UnitSystem()
if current_system==rhUnitMillimeters:
rs.UnitSystem(rhUnitInches, True)
UnitSystemName(capitalize=False, singular=True, abbreviate=False, model_units=True)
Returns the name of the current unit system
Parameters:
capitalize [opt] = Capitalize the first character of the units system name (e.g. return "Millimeter" instead of "millimeter"). The default is not to capitalize the first character (false).
singular [opt] = Return the singular form of the units system name (e.g. "millimeter" instead of "millimeters"). The default is to return the singular form of the name (true).
abbreviate [opt] = Abbreviate the name of the units system (e.g. return "mm" instead of "millimeter"). The default is not to abbreviate the name (false).
model_units [opt] = Return the document's model units (True) or the document's page units (False). The default is True.
Returns:
The name of the current units system if successful.
Example:
import rhinoscriptsyntax as rs
system = rs.UnitSystemName(False, False, False)
print "The units system is set to", system
See Also:

geometry

AddClippingPlane(plane, u_magnitude, v_magnitude, views=None)
Create a clipping plane for visibly clipping away geometry in a specific
    view. Note, clipping planes are infinite
Parameters:
plane = the plane
u_magnitude, v_magnitude = size of the plane
views[opt]= Titles or ids the the view(s) to clip. If omitted, the active
  view is used.
Returns:
object identifier on success
None on failure
Example:
import rhinoscriptsyntax as rs
rs.AddClippingPlane( rs.WorldXYPlane(), 5.0, 3.0 )
See Also:
AddPictureFrame(plane, filename, width=0.0, height=0.0, self_illumination=True, embed=False, use_alpha=False, make_mesh=False)
Creates a picture frame and adds it to the document.
Parameters:
plane = The plane in which the PictureFrame will be created.  The bottom-left corner of picture will be at plane's origin. The width will be in the plane's X axis direction, and the height will be in the plane's Y axis direction.
filename = The path to a bitmap or image file.
width = If both dblWidth and dblHeight = 0, then the width and height of the PictureFrame will be the width and height of the image. If dblWidth = 0 and dblHeight is > 0, or if dblWidth > 0 and dblHeight = 0, then the non-zero value is assumed to be an aspect ratio of the image's width or height, which ever one is = 0. If both dblWidth and dblHeight are > 0, then these are assumed to be the width and height of in the current unit system.
height =  If both dblWidth and dblHeight = 0, then the width and height of the PictureFrame will be the width and height of the image. If dblWidth = 0 and dblHeight is > 0, or if dblWidth > 0 and dblHeight = 0, then the non-zero value is assumed to be an aspect ratio of the image's width or height, which ever one is = 0. If both dblWidth and dblHeight are > 0, then these are assumed to be the width and height of in the current unit system.
self_illumination =  If True, then the image mapped to the picture frame plane always displays at full intensity and is not affected by light or shadow.
embed = If True, then the function adds the image to Rhino's internal bitmap table, thus making the document self-contained.
use_alpha = If False, the picture frame is created without any transparency texture.  If True, a transparency texture is created with a "mask texture" set to alpha, and an instance of the diffuse texture in the source texture slot.
make_mesh = If True, the function will make a PictureFrame object from a mesh rather than a plane surface.
Returns:
object identifier on success
None on failure
Example:
See Also:
AddPoint(point, y=None, z=None)
Adds point object to the document
Parameters:
point = x,y,z location of point to add
Returns:
Guid for the object that was added to the doc
Example:
import rhinoscriptsyntax as rs
rs.AddPoint( (1,2,3) )
AddPointCloud(points, colors=None)
Adds point cloud object to the document
Parameters:
points = list of values where every multiple of three represents a point
colors[opt] = list of colors to apply to each point
Returns:
identifier of point cloud on success
Example:
import rhinoscriptsyntax as rs
points = (0,0,0), (1,1,1), (2,2,2), (3,3,3)
rs.AddPointCloud(points)
AddPoints(points)
Adds one or more point objects to the document
Parameters:
points = list of points
Returns:
list of Guid identifiers of the new objects on success
Example:
import rhinoscriptsyntax as rs
points = rs.GetPoints(True, True, "Select points")
if points: rs.AddPoints(points)
AddText(text, point_or_plane, height=1.0, font="Arial", font_style=0, justification=None)
Adds a text string to the document
Parameters:
text = the text to display
point_or_plane = a 3-D point or the plane on which the text will lie.
    The origin of the plane will be the origin point of the text
height [opt] = the text height
font [opt] = the text font
font_style[opt] = any of the following flags
   0 = normal
   1 = bold
   2 = italic
   3 = bold and italic
justification[opt] = text justification (see help for values)
Returns:
Guid for the object that was added to the doc on success
None on failure
Example:
import rhinoscriptsyntax as rs
point = rs.GetPoint("Pick point")
if point: rs.AddText("Hello Rhino!", point)
See Also:
AddTextDot(text, point)
Add a text dot to the document.
Parameters:
text = string in dot
point = A 3D point identifying the origin point.
Returns:
The identifier of the new object if successful
Example:
import rhinoscriptsyntax as rs
rs.AddTextDot("howdy",(1,2,3))
See Also:
Area(object_id)
Compute the area of a closed curve, hatch, surface, polysurface, or mesh
Parameters:
object_id = the object's identifier
Returns:
area if successful
None on error
Example:
import rhinoscriptsyntax as  rs
a = rs.Area('a9e34aa8-226c-4e17-9e11-b74bf2cf581b')
BoundingBox(objects, view_or_plane=None, in_world_coords=True)
Returns either world axis-aligned or a construction plane axis-aligned
    bounding box of an object or of several objects
Parameters:
objects = The identifiers of the objects
view_or_plane[opt] = Title or id of the view that contains the
    construction plane to which the bounding box should be aligned -or-
    user defined plane. If omitted, a world axis-aligned bounding box
    will be calculated
in_world_coords[opt] = return the bounding box as world coordinates or
    construction plane coordinates. Note, this option does not apply to
    world axis-aligned bounding boxes.
Returns:
Eight 3D points that define the bounding box. Points returned in counter-
clockwise order starting with the bottom rectangle of the box.
None on error
Example:
import rhinoscriptsyntax as rs
object = rs.GetObject("Select object")
if object:
box = rs.BoundingBox(object)
if box:
for i, point in enumerate(box):
rs.AddTextDot( i, point )
See Also:
ExplodeText(text_id, delete=False)
Creates outline curves for a given text entity
Parameters:
text_id: identifier of Text object to explode
delete[opt]: delete the text object after the curves have been created
Returns:
list of outline curves
Example:
import rhinoscriptsyntax as rs
text = rs.AddText("abcd", rs.WorldXYPlane())
rs.ExplodeText(text, True)
IsClippingPlane(object_id)
Verifies that an object is a clipping plane object
Parameters:
object_id: the object's identifier
Returns:
True if the object with a given id is a clipping plane
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select a clipping plane")
if rs.IsClippingPlane(id):
print "The object is a clipping plane."
else:
print "The object is not a clipping plane."
See Also:
IsPoint(object_id)
Verifies an object is a point object.
Parameters:
object_id: the object's identifier
Returns:
True if the object with a given id is a point
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select a point")
if rs.IsPoint(id):
print "The object is a point."
else:
print "The object is not a point."
IsPointCloud(object_id)
Verifies an object is a point cloud object.
Parameters:
object_id: the object's identifier
Returns:
True if the object with a given id is a point cloud
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select a point cloud")
if rs.IsPointCloud(id):
print "The object is a point cloud."
else:
print "The object is not a point cloud."
IsText(object_id)
Verifies an object is a text object.
Parameters:
object_id: the object's identifier
Returns:
True if the object with a given id is a text object
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select a text object")
if rs.IsText(id):
print "The object is a text object."
else:
print "The object is not a text object."
See Also:
IsTextDot(object_id)
Verifies an object is a text dot object.
Parameters:
object_id: the object's identifier
Returns:
True if the object with a given id is a text dot object
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select a text dot object")
if rs.IsTextDot(id):
print "The object is a text dot object."
else:
print "The object is not a text dot object."
See Also:
PointCloudCount(object_id)
Returns the point count of a point cloud object
Parameters:
object_id: the point cloud object's identifier
Returns:
number of points if successful
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select point cloud", rs.filter.pointcloud)
print "Point count:", rs.PointCloudCount(id)
PointCloudHasHiddenPoints(object_id)
Verifies that a point cloud has hidden points
Parameters:
object_id: the point cloud object's identifier
Returns:
True if cloud has hidden points, otherwise False
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a point cloud", rs.filter.pointcloud)
if rs.PointCloudHasHiddenPoints(obj):
print "The point cloud has hidden points."
else:
print "The point cloud has no hidden points."
PointCloudHasPointColors(object_id)
Verifies that a point cloud has point colors
Parameters:
object_id: the point cloud object's identifier
Returns:
True if cloud has point colors, otherwise False
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a point cloud", rs.filter.pointcloud)
if rs.PointCloudHasPointColors(obj):
print "The point cloud has point colors."
else:
print "The point cloud has no point colors."
PointCloudHidePoints(object_id, hidden=[])
Returns or modifies the hidden points of a point cloud object
Parameters:
object_id: the point cloud object's identifier
hidden: list of hidden values if you want to hide certain points
Returns:
List of point cloud hidden states
Example:
import rhinoscriptsyntax as rs
if obj:
hidden = [True] * rs.PointCloudCount(obj)
for i in range(len(hidden)):
hidden[i] = (i%2==0)
rs.PointCloudHidePoints(obj, hidden)
PointCloudPointColors(object_id, colors=[])
Returns or modifies the point colors of a point cloud object
Parameters:
object_id: the point cloud object's identifier
colors: list of color values if you want to adjust colors
Returns:
List of point cloud colors
Example:
import rhinoscriptsyntax as rs
import random
      
def RandomColor():
red = random.randint(0,255)
green = random.randint(0,255)
blue = random.randint(0,255)
return rs.coercecolor((red,green,blue))
      
obj = rs.GetObject("Select point cloud", rs.filter.pointcloud)
if obj:
colors = [RandomColor() for i in range(rs.PointCloudCount(obj))]
rs.PointCloudColors(obj, colors)
PointCloudPoints(object_id)
Returns the points of a point cloud object
Parameters:
object_id: the point cloud object's identifier
Returns:
list of points if successful
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select point cloud", rs.filter.pointcloud)
points = rs.PointCloudPoints(id)
if points: for point in points: print point
PointCoordinates(object_id, point=None)
Returns or modifies the X, Y, and Z coordinates of a point object
Parameters:
object_id = The identifier of a point object
point[opt] = A new 3D point location.
Returns:
If point is not specified, the current 3-D point location
If point is specified, the previous 3-D point location
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select point", rs.filter.point)
point = rs.PointCoordinates(id)
See Also:
TextDotFont(object_id, fontface=None)
Returns or modified the font of a text dot
Parameters:
object_id = identifier of a text dot object
fontface[opt] = new font face name
Returns:
If font is not specified, the current text dot font
If font is specified, the previous text dot font
None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select text dot")
TextDotHeight(object_id, height=None)
Returns or modified the font height of a text dot
Parameters:
object_id = identifier of a text dot object
height[opt] = new font height
Returns:
If height is not specified, the current text dot height
If height is specified, the previous text dot height
None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select text dot")
if rs.IsTextDot(obj): rs.TextDotHeight(obj, 10.0)
TextDotPoint(object_id, point=None)
Returns or modifies the location, or insertion point, on a text dot object
Parameters:
object_id = identifier of a text dot object
point[opt] = A new 3D point location.
Returns:
If point is not specified, the current 3-D text dot location
If point is specified, the previous 3-D text dot location
None if not successful, or on error
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select text dot")
if rs.IsTextDot(id):
point = rs.TestDotPoint(id)
rs.AddPoint( point )
rs.TextDotPoint(id, [0,0,0])
TextDotText(object_id, text=None)
Returns or modifies the text on a text dot object
Parameters:
object_id =tThe identifier of a text dot object
text [opt] = a new string for the dot
Returns:
If text is not specified, the current text dot text
If text is specified, the previous text dot text
None if not successful, or on error
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select text dot")
if rs.IsTextDot(id):
rs.TextDotText( id, "Rhino")
TextObjectFont(object_id, font=None)
Returns of modifies the font used by a text object
Parameters:
object_id = the identifier of a text object
font [opt] = the new font face name
Returns:
if a font is not specified, the current font face name
if a font is specified, the previous font face name
None if not successful, or on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select text")
if rs.IsText(obj): rs.TextObjectFont(obj, "Arial")
TextObjectHeight(object_id, height=None)
Returns or modifies the height of a text object
Parameters:
object_id = the identifier of a text object
height[opt] = the new text height.
Returns:
if height is not specified, the current text height
if height is specified, the previous text height
None if not successful, or on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select text")
if rs.IsText(obj):
rs.TextObjectHeight( obj, 1.0 )
TextObjectPlane(object_id, plane=None)
Returns or modifies the plane used by a text object
Parameters:
object_id = the identifier of a text object
plane[opt] = the new text object plane
Returns:
if a plane is not specified, the current plane if successful
if a plane is specified, the previous plane if successful
None if not successful, or on Error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select text")
if rs.IsText(obj):
plane = rs.ViewCPlane("Top")
rs.TextObjectPlane( obj, plane )
TextObjectPoint(object_id, point=None)
Returns or modifies the location of a text object
Parameters:
object_id = the identifier of a text object
point[opt] = the new text object location
Returns:
if point is not specified, the 3D point identifying the current location
if point is specified, the 3D point identifying the previous location
None if not successful, or on Error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select text")
if rs.IsText(obj):
rs.TextObjectPoint( obj, [0,0,0] )
TextObjectStyle(object_id, style=None)
Returns or modifies the font style of a text object
Parameters:
object_id = the identifier of a text object
style [opt] = the font style. Can be any of the following flags
   0 = Normal
   1 = Bold
   2 = Italic
Returns:
if style is not specified, the current font style
if style is specified, the previous font style
None if not successful, or on Error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select text")
if rs.IsText(obj):
rs.TextObjectStyle( obj, 3 )
TextObjectText(object_id, text=None)
Returns or modifies the text string of a text object.
Parameters:
object_id = the identifier of a text object
text [opt] = a new text string
Returns:
if text is not specified, the current string value if successful
if text is specified, the previous string value if successful
None if not successful, or on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select text")
if rs.IsText(obj): rs.TextObjectText(obj, "Rhino")

grips

EnableObjectGrips(object_id, enable=True)
Enables or disables an object's grips. For curves and surfaces, these are
    also called control points.
Parameters:
object_id = identifier of the object
enable [opt] = if True, the specified object's grips will be turned on.
  Otherwise, they will be turned off
Returns:
True on success, False on failure
Example:
import rhinoscriptsyntax as  rs
objects = rs.GetObjects("Select  objects")
if objects: [rs.EnableObjectGrips(obj)  for obj in objs]
GetObjectGrip(message=None, preselect=False, select=False)
Prompts the user to pick a single object grip
Parameters:
message [opt] = prompt for picking
preselect [opt] = allow for selection of pre-selected object grip.
select [opt] = select the picked object grip.
Returns:
tuple defining a grip record.
  grip_record[0] = identifier of the object that owns the grip
  grip_record[1] = index value of the grip
  grip_record[2] = location of the grip
None on error
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select a curve", rs.filter.curve)
if curve:
rs.EnableObjectGrips( curve )
grip = rs.GetObjectGrip("Select a curve grip")
if grip: print grip[2]
See Also:
GetObjectGrips(message=None, preselect=False, select=False)
Prompts user to pick one or more object grips from one or more objects.
Parameters:
message [opt] = prompt for picking
preselect [opt] = allow for selection of pre-selected object grips
select [opt] = select the picked object grips
Returns:
list containing one or more grip records. Each grip record is a tuple
  grip_record[0] = identifier of the object that owns the grip
  grip_record[1] = index value of the grip
  grip_record[2] = location of the grip
None on error
Example:
import rhinoscriptsyntax as rs
curves = rs.GetObjects("Select curves", rs.filter.curves)
if curves:
for curve in curves: rs.EnableObjectGrips(curve)
grips = rs.GetObjectGrips("Select curve grips")
if grips: for grip in grips: print grip[0]
See Also:
NextObjectGrip(object_id, index, direction=0, enable=True)
Returns the next grip index from a specified grip index of an object
Parameters:
object_id = identifier of the object
index = zero based grip index from which to get the next grip index
direction[opt] = direction to get the next grip index (0=U, 1=V)
enable[opt] = if True, the next grip index found will be selected
Returns:
index of the next grip on success, None on failure
Example:
import rhinoscriptsyntax as rs
object_id = rs.GetObject("Select curve", rs.filter.curve)
if object_id:
rs.EnableObjectGrips( object_id )
for i in range(0,count,2):
rs.NextObjectGrip(object_id, i, 0, True)
ObjectGripCount(object_id)
Returns number of grips owned by an object
Parameters:
object_id = identifier of the object
Returns:
number of grips if successful
None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select object")
if rs.ObjectGripsOn(obj):
print "Grip count =", rs.ObjectGripCount(obj)
ObjectGripLocation(object_id, index, point=None)
Returns or modifies the location of an object's grip
Parameters:
object_id = identifier of the object
index = index of the grip to either query or modify
point [opt] = 3D point defining new location of the grip
Returns:
if point is not specified, the current location of the grip referenced by index
if point is specified, the previous location of the grip referenced by index
None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select curve", rs.filter.curve)
if obj:
rs.EnableObjectGrips(obj)
point = rs.ObjectGripLocation(obj, 0)
rs.ObjectGripLocation(obj, 0, point)
rs.EnableObjectGrips(obj, False)
ObjectGripLocations(object_id, points=None)
Returns or modifies the location of all grips owned by an object. The
    locations of the grips are returned in a list of Point3d with each position
    in the list corresponding to that grip's index. To modify the locations of
    the grips, you must provide a list of points that contain the same number
    of points at grips
Parameters:
object_id = identifier of the object
points [opt] = list of 3D points identifying the new grip locations
Returns:
if points is not specified, the current location of all grips
if points is specified, the previous location of all grips
None if not successful
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select curve", rs.filter.curve)
if obj:
rs.EnableObjectGrips( obj )
points = rs.ObjectGripLocations(obj)
ObjectGripsOn(object_id)
Verifies that an object's grips are turned on
Parameters:
object_id = identifier of the object
Returns:
True or False indcating Grips state
None on error
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select object")
if rs.ObjectGripsOn(obj):
print "Grip count =", rs.ObjectGripCount(obj)
ObjectGripsSelected(object_id)
Verifies that an object's grips are turned on and at least one grip
    is selected
Parameters:
object_id = identifier of the object
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select object")
if rs.ObjectGripsSelected(obj):
rs.UnselectObjectGrips( obj )
PrevObjectGrip(object_id, index, direction=0, enable=True)
Returns the prevoius grip index from a specified grip index of an object
Parameters:
object_id = identifier of the object
index = zero based grip index from which to get the previous grip index
direction[opt] = direction to get the next grip index (0=U, 1=V)
enable[opt] = if True, the next grip index found will be selected
Returns:
index of the next grip on success, None on failure
Example:
import rhinoscriptsyntax as rs
object_id = rs.GetObject("Select curve", rs.filter.curve)
if object_id:
rs.EnableObjectGrips(object_id)
for i in range(count-1, 0, -2):
rs.PrevObjectGrip(object_id, i, 0, True)
SelectedObjectGrips(object_id)
Returns a list of grip indices indentifying an object's selected grips
Parameters:
object_id = identifier of the object
Returns:
list of indices on success
None on failure or if no grips are selected
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select curve", rs.filter.curve)
if obj:
rs.EnableObjectGrips( obj )
for i in xrange(0,count,2):
rs.SelectObjectGrip( obj, i )
grips = rs.SelectedObjectGrips(obj)
if grips: print len(grips), "grips selected"
SelectObjectGrip(object_id, index)
Selects a single grip owned by an object. If the object's grips are
    not turned on, the grips will not be selected
Parameters:
object_id = identifier of the object
index = index of the grip to select
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select curve", rs.filter.curve)
if obj:
rs.EnableObjectGrips( obj )
for i in xrange(0,count,2): rs.SelectObjectGrip(obj,i)
SelectObjectGrips(object_id)
Selects an object's grips. If the object's grips are not turned on,
    they will not be selected
Parameters:
object_id = identifier of the object
Returns:
Number of grips selected on success
None on failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select object")
if rs.ObjectGripsSelected(obj)==False:
rs.SelectObjectGrips( obj )
UnselectObjectGrip(object_id, index)
Unselects a single grip owned by an object. If the object's grips are
    not turned on, the grips will not be unselected
Parameters:
object_id = identifier of the object
index = index of the grip to unselect
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select curve", rs.filter.curve)
if obj:
rs.EnableObjectGrips( obj )
for i in xrange(0,count,2):
rs.UnselectObjectGrip( obj, i )
UnselectObjectGrips(object_id)
Unselects an object's grips. Note, the grips will not be turned off.
Parameters:
object_id = identifier of the object
Returns:
Number of grips unselected on success
None on failure
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select object")
if rs.ObjectGripsSelected(obj): rs.UnselectObjectGrips(obj)

group

AddGroup(group_name=None)
Adds a new empty group to the document
Parameters:
group_name[opt] = name of the new group. If omitted, rhino automatically
    generates the group name
Returns:
name of the new group if successful
None is not successful or on error
Example:
import rhinoscriptsyntax as rs
name = rs.AddGroup("NewGroup")
AddObjectsToGroup(object_ids, group_name)
Adds one or more objects to an existing group.
Parameters:
object_ids = list of Strings or Guids representing the object identifiers
group_name = the name of an existing group
Returns:
number of objects added to the group
Example:
import rhinoscriptsyntax as rs
name = "NewGroup"
object_ids = rs.GetObjects("Select objects to add to group")
if object_ids: rs.AddObjectsToGroup(object_ids, name)
AddObjectToGroup(object_id, group_name)
Adds a single object to an existing group.
Parameters:
object_id = String or Guid representing the object identifier
group_name = the name of an existing group
Returns:
True or False representing success or failure
Example:
import rhinoscriptsyntax as rs
name = "NewGroup"
id = rs.GetObject("Select object to add to group")
if id: rs.AddObjectToGroup(id,name)
DeleteGroup(group_name)
Removes an existing group from the document. Reference groups cannot be
    removed. Deleting a group does not delete the member objects
Parameters:
group_name = the name of an existing group
Returns:
True or False representing success or failure
Example:
import rhinoscriptsyntax as rs
groups = rs.GroupNames()
if groups:
for group in groups: rs.DeleteGroup(group)
GroupCount()
Returns the number of groups in the document
Parameters:
None
Returns:
the number of groups in the document
Example:
import rhinoscriptsyntax as rs
numgroups = rs.GroupCount()
print "Group count:", numgroups
GroupNames()
Returns the names of all the groups in the document
    None if no names exist in the document
Parameters:
None
Returns:
the names of all the groups in the document.  None if no names exist in the document
Example:
import rhinoscriptsyntax as rs
groups = rs.GroupNames()
if groups:
for group in groups: print group
HideGroup(group_name)
Hides a group of objects. Hidden objects are not visible, cannot be
    snapped to, and cannot be selected
Parameters:
group_name = the name of an existing group
Returns:
The number of objects that were hidden
Example:
import rhinoscriptsyntax as rs
groups = rs.GroupNames()
if groups:
for group in groups: rs.HideGroup(group)
IsGroup(group_name)
Verifies the existance of a group
Parameters:
group_name = the name of the group to check for
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
group = rs.GetString("Group name to verify")
if rs.IsGroup(group):
print "The group exists."
else:
print "The group does not exist."
IsGroupEmpty(group_name)
Verifies that an existing group is empty, or contains no object members
Parameters:
group_name = the name of an existing group
Returns:
True or False if group_name exists
None if group_name does not exist
Example:
import rhinoscriptsyntax as rs
names = rs.GroupNames()
if names:
for name in names:
if rs.IsGroupEmpty(name): rs.DeleteGroup(name)
LockGroup(group_name)
Locks a group of objects. Locked objects are visible and they can be
    snapped to. But, they cannot be selected
Parameters:
group_name = the name of an existing group
Returns:
Number of objects that were locked if successful
None on error
Example:
import rhinoscriptsyntax as rs
names = rs.GroupNames()
if names:
for name in names: rs.LockGroup(name)
RemoveObjectFromAllGroups(object_id)
Removes a single object from any and all groups that it is a member.
    Neither the object nor the group can be reference objects
Parameters:
object_id = the object identifier
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
object = rs.GetObject("Select object")
if object: rs.RemoveObjectFromAllGroups(object)
RemoveObjectFromGroup(object_id, group_name)
Remove a single object from an existing group
Parameters:
object_id = the object identifier
group_name = the name of an existing group
Returns:
True or False indicating success or failure
Example:
import rhinoscriptsyntax as rs
name = "NewGroup"
id = rs.GetObject("Select object")
if name: rs.RemoveObjectFromGroup(id,name)
RemoveObjectsFromGroup(object_ids, group_name)
Removes one or more objects from an existing group
Parameters:
object_ids = a list of object identifiers
group_name = the name of an existing group
Returns:
The number of objects removed from the group is successful
None on error
Example:
import rhinoscriptsyntax as rs
group = "NewGroup"
ids = rs.GetObjects("Select objects")
if ids: rs.RemoveObjectsFromGroup(ids,group)
RenameGroup(old_name, new_name)
Renames an existing group
Parameters:
old_name = the name of an existing group
new_name = the new group name
Returns:
the new group name if successful
None on error
Example:
import rhinoscriptsyntax as rs
strOldGroup = rs.GetString("Old group name")
if strOldGroup:
strNewGroup = rs.GetString("New group name")
if strNewName: rs.RenameGroup(strOldGroup, strNewGroup)
ShowGroup(group_name)
Shows a group of previously hidden objects. Hidden objects are not
    visible, cannot be snapped to, and cannot be selected
Parameters:
group_name = the name of an existing group
Returns:
The number of objects that were shown if successful
None on error
Example:
import rhinoscriptsyntax as rs
groups = rs.GroupNames()
if groups:
for group in groups: rs.ShowGroup(group)
UnlockGroup(group_name)
Unlocks a group of previously locked objects. Lockes objects are visible,
    can be snapped to, but cannot be selected
Parameters:
group_name = the name of an existing group
Returns:
The number of objects that were unlocked if successful
None on error
Example:
import rhinoscriptsyntax as rs
groups = rs.GroupNames()
if groups:
for group in groups: rs.UnlockGroup(group)

hatch

AddHatch(curve_id, hatch_pattern=None, scale=1.0, rotation=0.0)
Creates a new hatch object from a closed planar curve object
Parameters:
curve_id = identifier of the closed planar curve that defines the
    boundary of the hatch object
hatch_pattern[opt] = name of the hatch pattern to be used by the hatch
    object. If omitted, the current hatch pattern will be used
scale[opt] = hatch pattern scale factor
rotation[opt] = hatch pattern rotation angle in degrees.
Returns:
identifier of the newly created hatch on success
None on error
Example:
import rhinoscriptsyntax as rs
circle = rs.AddCircle(rs.WorldXYPlane(), 10.0)
if rs.IsHatchPattern("Grid"):
rs.AddHatch( circle, "Grid" )
else:
rs.AddHatch( circle, rs.CurrentHatchPattern() )
AddHatches(curve_ids, hatch_pattern=None, scale=1.0, rotation=0.0)
Creates one or more new hatch objects a list of closed planar curves
Parameters:
curve_ids = identifiers of the closed planar curves that defines the
    boundary of the hatch objects
hatch_pattern[opt] = name of the hatch pattern to be used by the hatch
    object. If omitted, the current hatch pattern will be used
scale[opt] = hatch pattern scale factor
rotation[opt] = hatch pattern rotation angle in degrees.
Returns:
identifiers of the newly created hatch on success
None on error
Example:
import rhinoscriptsyntax as rs
curves = rs.GetObjects("Select closed planar curves", rs.filter.curve)
if curves:
if rs.IsHatchPattern("Grid"):
rs.AddHatches( curves, "Grid" )
else:
rs.AddHatches( curves, rs.CurrentHatchPattern() )
AddHatchPatterns(filename, replace=False)
Adds hatch patterns to the document by importing hatch pattern definitions
    from a pattern file.
Parameters:
filename = name of the hatch pattern file
replace[opt] = If hatch pattern names already in the document match hatch
    pattern names in the pattern definition file, then the existing hatch
    patterns will be redefined
Returns:
Names of the newly added hatch patterns if successful
None on error
Example:
import rhinoscriptsyntax as rs
filename = rs.OpenFileName("Import", "Pattern Files (*.pat)|*.pat||")
if filename:
patterns = rs.AddHatchPatterns(filename)
if patterns:
for pattern in patterns: print pattern
CurrentHatchPattern(hatch_pattern=None)
Returns or sets the current hatch pattern file
Parameters:
hatch_pattern[opt] = name of an existing hatch pattern to make current
Returns:
if hatch_pattern is not specified, the current hatch pattern
if hatch_pattern is specified, the previous hatch pattern
None on error
Example:
import rhinoscriptsyntax as rs
if rs.IsHatchPattern("Hatch2"): rs.CurrentHatchPattern("Hatch2")
ExplodeHatch(hatch_id, delete=False)
Explodes a hatch object into its component objects. The exploded objects
    will be added to the document. If the hatch object uses a solid pattern,
    then planar face Brep objects will be created. Otherwise, line curve objects
    will be created
Parameters:
hatch_id = identifier of a hatch object
delete[opt] = delete the hatch object
Returns:
list of identifiers for the newly created objects
None on error
Example:
import rhinoscriptsyntax as rs
id = rs.GetObject("Select object")
if rs.IsHatch(id): rs.ExplodeHatch(id, True)
HatchPattern(hatch_id, hatch_pattern=None)
Returns or changes a hatch object's hatch pattern
Parameters:
hatch_id = identifier of a hatch object
hatch_pattern[opt] = name of an existing hatch pattern to replace the
    current hatch pattern
Returns:
if hatch_pattern is not specified, the current hatch pattern
if hatch_pattern is specified, the previous hatch pattern
None on error
Example:
import rhinoscriptsyntax as rs
objects = rs.AllObjects()
if objects is not None:
for obj in objects:
if rs.IsHatch(obj) and rs.HatchPattern(obj)=="Solid":
rs.SelectObject(obj)
HatchPatternCount()
Returns the number of hatch patterns in the document
Parameters:
None
Returns:
the number of hatch patterns in the document
Example:
import rhinoscriptsyntax as rs
print "There are", rs.HatchPatternCount(), "hatch patterns."
See Also:
HatchPatternDescription(hatch_pattern)
Returns the description of a hatch pattern. Note, not all hatch patterns
    have descriptions
Parameters:
hatch_pattern = name of an existing hatch pattern
Returns:
description of the hatch pattern on success otherwise None
Example:
import rhinoscriptsyntax as rs
patterns = rs.HatchPatternNames()
for pattern in patterns:
description = rs.HatchPatternDescription(pattern)
if description:print pattern, "-", description
HatchPatternFillType(hatch_pattern)
Returns the fill type of a hatch pattern.
        0 = solid, uses object color
        1 = lines, uses pattern file definition
        2 = gradient, uses fill color definition
Parameters:
hatch_pattern = name of an existing hatch pattern
Returns:
hatch pattern's fill type if successful otherwise None
Example:
import rhinoscriptsyntax as rs
patterns = rs.HatchPatternNames()
for pattern in patterns:
fill = rs.HatchPatternFillType(pattern)
print pattern, "-", fill
HatchPatternNames()
Returns the names of all of the hatch patterns in the document
Parameters:
None
Returns:
the names of all of the hatch patterns in the document
Example:
import rhinoscriptsyntax as rs
patterns = rs.HatchPatternNames()
for pattern in patterns:
description = rs.HatchPatternDescription(pattern)
if description: print pattern, "-", description
else: print pattern
See Also:
HatchRotation(hatch_id, rotation=None)
Returns or modifies the rotation applied to the hatch pattern when
    it is mapped to the hatch's plane
Parameters:
hatch_id = identifier of a hatch object
rotation[opt] = rotation angle in degrees
Returns:
if rotation is not defined, the current rotation angle
if rotation is specified, the previous rotation angle
None on error
Example:
import rhinoscriptsyntax as rs
objects = rs.AllObjects()
if objects:
for obj in objects:
if rs.IsHatch(obj) and rs.HatchRotation(obj)>0:
rs.HatchRotation(obj,0)
HatchScale(hatch_id, scale=None)
Returns or modifies the scale applied to the hatch pattern when it is
    mapped to the hatch's plane
Parameters:
hatch_id = identifier of a hatch object
scale[opt] = scale factor
Returns:
if scale is not defined, the current scale factor
if scale is defined, the previous scale factor
None on error
Example:
import rhinoscriptsyntax as rs
objects = rs.NormalObjects()
if objects:
for obj in objects:
if rs.IsHatch(obj) and rs.HatchScale(obj)>1.0:
rs.HatchScale(obj, 1.0)
IsHatch(object_id)
Verifies the existence of a hatch object in the document
Parameters:
object_id = identifier of an object
Returns:
True or False
Example:
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select object")
if rs.IsHatch(obj): print "Object is a hatch"
else: print "Object is not a hatch"