Predefined Functions

The functions on this page are predefined for use within any DrawScript-Python script.

Adding More

This list is not final. You can suggest new functions to add to this list!

make_attributes(layer_name: str, color: tuple[int, int, int, int] = None, linetype: str = None, name: str = None) shapemachine.geometry.ElementAttributes

Bundle together shape element attributes into a format usable by Shape Machine. The returned shapemachine.geometry.ElementAttributes can be used to output new geometry with the inputted properties.

Parameters:
  • layer_name – The name of the layer to use. If this layer doesn’t exist in the model, Shape Machine will create a new layer with this name and the specified color (if provided).

  • color – A 0-255 RGBA tuple to use as the color. If None, Shape Machine will use the indicated layer’s default color.

  • linetype – The name of the linetype to use. If a linetype with this name doesn’t exist in the model, Shape Machine will throw an error. If None, Shape Machine will use the indicated layer’s default linetype.

  • name – A name to provide to any geometry created with these attributes.

Returns:

shapemachine.geometry.ElementAttributes that can be used to create and output new geometry.

pause() None

Pauses the execution of the rule sequence or DrawScript program. Will only resume when you press the Resume button on the popup Shape Machine creates when execution of the rule sequence or DrawScript program begins.

stop() None

Stops the execution of the rule sequence or DrawScript program immediately.