Class: QgsCadUtils

The QgsCadUtils class provides routines for CAD editing.

class qgis.core.QgsCadUtils[source]

Bases: object

class AlignMapPointConstraint[source]

Bases: object

Structure with details of one constraint

QgsCadUtils.AlignMapPointConstraint(locked: bool = False, relative: bool = False, value: float = 0) Constructor for AlignMapPointConstraint.

QgsCadUtils.AlignMapPointConstraint(a0: QgsCadUtils.AlignMapPointConstraint)

locked
relative
value
class AlignMapPointContext[source]

Bases: object

Defines constraints for the QgsCadUtils.alignMapPoint() method.

angleConstraint
cadPoint(self, index: int) QgsPoint[source]

Returns the recent CAD point at the specified index (in map coordinates).

See also

setCadPoint()

Added in version 3.22.

Parameters:

index (int)

Return type:

QgsPoint

property cadPointList
Return type:

List[QgsPointXY]

cadPoints(self) List[QgsPoint]

Returns the list of recent CAD points in map coordinates.

These are used to turn relative constraints to absolute. The first point is the most recent point.

See also

setCadPoints()

Added in version 3.22.

Return type:

List[QgsPoint]

commonAngleConstraint
distanceConstraint
lineExtensionConstraint
mConstraint
mapUnitsPerPixel
setCadPoint(self, index: int, point: QgsPoint)[source]

Sets the recent CAD point at the specified index to point (in map coordinates).

See also

cadPoint()

Added in version 3.22.

Parameters:
setCadPoints(self, points: Iterable[QgsPoint])[source]

Sets the list of recent CAD points (in map coordinates).

See also

cadPoints()

Added in version 3.22.

Parameters:

points (Iterable[QgsPoint])

snappingToFeaturesOverridesCommonAngle
snappingUtils
xConstraint
xyVertexConstraint
yConstraint
zConstraint
class AlignMapPointOutput[source]

Bases: object

Structure returned from alignMapPoint() method

edgeMatch
finalMapPoint
snapMatch
softLockCommonAngle
softLockLineExtension
softLockX
softLockY
valid
static alignMapPoint(originalMapPoint: QgsPointXY, ctx: QgsCadUtils.AlignMapPointContext) QgsCadUtils.AlignMapPointOutput[source]

Applies X/Y/angle/distance constraints from the given context to a map point. Returns a structure containing aligned map point, whether the constraints are valid and some extra information.

Parameters:
Return type:

QgsCadUtils.AlignMapPointOutput