Adds a new block definition to the document.
rhinoscriptsyntax.AddBlock (object_ids, base_point, name=None, delete_input=False)
rhinoscript.block.AddBlock (object_ids, base_point, name=None, delete_input=False)
object_ids |
Required. List or tuple. The identifiers of one or more objects that will be included in the block definition. Note, the specified objects will be copied. |
base_point |
Required. Point3d. The 3-D base point of the block definition. |
name |
Optional. String. The name of the block definition to add. If omitted, a name will be automatically generated. Note, if the name of the block definition already exists, then the existing block definition will be modified. |
delete_input |
Optional. Boolean. Delete the input objects. By default, input objects will not be deleted (False). |
String |
The name of the newly created block definition, if successful. |
None |
If not successful, or on error. |
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)