HOME

PYPCAD


Functions

  • variants
  • Apoint
  • aDouble
  • ArrayTransform
  • VtVertex
  • VtObject
  • VtFloat
  • VtInt
  • VtVariant
  • AngleDtoR
  • AngleRtoD
  • FilterType
  • FilterData
  • Space
  • AppPath
  • SendCommand
  • RApps
  • RAppNames
  • SetXData
  • LayoutNames
  • EnterLayout
  • SetVariable
  • GetVariable
  • OpenFile
  • CreateNewFile
  • SaveFile
  • SaveAsFile
  • Close
  • PurgeAll
  • Regen
  • OpenedFilenames
  • OpenedFilenumbers
  • GetOpenedFile
  • ActivateFile
  • DeepClone
  • CurrentFilename
  • FilePath
  • IsSaved
  • ZoomExtents
  • ZoomAll
  • GridOn
  • SnapOn
  • AddPoint
  • AddLine
  • AddLwpline
  • AddCircle
  • AddArc
  • AddTable
  • AddSpline
  • AddEllipse
  • AddHatch
  • AddSolid
  • AboutEntityObject
  • Handle2Object
  • GetEntityByItem
  • GetSelectionSets
  • CreateLayer
  • ActivateLayer
  • LayerNumbers
  • LayerNames
  • GetLayer
  • Layers
  • ActiveLayer
  • LoadLinetype
  • ActivateLinetype
  • ShowLineweight
  • Linetypes
  • CreateBlock
  • InsertBlock
  • CreateUCS
  • ActivateUCS
  • GetCurrentUCS
  • ShowUCSIcon
  • CreateTextStyle
  • ActivateTextStyle
  • GetActiveFontInfo
  • SetActiveFontFile
  • SetActiveBigFontFile
  • AddText
  • AddMText
  • AddDimAligned
  • AddDimRotated
  • AddDimRadial
  • AddDimDiametric
  • AddDimAngular
  • AddDimOrdinate
  • AddLeader
  • CreateDimStyle
  • DimStyleNumbers
  • DimStyleNames
  • DimStyle0
  • DimStyles
  • ActiveDimStyle
  • GetDimStyle
  • ActivateDimStyle
  • GetString
  • AngleFromXAxis
  • GetAngle
  • GetPoint
  • GetDistance
  • InitializeUserInput
  • GetKeyword
  • GetEntity
  • GetReal
  • GetInteger
  • prompt
  • Preferences
  • app
  • doc
  • iter_layouts
  • iter_objects
  • iter_objects_fast
  • find_one
  • get_selection
  • distance
  • x
  • y
  • z
  • .variants(object)
    Converts object in python into required variant.

    Parameters:
    • object: Any

    Return Type: variant
  • .Apoint(x, y, z)
    Converts x,y,z into required float array as the arguments of coordinates of a point.

    Parameters:
    • x: int or float
    • y: int or float
    • z: int or float

    Return Type: variant array of coordinates of a point
  • .aDouble()
    Converts *argv into required float variant.

    Parameters:
    • *argv: tuple

    Return Type: float variant
  • .ArrayTransform(x)
    Converts x into required float variant.

    Parameters:
    • x: any kind of array in python

    Return Type: float variant
  • .VtVertex()
    Converts *args into the required float variant.

    Parameters:
    • *args: 2D coordinates of a serial points in tuple

    Return Type: float variant
  • .VtObject()
    Converts *obj in python into required object array.

    Parameters:
    • *obj: tuple

    Return Type: object variant
  • .VtFloat(list)
    Converts list in python into required float.

    Parameters:
    • list: list

    Return Type: float variant
  • .VtInt(list)
    Converts list in python into required int.

    Parameters:
    • list: list

    Return Type: int variant
  • .VtVariant(list)
    Converts list in python into required variant.

    Parameters:
    • list: list

    Return Type: variant
  • .AngleDtoR(degree)
    Convert degree to radian.

    Parameters:
    • degree: int or float

    Return Type: int or float
  • .AngleRtoD(radian)
    Convert radian to degree.

    Parameters:
    • degree: int or float

    Return Type: int or float
  • .FilterType(ftype)
    Converts ftype to filter type value refer to DXF reference to learn about DXF group code.

    Parameters:
    • ftype: DXF group code

    Return Type: variant
  • .FilterData(fdata)
    Converts fdata to filter data value refer to DXF reference to learn about DXF group code.

    Parameters:
    • ftype: DXF group code

    Return Type: variant
  • .Space(self)
    Automatically deciding the active layout is ModelSpace or PaperSpace.


    Return Type: ModelSpace or PaperSpace

    See also..

  • .AppPath(self)
    Returns PyPCAD Application path.


    Return Type: String
  • .SendCommand(self, command)
    Sends a command string from script
    for example, to draw a circle whose center is 0,0,0, and radius is 100
    >>>pypcad.SendCommand('circle 0,0,0 100 ')
    #Please notice that there is a blank following 100, meaning the end of input.

    Parameters:
    • command: String

    No Return Type
  • .RApps(self)
    Returns registered applications collections.


    Return Type: RegisteredApplications

    See also..

  • .RAppNames(self)
    Returns registerd application names list.


    Return Type: list of strings
  • .SetXData(self, entity, xdataPairs)
    Sets XData for entity
    >>>circle=pypcad.AddCircle(Apoint(0,0),20)
    >>>pypcad.SetXdata(circle,[(1001,'test'),(1000,'this is an example')]).

    Parameters:
    • entity: entity
    • xdataPairs: list containing tuple which represent xdataType and xdata

    No Return Type
  • .LayoutNames(self)
    Gets Layouts name.


    Return Type: Layouts

    See also..

  • .EnterLayout(self, name_or_index)
    Enters layout, so the active layout may become model,or one paperspace
    For example:
    >>>pypcad.EnterLayout('model') #Enter the modelSpace
    >>>pypcad.EnterLayout('onePaperSpace') #Enter the paperSpace named onePaperSpace
    >>>pypcad.EnterLayout('notExist') # Will raise an error
    >>>pypcad.EnterLayout(0) # Enter the modelSpace.

    Parameters:
    • name_or_index: string or int

    No Return Type
  • .SetVariable(self, name, value)
    Sets system variable.

    Parameters:
    • name: string
    • value: object

    No Return Type
  • .GetVariable(self, name)
    Gets system variable.

    Parameters:
    • name: string

    Return Type: dynamic
  • .OpenFile(self, path)
    Opens a dwg file in the path.

    Parameters:
    • path: string

    Return Type: Document

    See also..

  • .CreateNewFile(self)
    Creates a new dwg file,by default name.


    Return Type: Document

    See also..

  • .SaveFile(self)
    Saves file.


    No Return Type
  • .SaveAsFile(self, path)
    Saves as file.

    Parameters:
    • path: String

    No Return Type
  • .Close(self)
    Close current file.


    No Return Type
  • .PurgeAll(self)
    Removes unused named references such as unused blocks or layers from the document.
    This method is the equivalent of entering purge at the Command prompt, selecting the
    All option, and then choosing Yes to the "Purge Everything?" prompt.


    No Return Type
  • .Regen(self, enum)
    Regenerates the entire drawing and recomputes the screen coordinates and view resolution for all objects.

    Parameters:
    • enum: 0:Regenerates only the active viewport

    No Return Type
  • .OpenedFilenames(self)
    Returns opened file names.


    Return Type: list
  • .OpenedFilenumbers(self)
    Returns opened files count.


    Return Type: int
  • .GetOpenedFile(self, file)
    Returns already opened file whose index is index or name is name as the Current file.

    Parameters:
    • file: int or string

    Return Type: Document

    See also..

  • .ActivateFile(self, file)
    Activates already opened file whose index is index or name is name as the Current file.

    Parameters:
    • file: int or string

    No Return Type
  • .DeepClone(self, objects, Owner, IDPairs)
    Deep clone objects from current file to specified file's ModelSpace
    For example:
    >>>from pycomcad import *
    >>>pypcad=PyPCAD()
    >>>te1=pypcad.AddCircle(Apoint(0,0,0),200)
    >>>te2=pypcad.AddCircle(Apoint(100,100,0),200)
    >>>pypcad.CreateNewFile()
    >>>pypcad.ActivateFile(0)
    >>>result=pypcad.DeepClone((te1,),1)
    # Deep Clone one object,notice the naunce between (te1,)and (te1),the latter one is int
    >>>result[0][0].Move(Apoint(0,0,0),Apoint(100,100,0))
    >>>pypcad.CurrentFilename
    >>>slt=pypcad.GetSelectionSets('slt1')
    >>>slt.SelectOnScreen()
    >>>result1=pypcad.DeepClone(slt,'Drawing2.dwg').

    Parameters:
    • objects: SelectionSet(selection sets) or tuple of entity object
    • Owner: string or index of file
    • IDPairs: variant.Default value has been set

    Return Type: tuple of deep cloned object
  • .CurrentFilename(self)
    Returns the name of current file name.


    Return Type: String
  • .FilePath(self)
    Returns current file path.


    Return Type: String
  • .IsSaved(self)
    Specifies if the document has any unsaved changes.


    Return Type: True or False
  • .ZoomExtents(self)
    Zooms to extents of entities.


    No Return Type
  • .ZoomAll(self)
    Zooms all entities.


    No Return Type
  • .GridOn(self, boolean)
    Sets grid value.

    Parameters:
    • boolean: True or False

    No Return Type
  • .SnapOn(self, boolean)
    Sets snap value.

    Parameters:
    • boolean: True or False

    No Return Type
  • .AddPoint(self, apoint)
    Adds point in ActiveSpace.

    Parameters:
    • apoint: APoint

    Return Type: Point

    See also..

  • .AddLine(self, startPoint, endPoint)
    Adds Line in ActiveSpace.

    Parameters:
    • startPoint: APoint
    • endPoint: APoint

    Return Type: Line

    See also..

  • .AddLwpline(self)
    Adds lightweight polyline in ActiveSpace, this method is recommended to draw line.

    Parameters:
    • *vertexCoord: tuple of vertices

    Return Type: LWPolyline

    See also..

  • .AddCircle(self, centerPnt, radius)
    Adds circle in ActiveSpace.

    Parameters:
    • centerPnt: APoint
    • radius: int or float

    Return Type: Line

    See also..

  • .AddArc(self, centerPnt, radius, startAngle, endAngle)
    Adds arc in ActiveSpace.

    Parameters:
    • centerPnt: APoint
    • radius: int or float
    • startAngle: int or float
    • endAngle: int or float

    Return Type: Arc

    See also..

  • .AddTable(self, InsertionPoint, NumRows, NumColumns, RowHeight, ColWidth)
    Adds table in ActiveSpace.

    Parameters:
    • InsertionPoint: Apoint
    • NumRows: int
    • NumColumns: int
    • RowHeight : int or float
    • ColWidth : int or float

    Return Type: Table

    See also..

  • .AddSpline(self)
    Adds Spline in ActiveSpace.

    Parameters:
    • fitPoints: tuple
    • startTan: APoint
    • endTan: APoint

    Return Type: Spline

    See also..

  • .AddEllipse(self, centerPnt, majorAxis, radiusRatio)
    Adds Ellipse in ActiveSpace.

    Parameters:
    • centerPnt: APoint
    • majorAxis: APoint
    • radiusRatio: int or float

    Return Type: Ellipse

    See also..

  • .AddHatch(self, patternType, patterName, associative, outLoopTuple, innerLoopTuple)
    Adds Hatch in ActiveSpace.
    The note of arguments can be seen as below:
    (1)patternType is the built-in integer constants which can be got by win32com.client.constants.X,here x can be
    acHatchPatternTypeDefined(it means that using standard application's pattern drawing file to hatch, and the integer is 1),
    acHatchPatternTypeUserDefined(it means that using the current linetype to hatch,and the integer is 0),
    acHatchPatternTypeCustomDefined(it means that using user-defined drawing file to hatch,and the integer is 2)
    (2)patterName is a string specifying the hatch pattern name, such as "SOLID","ANSI31"
    (3)associative is boolean. If it is True, when the border is modified, the hatch pattern will adjust automatically
    to keep in the modified border.
    (4)outLoop is a sequence of object,such as line,circle,etc. For example, outLoopTuple=(circle1,),or outLoopTuple=(line1,line2,
    line3).
    (5)innerLoop is the same with outLoop

    Parameters:
    • patternType: int
    • patterName: string
    • associative: True or False
    • outLoopTuple: tuple
    • innerLoopTuple: tuple

    Return Type: Hatch

    See also..

  • .AddSolid(self, pnt1, pnt2, pnt3, pnt4)
    Adds 2D Solid Polygon in ActiveSpace.

    Parameters:
    • pnt1: APoint
    • pnt2: APoint
    • pnt3: APoint
    • pnt4: APoint

    Return Type: Solid

    See also..

  • .AboutEntityObject(self)
    <This method is created only for the noting purpose>
    About editting PyPCAD entity object:Users shall consult the reference document for exact supported property in terms of every kind of cad
    entity.Some commen property and method has been summed up as below:
    (1)Commen Property:
    (a)object.color=X
    X:built-in contant, such as win32com.client.constants.acRed.Here,color is lowercase.
    (b)object.Layer=X
    X:string, the name of the layer
    (c)object.Linetype=X
    X:string,the name of the loaded linetype
    (d)object.LinetypeScale=X
    X:float,the linetype scale
    (e)object.Visible=X
    X:boolean,Determining whether the object is visible or invisible
    (f)object.EntityType
    read-only,returns an integer.
    (g)object.EntytyName
    read-only,returns a string
    (h)object.Handle
    read-only,returns a string
    (i)object.ObjectID
    read-only,returns a long integer
    (j)object.Lineweight=X
    X:built-in constants,(For example, win32com.client.constants.acLnWt030(0.3mm),acLnWt120 is
    1.2mm, and the scope of lineweight is 0~2.11mm),or acByLayer(the same with the layer
    where it lies),acByBlock,acBylwDefault.

    (2)Commen Method:
    (a)Copy
    RetVal=object.Copy
    RetVal: New created object
    object:Drawing entity,such as Arc,Line,LightweithPolyline,Spline,etc.

    (b)Offset
    RetVal=object.Offset(Distance)
    RetVal:New created object tuple
    Distance:Double,positive or negative
    object:Drawing entity,such as Arc,Line,LightweithPolyline,Spline,etc.

    (c)Mirror
    RetVal=object.Mirror(point1,point2)
    RetVal:mirror object
    point1,point2:end of mirror axis, Apoint type.
    object:Drawing entity,such as Arc,Line,LightweithPolyline,Spline,etc.

    (d)ArrayPolar
    RetVal=object.ArrayPolar(NumberOfObject,AngleToFill,CenterPoint)
    RetVal:New created object tuple
    NumberOfObject:integer,the number of array object(including object itself)
    AngleToFill:Double,rad angle, positive->anticlockwise,negative->clockwise
    CenterPoint:Double,Apoint type. The center of the array.
    object:Drawing entity,such as Arc,Line,LightweithPolyline,Spline,etc.

    (e)ArrayRectangular
    RetVal=object.ArrayRectangular(NumberOfRows,NumberOfColumns,NumberOfLevels,
    DistBetweenRows,DistBetweenColumns,DistBetweenLevels)
    RetVal:new created object tuple
    NumberOfRows,NumberOfColumns,NumberOfLevels:integer,the number of row,column,level,
    if it is the plain array that is performed, NumberOfLevels=1
    DistBetweenRows,DistBetweenColumns,DistBetweenLevels:Double,the distance between rows,
    columns,levels respectively.When NumberOfLevels=1,DistBetweenLevels is valid but still
    need to be passed
    object:Drawing entity,such as Arc,Line,LightweithPolyline,Spline,etc.

    (f)Move
    object.Move(point1,point2)
    object:Drawing entity,such as Arc,Line,LightweithPolyline,Spline,etc.
    point1,point2:Double,Apoint type. The moving vector shall be determined by the
    two points and point1 is the start point, point2 is the end point.

    (g)Rotate
    object.Rotate(BasePoint,RotationAngle)
    object:Drawing entity,such as Arc,Line,LightweithPolyline,Spline,etc.
    BasePoint:Double,Apoint type.The rotation basepoint.
    RotationAngle:Double,rad angle.

    (h)ScaleEntity
    object.ScaleEntity(BasePoint,ScaleFactor)
    object:Drawing entity,such as Arc,Line,LightweithPolyline,Spline,etc.
    BasePoint:Double,Apoint type.The scale basepoint.
    ScaleFactor:Double,Apoint type.

    (i)Erase
    object.Erase()
    object:Choosed set
    Delete all entity in the choosen scope

    (J)Delete
    object.Delete()
    object:specified entity, as for set object,such as modelSpace set and layerSet , this
    method is valid.

    (k)Update
    object.Update()
    update object after some kind of the objects' editing.

    (L)color
    object.color
    Here attention please, it is color,Not Color.(lowercase)

    (M)TransformBy
    object.TransformBy(transformationMatrix)
    object:Drawing entity,such as Arc,Line,LightweithPolyline,Spline,etc.
    transformationMatrix:4*4 Double array, need to be passed to ArrayTransform() method to be the required type


    (3)Refer to Object

    (a)HandleToObject
    RetVal=object.HandleToObject(Handle)
    Retval:the entity object corresponding to Handle
    object:Document object
    Handle: the handle of entity object

    (b)ObjectIdToObject
    RetVal=object.ObjectIdToObject(ID)
    RetVal:the entity object corresponding to ID
    object:Document object
    ID: the identifier of object


    No Return Type
  • .Handle2Object(self, handle)
    Returns the object of specified handle.

    Parameters:
    • handle: string

    Return Type: object of specified handle
  • .GetEntityByItem(self, i)
    Returns the Entity on specified index.

    Parameters:
    • i: int

    Return Type: Entity

    See also..

  • .GetSelectionSets(self, setname)
    Adds selection set to selectionsets
    There are 2 steps to select entity object:
    (1) create selection set
    (2)Add entity into set
    Also note that: one set once has been created,
    it can never be created again, unless it is
    deleted.
    This method provides the first step.
    For example:
    >>>ft=[0, -4, 40, 8] # define filter type
    >>>fd=['Circle', '>=', 5, '0'] #define filter data
    >>>ft=VtInt(ft) # data type Convertion
    >>>fd=VtVariant(fd) #data type Convertion
    >>>slt=pypcad.GetSelectionSets('slt') # Create selectionset object
    >>>slt.SelectOnScreen(ft,fd) # select on screen
    >>>slt.Erase() # Erase selected entity
    >>>slt.Delete() # Delete selectionsets object
    Using select method:
    >>>slt=pypcad.GetSelectionSets('slt1')
    >>>slt.Select(Mode=win32com.client.constants.acSelectionSetAll,FilterType=ft,FilterData=fd) # Attention about the keyword arguments
    (3) Using SelectByPolygon method to automatically select entity
    >>>pnt=pypcad.GetPoint()
    >>>pnt1=pypcad.GetPoint()
    >>>pnt2=pypcad.GetPoint()
    >>>pnt3=pypcad.GetPoint() # select 4 points
    >>>c=list(pnt)+list(pnt1)+list(pnt2)+list(pnt3)
    >>>slt=pypcad.GetSelectionSets('test2')
    >>>slt.SelectByPolygon(Mode=win32com.client.constants.acSelectionSetWindowPolygon,PointsList=VtVertex(*c)).

    Parameters:
    • setname: string

    Return Type: Selectionset
  • .CreateLayer(self, layername)
    Creates new layer.

    Parameters:
    • layername: string

    Return Type: Layer

    See also..

  • .ActivateLayer(self, layer)
    Activates layer.

    Parameters:
    • layer: int or string

    Return Type: Layer

    See also..

  • .LayerNumbers(self)
    Returns the number of layers in the active document.


    Return Type: int
  • .LayerNames(self)
    Returns a list containing all layer names.


    Return Type: list
  • .GetLayer(self, layer)
    Gets an indexed layer.

    Parameters:
    • layer: int or string

    Return Type: Layer

    See also..

  • .Layers(self)
    Returns layer set object.


    Return Type: Layers

    See also..

  • .ActiveLayer(self)
    Returns ActiveLayer object.


    Return Type: Layer

    See also..

  • .LoadLinetype(self, typename, filename)
    Loads linetype in ActiveDocument.
    typename:string, the name of type needed to be load.such as 'dashed','center'
    filename:string, the name of the file the linetype is in.'pypcad.lin','pypcadiso.lin'

    Parameters:
    • typename: string
    • filename: string

    No Return Type
  • .ActivateLinetype(self, typename)
    Activate linetype in ActiveDocument.
    typename:string, the name of type needed to be load.such as 'dashed','center'

    Parameters:
    • typename: string

    Return Type: LineType
  • .ShowLineweight(self, TrueorFalse)
    Sets whether the lineweight be shown or not.

    Parameters:
    • TrueorFalse: True or False

    No Return Type
  • .Linetypes(self)
    Returns linetype set.


    Return Type: LineTypes

    See also..

  • .CreateBlock(self, insertPnt, blockName)
    Creates Block.

    Parameters:
    • insertPnt: APoint
    • blockName: string

    Return Type: Block

    See also..

  • .InsertBlock(self, insertPnt, blockName, Xscale, Yscale, Zscale, Rotation)
    Adds Block to ActiveSpace.

    Parameters:
    • insertPnt: APoint
    • blockName: string

    Return Type: BlockReference

    See also..

  • .CreateUCS(self, origin, xAxisPnt, yAxisPnt, csName)
    Creats UCS to ActiveSpace.
    origin:Apoint type,origin point of the new CS
    xAxisPnt:Apoint type,one point directing the positive direction of x axis of the new CS
    yAxisPnt:Apoint type,one point directing the positive direction of y axis of the new CS
    csName:string,the name of the new CS

    Parameters:
    • origin: APoint
    • xAxisPnt: APoint
    • yAxisPnt: APoint
    • csName: string

    Return Type: UCS

    See also..

  • .ActivateUCS(self, ucsObj)
    Activates UCS object.

    Parameters:
    • ucsObj: UCS

    Return Type: UCS

    See also..

  • .GetCurrentUCS(self)
    Gets current UCS object.


    Return Type: UCS

    See also..

  • .ShowUCSIcon(self, booleanOfUCSIcon, booleanOfUCSatOrigin)
    Shows UCS Icon.
    booleanOfUCSIcon:boolean,Specifies if the UCS icon is on
    booleanOfUCSatOrigin:boolean,Specifies if the UCS icon is displayed at the origin

    Parameters:
    • booleanOfUCSIcon: True or False
    • booleanOfUCSatOrigin: True or False

    No Return Type
  • .CreateTextStyle(self, textStyleName)
    Creates text style.

    Parameters:
    • textStyleName: string

    Return Type: TextStyle

    See also..

  • .ActivateTextStyle(self, textStyleObj)
    Activates the created textstyle object.

    Parameters:
    • textStyleObj: textStyle object

    Return Type: TextStyle

    See also..

  • .GetActiveFontInfo(self)
    Returns a tuple (typeFace,Bold,Italic,charSet,PitchandFamily) of the active textstyle object.


    Return Type: tuple
  • .SetActiveFontFile(self, path)
    Sets the active textstyle's font file by the path of character file,
    for example, path=self.pypcad.Path+r' ssdeng.shx'.

    Parameters:
    • path: string

    No Return Type
  • .SetActiveBigFontFile(self, path)
    Sets the active Asian-language Big Font file by the path of character file,
    This property is similar to the FontFile property, except that it is used to specify
    an Asian-language Big Font file. The only valid file type is SHX.

    Parameters:
    • path: string

    No Return Type
  • .AddText(self, textString, insertPnt, height)
    Adds single text in ActiveSpace.
    textString:string,the inserted single text
    insertPnt:Apoint type,insert point
    height:the text height

    Parameters:
    • textString: string
    • insertPnt: Apoint
    • height: int or float

    Return Type: Text

    See also..

  • .AddMText(self, textString, insertPnt, width)
    Creates an MText entity in a rectangle defined by the insertion point and width of the bounding box.

    Parameters:
    • textString: string
    • insertPnt: Apoint
    • width: int or float

    Return Type: MText

    See also..

  • .AddDimAligned(self, extPnt1, extPnt2, textPosition)
    Creates an aligned dimension object
    extPnt1:Apoint type,the 3D WCS coordinates specifying the first endpoint of the extension line
    extPnt2:Apoint type,the 3D WCS coordinates specifying the second endpoint of the extension line
    textPosition:Apoint type,the 3D WCS coordinates specifying the text position

    Parameters:
    • extPnt1: Apoint
    • extPnt2: Apoint
    • textPosition: Apoint

    Return Type: DimAligned

    See also..

  • .AddDimRotated(self, xlPnt1, xlPnt2, dimLineLocation, rotAngle)
    Creates a rotated linear dimension
    xlPnt1:Apoint type,the 3D WCS coordinates specifying the first endpoint of the extension line
    xlPnt2:Apoint type,the 3D WCS coordinates specifying the first endpoint of the extension line
    rotAngle:Double,The angle, in radians, of rotation displaying the linear dimension

    Parameters:
    • xlPnt1: Apoint
    • xlPnt2: Apoint
    • dimLineLocation: Apoint
    • rotAngle: int or float

    Return Type: DimRotated

    See also..

  • .AddDimRadial(self, center, chordPnt, leaderLength)
    Creates a radial dimension for the selected object at the given location
    center:Apoint type
    chordPnt:Apoint type,The 3D WCS coordinates specifying the point on the circle or arc to attach the leader line
    leaderLength:double,The positive value representing the length from the ChordPoint to the annotation text

    Parameters:
    • center: Apoint
    • chordPnt: Apoint
    • leaderLength: int or float

    Return Type: DimRadial

    See also..

  • .AddDimDiametric(self, chordPnt, farChordPnt, leaderLength)
    Creates a diametric dimension for a circle or arc given the two points on the diameter and the length of the leader line
    chordPnt:Apoint type,The 3D WCS coordinates specifying the first diameter point on the circle or arc
    farChordPnt:Apoint type,The 3D WCS coordinates specifying the second diameter point on the circle or arc
    leaderLength:The positive value representing the length from the ChordPoint to the annotation text or dogleg, when it is 0,
    using obj.Fit=win32com.client.constants.acTextAndArrows can make the arrow and text inside the circle or dogleg

    Parameters:
    • chordPnt: Apoint
    • farChordPnt: Apoint
    • leaderLength: int or float

    Return Type: DimDiametric

    See also..

  • .AddDimAngular(self, vertex, firstPnt, secondPnt, textPnt)
    Creates an angular dimension for an arc, two lines, or a circle
    vertex,Apoint type,The 3D WCS coordinates specifying the center of the circle or arc, or the common vertex between the two dimensioned lines
    firstPnt,Apoint type,The 3D WCS coordinates specifying the point through which the first extension line passes
    secondPnt,Apoint type,The 3D WCS coordinates specifying the point through which the second extension line passes
    textPnt,Apoint type,The 3D WCS coordinates specifying the point at which the dimension text is to be displayed

    Parameters:
    • vertex: Apoint
    • firstPnt: Apoint
    • secondPnt: Apoint
    • textPnt: Apoint

    Return Type: DimAngular

    See also..

  • .AddDimOrdinate(self, definitionPnt, leaderPnt, axis)
    Creates an ordinate dimension given the definition point and the leader endpoint
    definitionPnt,Apoint type,The 3D WCS coordinates specifying the point to be dimensioned
    leaderPnt,Apoint type,The 3D WCS coordinates specifying the endpoint of the leader. This will be the location at which the dimension text is displayed
    axis,Boolean,True: Creates an ordinate dimension displaying the X axis value;False: Creates an ordinate dimension displaying the Y axis value

    Parameters:
    • definitionPnt: Apoint
    • leaderPnt: Apoint
    • axis: true or false

    Return Type: DimOrdinate

    See also..

  • .AddLeader(self)
    Creates a leader line based on the provided coordinates or adds a new leader cluster to the MLeader object
    pntArray,The array of 3D WCS coordinates,such as (1,2,3,4,5,6), specifying the leader. You must provide at least two points to define the leader. The third point is optional
    annotation,BlockReference,MText,Tolerance type.The object that should be attached to the leader. The value can also be NULL to not attach an
    Type:built-in contants, win32com.client.constants.X,X is as the following:
    acLineNoArrow
    acLineWithArrow
    acSplineNoArrow
    acSplineWithArrow
    >>>ann=pypcad.AddMText('demo',Apoint(30,30,0),2)
    >>>import win32com.client
    >>>pypcad.AddLeader(0,0,0,30,30,0,annotation=a,type=win32com.client.constants.acLineWithArrow)

    Parameters:
    • *pntArray: tuple
    • annotation: Entity object
    • type: LeaderType object

    Return Type: Leader

    See also..

  • .CreateDimStyle(self, name)
    creat a new dimension style named name.
    name:string
    Once created, Using the created dimstyle object's CopyFrom() method to get an existed dimstyle's
    attributes.DimStyle0 is prefered to be copied from,when a new dim factor is needed, just reset corresponding system variable.For example:
    >>>pypcad=PyPCAD()
    >>>testDim=pypcad.CreateDimStyle('test')
    >>>pypcad.SetSystemVariable('dimlfac',100)
    >>>testDim.CopyFrom(pypcad.DimStyle0)

    Parameters:
    • name: string

    Return Type: DimStyle

    See also..

  • .DimStyleNumbers(self)
    Returns the total number of defined dim style.


    Return Type: int
  • .DimStyleNames(self)
    Returns list,all names of defined dim style.


    Return Type: list
  • .DimStyle0(self)
    Returns created dimension style object whose index is 0 in modelspace.


    Return Type: DimStyle

    See also..

  • .DimStyles(self)
    Returns dimstyles object.


    Return Type: DimStyles

    See also..

  • .ActiveDimStyle(self)
    Returns a dim style set by system variable.


    Return Type: DimStyle

    See also..

  • .GetDimStyle(self, dimname)
    Returns specified dim style object.

    Parameters:
    • dimname: int or string

    Return Type: DimStyle

    See also..

  • .ActivateDimStyle(self, dimname)
    Activates DimStyle dimname.

    Parameters:
    • dimname: int or string

    No Return Type
  • .GetString(self, hasSpaces, Prompt)
    Gets string
    hasSpaces:
    0:input string shall not has empty char('') meaning input has been done;
    1:input string can have empty char(''), and the 'Entery' keystroke means the input process has been done.
    Prompt:
    string,default to None

    Parameters:
    • hasSpaces: int
    • Prompt: string

    Return Type: string
  • .AngleFromXAxis(self, pnt1, pnt2)
    Gets the angle of a line from the X axis.

    Parameters:
    • pnt1: APoint
    • pnt2: APoint

    Return Type: double
  • .GetAngle(self, basePnt, prompt)
    Gets the angle specified.

    Parameters:
    • basePnt: APoint
    • prompt: string

    Return Type: double
  • .GetPoint(self, Point, Prompt)
    Gets the selected point.

    Parameters:
    • Point: APoint
    • prompt: string

    Return Type: dynamic
  • .GetDistance(self, pnt, prompt)
    Gets the point selected in PyPCAD.

    Parameters:
    • pnt: APoint
    • prompt: string

    Return Type: double
  • .InitializeUserInput(self, bits, keywords)
    Before using GetKeyword method,this method has to be used to limit the user-input forms , and this method
    can also used with GetAngle,GetCorner,GetDistance,GetInteger,GetOrientation,GetPoint,GetReal, and cannot be
    used with GetString.Unless it is set again,or it will control the type of input forever.
    bits:integer
    1: Disallows NULL input. This prevents the user from responding to the request by entering only [Return] or a space.
    2: Disallows input of zero (0). This prevents the user from responding to the request by entering 0.
    4: Disallows negative values. This prevents the user from responding to the request by entering a negative value.
    8: Does not check drawing limits, even if the LIMCHECK system variable is on. This enables the user to enter a point outside the current drawing limits. This condition applies to the next user-input function even if the PyPCAD LIMCHECK system variable is currently set.
    16: Not currently used.
    32: Uses dashed lines when drawing rubber-band lines or boxes. This causes the rubber-band line or box that PyPCAD displays to be dashed instead of solid, for those methods that let the user specify a point by selecting a location on the graphics screen. (Some display drivers use a distinctive color instead of dashed lines.) If the PyPCAD POPUPS system variable is 0, PyPCAD ignores this bit.
    64: Ignores Z coordinate of 3D points (GetDistance method only). This option ignores the Z coordinate of 3D points returned by the GetDistance method, so an application can ensure this function returns a 2D distance.
    128: Allows arbitrary input—whatever the user types.
    keywords:strings,such as 'width length height'

    Parameters:
    • bits: int
    • keywords: string

    No Return Type
  • .GetKeyword(self, prompt)
    Before using GetKeyword method,this method has to be used to limit the user-input forms
    Gets a keyword string from the user

    Parameters:
    • prompt: string

    Return Type: string
  • .GetEntity(self)
    Return a tuple containing the picked object and the coordinate of picked point.


    Return Type: tuple
  • .GetReal(self, prompt)
    Gets a real (double) value from the user.

    Parameters:
    • prompt: string

    Return Type: double
  • .GetInteger(self, prompt)
    Gets an integer value from the user.

    Parameters:
    • prompt: string

    Return Type: int
  • .prompt(self, message)
    Displays a prompt on the command line.

    Parameters:
    • message: string

    No Return Type
  • .Preferences(self)
    Returns preferences object


    Return Type: Preferences

    See also..

  • .app(self)
    Returns application object.


    Return Type: Application

    See also..

  • .doc(self)
    Returns Active Document of current application.


    Return Type: Document

    See also..

  • .iter_layouts(self, activeDoc, skip_modelspace)
    Iterate layouts from ActiveDocument
    activeDoc: If doc is not specified (default), :attr:ActiveDocument will be used to iterate layouts from.
    skip_modelspace: In cases of True, :class:ModelSpace should not be included.

    Parameters:
    • activeDoc: Document object
    • skip_modelspace: true or false

    Return Type: Layouts

    See also..

  • .iter_objects(self, obj_or_list, block, limit, dont_cast)
    Iterate objects from `block`
    obj_or_list: Have an object type name include a part of it, or list of it.
    block: Application block, if no input is given default - :class:`ActiveDocument.ActiveLayout.Block` is taken
    limit: max number of objects to return, default infinite is taken.
    dont_cast: Iteration may be accelerated by avoiding retrieval of the best interface for the object. Casting of returned objects is the caller's responsibility.

    Parameters:
    • obj_or_list: object or list
    • block: Application block
    • limit: int
    • dont_cast: true or false

    Return Type: Block

    See also..

  • .iter_objects_fast(self, obj_or_list, container, limit)
    Shortcut for iter_objects with param dont_cast=True`
    Shouldn't be used in normal situations.

    Parameters:
    • obj_or_list: object or list
    • container: objects container
    • limit: int

    Return Type: Block

    See also..

  • .find_one(self, obj_or_list, container, predicate)
    Returns first occurance of object which match `predicate`
    obj_name_or_list: Have an object type name include a part of it, or list of it.
    container: like in :meth:`iter_objects`
    predicate: Returning True or False upon accepting an object as an argument in callable.

    Parameters:
    • obj_or_list: object or list
    • container: objects container
    • predicate: true or false

    Return Type: object
  • .get_selection(self, text)
    Asks to select objects by user
    text: text prompt for selection of objects.

    Parameters:
    • text: string

    Return Type: SelectionSet

    See also..

  • .distance(p1, p2)
    Returns distance between two points p1 and p2.

    Parameters:
    • p1: APoint
    • p2: APoint

    Return Type: int or float
  • .x(self)
    Returns x coordinate of 3D point.


    Return Type: int or float
  • .y(self)
    Returns y coordinate of 3D point.


    Return Type: int or float
  • .z(self)
    Returns z coordinate of 3D point.


    Return Type: int or float