GRAPHISOFT®

Python APIVersion: 0.23 Beta

DrawingData

Represents the contents of a Drawing element.

class DrawingData

 

Members

The structure does not have any visible members.

 

Methods

GetBounds: Returns the calculated boundaries of the Drawing.
StartDrawing: Enters Drawing mode, redirecting Element creation to the contained handle.
StopDrawing: Exits Drawing mode, preparing the boundaries and handle of the Drawing data.

 

Remarks

A DrawingData instance is uninitialized by default. The GetBounds and GetHandle methods are only usable on initialized DrawingData instances. The string representation of a DrawingData instance displays its status.

To initialize a DrawingData instance, one must enter Drawing mode, add elements to the data handle by using the Element Creation functions, and then exit it.

 

Example

def DrawCircle (x, y, r):
    element = APIObject ()
    element.head = APIObject ()
    element.head.typeID = API_ArcID
    element.whole = True
    element.origC = APIObject ()
    element.origC.x = x
    element.origC.y = y
    element.r = r
    return CreateArc (element)

def MakeDrawing (scale):
    element = APIObject ()
    element.head = APIObject ()
    element.head.typeID = API_DrawingID
    element.head.hasMemo = True
    memo = APIObject ()
    drawingData = DrawingData ()
    drawingData.StartDrawing (scale)
    with UndoScope ("Create Drawing Elements"):
        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)

MakeDrawing (100)

 

Requirements

Version: Python API 0.1 or Later
Module: GS

 

See Also

All types