首页 / design / oaPolygon

oaPolygon

模块: oapy._oa._design 导入: from oapy._oa import _design

概览

oaPolygonoapy 中可用,可通过 _design 模块访问。

本页汇总 oaPolygon 当前在 oapy 中可用的 Python 接口。

详细说明

The oaPolygon class implements a polygon shape。 An oaPointArray describing an oaPolygon must conform to the following requirements and assumptions: 1) No duplicate (coincident) points -- duplicate points throw an exception (use oaPointArray::compress to remove coincident points)。 2) No collinear edges -- that is, three or more collinear points are illegal and cause an exception to be thrown (use oaPointArray::compress to remove collinear points)。 3) Polygon edges should not cross。 An exception is NOT thrown if polygon edges cross, but oaPointArray::compress will produce incorrect results if the edges connected by the points in the array cross。 4) oaPolygon functions that throw exceptions for collinear and coincident points, such as oaPolygon::create and oaPolygon::setPoints , assume that the polygon point array is closed--that is, that an edge connects the first and last polygon points specified in the array (since a polygon cannot have coincident points, the first and last polygon points must be different points)。 For more information on coincident and collinear points, see oaPointArray::compress()。

方法总览

状态 Python 调用
obj.getNumPoints()
obj.getPoints(points)
obj.isOrthogonal()
obj.setPoints(points)
obj.convertToRect()
_design.oaPolygon.create(block, layerNum, purposeNum, points)

方法说明

obj.getNumPoints()

绑定状态: 已绑定

Python 调用: obj.getNumPoints()

This function returns the number of points in this polygon。

Python 示例

from oapy._oa import _design

# assume obj is a oaPolygon
obj.getNumPoints()

obj.getPoints(points)

绑定状态: 已绑定

Python 调用: obj.getPoints(points)

This function returns the point array of this polygon。

参数

  • points: The point array containing the points of this polygon。

Python 示例

from oapy._oa import _design

# assume obj is a oaPolygon
obj.getPoints(points)

obj.isOrthogonal()

绑定状态: 已绑定

Python 调用: obj.isOrthogonal()

This function returns a boolean value that indicates the pointArray of this polygon is orthogonal。

Python 示例

from oapy._oa import _design

# assume obj is a oaPolygon
obj.isOrthogonal()

obj.setPoints(points)

绑定状态: 已绑定

Python 调用: obj.setPoints(points)

This function sets the points of this polygon to the specified pointArray。 If the array has collinear or coincident points, or the last and first points are the same, an exception is thrown。 If the array has less than three points, an exception also is thrown。

参数

  • points: The point array containing the points to set the oaPolygon object。

异常

  • oacPolygonHasExtraPoints
  • oacPolygonTooFewPoints

Python 示例

from oapy._oa import _design

# assume obj is a oaPolygon
obj.setPoints(points)

obj.convertToRect()

绑定状态: 已绑定

Python 调用: obj.convertToRect()

This function converts this polygon into a rectangle。 The rectangle is returned as the same pointer。 Note: Only a four-point polygon is converted to a rectangle。

异常

  • oacCannotConvertPolygonToRect

Python 示例

from oapy._oa import _design

# assume obj is a oaPolygon
obj.convertToRect()

_design.oaPolygon.create(block, layerNum, purposeNum, points)

绑定状态: 已绑定

Python 调用: _design.oaPolygon.create(block, layerNum, purposeNum, points)

This function creates a polygon with the specified attributes。 If the array has collinear or coincident points, or the last and first points of the array are the same, an exception is thrown。 If the array has less than three points, an exception also is thrown。

参数

  • block: The block in which this oaPolygon object is created。
  • layerNum: The number of the layer on which this oaPolygon is created。
  • purposeNum: The number of the layer purpose for this oaPolygon object。
  • points: The array of points for this oaPolygon object。

异常

  • oacPolygonHasExtraPoints
  • oacPolygonTooFewPoints

Python 示例

from oapy._oa import _design

_design.oaPolygon.create(block, layerNum, purposeNum, points)