GRAPHISOFT®

Python APIVersion: 0.23 Beta

CreateDrawing

Creates an Drawing element.

def CreateDrawing (element) -> String

 

Parameters

element
[in] An APIObject describing the Drawing element to create.

 

Return Values

This function returns the GUID of the created element.

 

Remarks

This function is analogous to the ACAPI_Element_Create function of the C++ API for Drawing elements. Undefined members will be set to the current defaults.

For information on how to fill the passed APIObject, visit the C++ documentation.

 

Example

def MakeDrawing (scale):
    element = APIObject ()
    element.head = APIObject ()
    element.head.typeID = API_DrawingID
    element.head.hasMemo = True
    memo = APIObject ()
    drawingData = DrawingData ()
    drawingData.StartDrawing (scale)
    DrawText (-0.45, 0.2, "Hello")
    DrawCircle (0, 0, 1)
    DrawCircle (0, 0, 2)
    DrawCircle (0, 0, 3)
    DrawCircle (0, 0, 4)
    DrawCircle (0, 0, 5)
    drawingData.StopDrawing ()
    memo.drawingData = drawingData
    element.bounds = drawingData.GetBounds ()
    element.bounds.xMin -= 1
    element.bounds.yMin -= 1
    element.bounds.xMax += 1
    element.bounds.yMax += 1
    element.nameType = APIName_CustomName
    element.name = "Test Drawing"
    return CreateDrawing (element, memo)

def ChangeDrawingTest (guid):
    element = GetDrawing (guid)
    element = element[0]
    element.hasBorderLine = True
    element.borderLineType = 1
    element.borderPen += 2
    element.borderSize *= 1.5
    element.angle = 3.141592654 / 12 # 15 Degrees
    element.colorMode = APIColorMode_GrayScale
    return ChangeDrawing (element, APIObject ())

drawing = MakeDrawing (100)
ChangeDrawingTest (drawing)

 

Requirements

Version: Python API 0.1 or Later
Module: GS

 

See Also

ChangeDrawing, GetDrawing

All functions