RDocument
Class in Core Module
Header: #include <src/core/RDocument.h>
Inherits: RRequireHeap, RNonCopyable (private)
Description
Section titled “Description”A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Every document maintains a spatial index for fast entity lookups. Documents also handle transactions through a RTransactionStack. A document is backed by an RStorage implementation to store the document for the duration of the document’s lifetime.
Scriptable: This class is available in script environments.
Public Functions
Section titled “Public Functions”RDocument(RStorage &storage, RSpatialIndex &spatialIndex, bool beforeLoad=false)Creates a new document with the given storage as back-end. |
|
| virtual | ~RDocument() |
| QString | addAutoVariable(double value)Adds an automatically named variable with the given value. |
| bool | addBlockToSpatialIndex(RObject::Id blockId, RObject::Id ignoreBlockId)Add block references that point to blockId, unless they also point to ignoreBlockId. |
| void | addToSpatialIndex(QSharedPointer< REntity > entity)Adds an entity to the spatial index using its current bounding boxes. |
| bool | blockContainsReferences(RObject::Id blockId, RObject::Id referencedBlockId)Checks if a block contains references to another block (directly or indirectly). |
| void | clear(bool beforeLoad=false)Resets this document to its initial, empty state. |
| void | clearSelection(QSet< RObject::Id > *affectedEntities=NULL) |
| void | clearSpatialIndices()Clears all spatial indices for this document and its blocks. |
| void | copyVariablesFrom(const RDocument &other)Copies all document variables from another document to this one. |
| int | countSelectedEntities() const |
| int | deselectEntities(const QSet< RObject::Id > &entityId, QSet< RObject::Id > *affectedEntities=NULL) |
| void | deselectEntity(RObject::Id entityId, QSet< RObject::Id > *affectedEntities=NULL)Deselects the entity with the given ID. |
| void | dump()Dumps document information to qDebug for debugging purposes. |
| double | eval(const QString &expression, bool *ok=NULL)Evaluates a mathematical expression, substituting auto variables with their values. |
| QString | formatAngle(double value)Formats an angle value according to this document’s settings. |
| QString | formatLinear(double value)Formats a linear value according to this document’s settings. |
| RS::AngleFormat | getAngleFormat() |
| int | getAnglePrecision() |
| bool | getAutoTransactionGroup() const |
| QStringList | getAutoVariables() const |
| RObject::Id | getBlockId(const QString &blockName) const |
| RObject::Id | getBlockIdAuto(const QString &blockLayoutName) const |
| QString | getBlockName(RObject::Id blockId) const |
| QString | getBlockNameFromHandle(RObject::Handle blockHandle) const |
| QString | getBlockNameFromLayout(const QString &layoutName) const |
| QString | getBlockNameFromLayout(RObject::Id layoutId) const |
| QSet< QString > | getBlockNames(const QString &rxStr=RDEFAULT_QSTRING, bool undone=false) const |
| RBox | getBoundingBox(bool ignoreHiddenLayers=true, bool ignoreEmpty=false) const |
| RObject::Id | getCurrentBlockId() const |
| QString | getCurrentBlockName() const |
| RColor | getCurrentColor() const |
| RObject::Id | getCurrentLayerId() const |
| QString | getCurrentLayerName() const |
| RObject::Id | getCurrentLinetypeId() const |
| RLinetypePattern | getCurrentLinetypePattern() const |
| RLineweight::Lineweight | getCurrentLineweight() const |
| RObject::Id | getCurrentViewId() const |
| RObject::Id | getCurrentViewportId() |
| char | getDecimalSeparator() |
| QList< QSharedPointer< RObject > > | getDefaultLinetypes() |
| QString | getDimensionFont() const |
| RBox | getEntitiesBox(QSet< RObject::Id > &ids) const |
| QString | getFileName() const |
| QString | getFileVersion() const |
| QVariant | getKnownVariable(RS::KnownVariable key, const QVariant &defaultValue=RDEFAULT_QVARIANT) const |
| QString | getLastModified() const |
| QDateTime | getLastModifiedDateTime() const |
| RObject::Id | getLayer0Id() const |
| RObject::Id | getLayerId(const QString &layerName) const |
| QString | getLayerName(RObject::Id layerId) const |
| QSet< QString > | getLayerNames(const QString &rxStr=RDEFAULT_QSTRING) const |
| RObject::Id | getLayerStateId(const QString &layerStateName) const |
| QString | getLayerStateName(RObject::Id layerStateId) const |
| QSet< QString > | getLayerStateNames(const QString &rxStr=RDEFAULT_QSTRING) const |
| QString | getLayoutName(RObject::Id layoutId) const |
| RS::LinearFormat | getLinearFormat() const |
| int | getLinearPrecision() |
| RObject::Id | getLinetypeByBlockId() const |
| RObject::Id | getLinetypeByLayerId() const |
| QString | getLinetypeDescription(RObject::Id linetypeId) const |
| RObject::Id | getLinetypeId(const QString &linetypeName) const |
| QString | getLinetypeLabel(RObject::Id linetypeId) const |
| QString | getLinetypeName(RObject::Id linetypeId) const |
| QSet< QString > | getLinetypeNames() const |
| QList< RLinetypePattern > | getLinetypePatterns() const |
| double | getLinetypeScale() const |
| RLineweight::Lineweight | getMaxLineweight() const |
| RS::Measurement | getMeasurement() const |
| RObject::Id | getModelSpaceBlockId() const |
| bool | getNotifyListeners() const |
| RBox | getSelectionBox() const |
| RSpatialIndex & | getSpatialIndex() |
| const RSpatialIndex & | getSpatialIndex() const |
| RSpatialIndex * | getSpatialIndexForBlock(RObject::Id blockId) constGets or creates the spatial index for a specific block. |
| RSpatialIndex * | getSpatialIndexForCurrentBlock() const |
| RStorage & | getStorage() |
| const RStorage & | getStorage() const |
| QString | getTempBlockName() const |
| int | getTransactionGroup() const |
| RTransactionStack & | getTransactionStack() |
| QString | getUniqueBlockName(const QString ¤tName, const QStringList &usedBlockNames=RDEFAULT_QSTRINGLIST) constGenerates a unique block name based on the given name. |
| RS::Unit | getUnit() const |
| QVariant | getVariable(const QString &key, const QVariant &defaultValue=RDEFAULT_QVARIANT, bool useSettings=false) const |
| QStringList | getVariables() const |
| QSet< QString > | getViewNames() const |
| bool | hasBlock(const QString &blockName) const |
| bool | hasBlockEntities(RObject::Id blockId) const |
| bool | hasChildEntities(RObject::Id parentId) const |
| bool | hasCurrentViewport() |
| bool | hasLayer(const QString &layerName) const |
| bool | hasLayerState(const QString &layerStateName) const |
| bool | hasLayerStates() const |
| bool | hasLayout(const QString &layoutName) const |
| bool | hasLinetype(const QString &linetypeName) const |
| bool | hasSelection() const |
| bool | hasVariable(const QString &key) const |
| bool | hasView(const QString &viewName) const |
| void | init(bool beforeLoad=false)Initializes this document with default settings, layers, and linetypes. |
| void | initLinetypes(RTransaction *transaction=NULL)Initializes or updates the document’s linetypes based on the current unit setting. |
| bool | isBlockFrozen(RObject::Id blockId) const |
| bool | isByBlock(RObject::Id linetypeId) const |
| bool | isByLayer(RObject::Id linetypeId) const |
| bool | isEditingWorkingSet() const |
| bool | isEntity(RObject::Id objectId) constChecks if the given object ID refers to an entity. |
| bool | isEntityEditable(RObject::Id entityId) constChecks if the entity with the given ID is editable. |
| bool | isEntityLayerFrozen(RObject::Id entityId) constChecks if the layer of the entity with the given ID is frozen. |
| bool | isEntityVisible(const REntity &entity, RObject::Id blockId=RObject::INVALID_ID) const |
| bool | isLayerFrozen(const RLayer &layer) const |
| bool | isLayerFrozen(RObject::Id layerId) const |
| bool | isLayerLocked(const RLayer &layer) const |
| bool | isLayerLocked(RObject::Id layerId) const |
| bool | isLayerOff(const RLayer &layer) const |
| bool | isLayerOff(RObject::Id layerId) const |
| bool | isLayerOffOrFrozen(const RLayer &layer) const |
| bool | isLayerOffOrFrozen(RObject::Id layerId) const |
| bool | isLayerPlottable(const RLayer &layer) const |
| bool | isLayerPlottable(RObject::Id layerId) const |
| bool | isLayerSnappable(const RLayer &layer) const |
| bool | isLayerSnappable(RObject::Id layerId) const |
| bool | isLayoutBlock(RObject::Id blockId) const |
| bool | isMetric() const |
| bool | isModified() const |
| bool | isParentLayerFrozen(const RLayer &layer) const |
| bool | isParentLayerFrozen(RObject::Id layerId) const |
| bool | isParentLayerLocked(const RLayer &layer) const |
| bool | isParentLayerLocked(RObject::Id layerId) const |
| bool | isParentLayerPlottable(const RLayer &layer) const |
| bool | isParentLayerPlottable(RObject::Id layerId) const |
| bool | isParentLayerSnappable(const RLayer &layer) const |
| bool | isParentLayerSnappable(RObject::Id layerId) const |
| bool | isRedoAvailable() const |
| bool | isSelected(RObject::Id entityId) |
| bool | isSelectedWorkingSet(RObject::Id entityId) |
| bool | isUndoAvailable() const |
| QSet< RObject::Id > | queryAllBlockReferences() const |
| QSet< RObject::Id > | queryAllBlocks() const |
| QSet< RObject::Id > | queryAllEntities(bool undone, bool allBlocks, QList< RS::EntityType > types) const |
| QSet< RObject::Id > | queryAllEntities(bool undone=false, bool allBlocks=false, RS::EntityType type=RS::EntityAll) constQueries all entities of this document. |
| QSet< RObject::Id > | queryAllLayers() constQueries all layers of this document. |
| QSet< RObject::Id > | queryAllLayerStates() constQueries all layer state objects of this document. |
| QSet< RObject::Id > | queryAllLayoutBlocks(bool includeModelSpace=false) const |
| QSet< RObject::Id > | queryAllLayouts() const |
| QSet< RObject::Id > | queryAllLinetypes() const |
| QSet< RObject::Id > | queryAllObjects() constQueries all objects of this document. |
| QSet< RObject::Id > | queryAllUcs() constQueries all UCSs of this document. |
| QSet< RObject::Id > | queryAllViewports() const |
| QSet< RObject::Id > | queryAllViews() const |
| QSet< RObject::Id > | queryAllVisibleEntities() const |
| QSharedPointer< RBlock > | queryBlock(const QString &blockName) constQueries the block with the given name. |
| QSharedPointer< RBlock > | queryBlock(RObject::Id blockId) constQueries the block with the given ID. |
| QSharedPointer< RBlock > | queryBlockDirect(const QString &blockName) constQueries the block with the given name direct (no cloning). |
| QSharedPointer< RBlock > | queryBlockDirect(RObject::Id blockId) constQueries the block with the given ID direct (no cloning). |
| QSet< RObject::Id > | queryBlockEntities(RObject::Id blockId) const |
| QSet< RObject::Id > | queryBlockReferences(RObject::Id blockId) const |
| QSet< RObject::Id > | queryBlockReferencesForLayers(const QSet< RObject::Id > &layerIds) const |
| QSet< RObject::Id > | queryChildEntities(RObject::Id parentId, RS::EntityType type=RS::EntityAll) const |
| RObject::Id | queryClosestXY(const RVector &wcsPosition, double range, bool draft, double strictRange=RMAXDOUBLE, bool includeLockedLayers=true, bool selectedOnly=false, bool snappable=false)Queries the one entity that is closest to the given position and within the given range (2d). |
| RObject::Id | queryClosestXY(QSet< RObject::Id > &candidates, const RVector &wcsPosition, double range, bool draft, double strictRange=RMAXDOUBLE) |
| QPair< RObject::Id, QSet< int > > | queryClosestXYWithIndices(const RVector &wcsPosition, double range, bool draft, double strictRange=RMAXDOUBLE, bool includeLockedLayers=true, bool selectedOnly=false)Queries the entity closest to the given position within range, along with the indices of the shape elements that are closest (2d). |
| QPair< RObject::Id, QSet< int > > | queryClosestXYWithIndices(QMap< RObject::Id, QSet< int > > &candidates, const RVector &wcsPosition, double range, bool draft, double strictRange=RMAXDOUBLE)Queries the entity closest to the given position from a set of candidates, along with the indices of the shape elements that are closest (2d). |
| QSet< RObject::Id > | queryConnectedEntities(RObject::Id entityId, double tolerance=RS::PointTolerance, RObject::Id layerId=RObject::INVALID_ID)Queries all entities that are connected to the given entity within the specified tolerance. |
| QSet< RObject::Id > | queryContainedEntities(const RBox &box) constQueries all entities which are completely inside the given box. |
| QSet< RObject::Id > | queryContainedEntitiesXY(const RBox &box) constQueries entities that are completely contained within the given box in the XY plane. |
| QSharedPointer< RBlock > | queryCurrentBlock() |
| QSharedPointer< RLayer > | queryCurrentLayer() |
| QSharedPointer< RView > | queryCurrentView() |
| QSharedPointer< RDimStyle > | queryDimStyle() const |
| QSharedPointer< RDimStyle > | queryDimStyleDirect() const |
| QSharedPointer< RDocumentVariables > | queryDocumentVariables() const |
| QSharedPointer< RDocumentVariables > | queryDocumentVariablesDirect() const |
| QSharedPointer< REntity > | queryEntity(RObject::Id entityId) constQueries the entity with the given ID. |
| QSharedPointer< REntity > | queryEntityDirect(RObject::Id entityId) constQueries the entity with the given ID. |
| QSet< RObject::Id > | queryInfiniteEntities() const |
| QSet< RObject::Id > | queryIntersectedEntitiesXY(const RBox &box, bool checkBoundingBoxOnly=false, bool includeLockedLayers=true, RObject::Id blockId=RObject::INVALID_ID, const QList< RS::EntityType > &filter=RDEFAULT_QLIST_RS_ENTITYTYPE, bool selectedOnly=false, RObject::Id layerId=RObject::INVALID_ID, bool snappable=false) constQueries entities that intersect with the given box in the XY plane. |
| QSet< RObject::Id > | queryIntersectedEntitiesXYFast(const RBox &box)Queries entities that intersect with the given box (fast approximation based on bounding boxes). |
| QMap< RObject::Id, QSet< int > > | queryIntersectedEntitiesXYWithIndex(const RBox &box, bool checkBoundingBoxOnly=false, bool includeLockedLayers=true, RObject::Id blockId=RObject::INVALID_ID, const QList< RS::EntityType > &filter=RDEFAULT_QLIST_RS_ENTITYTYPE, bool selectedOnly=false, RObject::Id layerId=RObject::INVALID_ID, bool snappable=false) constQueries entities that intersect with the given box in the XY plane, returning both entity IDs and shape element indices. |
| QMap< RObject::Id, QSet< int > > | queryIntersectedShapesXY(const RBox &box, bool checkBoundingBoxOnly=false, bool includeLockedLayers=true, RObject::Id blockId=RObject::INVALID_ID, const QList< RS::EntityType > &filter=RDEFAULT_QLIST_RS_ENTITYTYPE, bool selectedOnly=false, RObject::Id layerId=RObject::INVALID_ID, bool snappable=false) constQueries entity shapes that intersect with the given box in the XY plane, returning both entity IDs and shape element indices. |
| QSet< RObject::Id > | queryIntersectedShapesXYFast(const RBox &box, bool noInfiniteEntities=false)Queries entity shapes that intersect with the given box (fast approximation). |
| QSharedPointer< RLayer > | queryLayer(const QString &layerName) constQueries the layer with the given name. |
| QSharedPointer< RLayer > | queryLayer(RObject::Id layerId) constQueries the layer with the given ID. |
| QSet< RObject::Id > | queryLayerBlockEntities(RObject::Id layerId, RObject::Id blockId) const |
| QSharedPointer< RLayer > | queryLayerDirect(RObject::Id layerId) constQueries the layer with the given ID direct (no cloning). |
| QSet< RObject::Id > | queryLayerEntities(RObject::Id layerId, bool allBlocks=false) const |
| QSharedPointer< RLayerState > | queryLayerState(const QString &layerStateName) constQueries the layer state with the given name. |
| QSharedPointer< RLayerState > | queryLayerState(RObject::Id layerStateId) constQueries the layer state with the given ID. |
| QSharedPointer< RLayerState > | queryLayerStateDirect(RObject::Id layerStateId) constQueries the layer state with the given ID direct (no cloning). |
| QSharedPointer< RLayout > | queryLayout(const QString &layoutName) constQueries the layout with the given name. |
| QSharedPointer< RLayout > | queryLayout(RObject::Id layoutId) constQueries the layout with the given ID. |
| QSharedPointer< RLayout > | queryLayoutDirect(RObject::Id layoutId) constQueries the layout with the given ID direct (no cloning). |
| QSharedPointer< RLinetype > | queryLinetype(const QString &linetypeName) constQueries the linetype with the given name. |
| QSharedPointer< RLinetype > | queryLinetype(RObject::Id linetypeId) constQueries the linetype with the given ID. |
| QSharedPointer< RObject > | queryObject(RObject::Id objectId) constQueries the object with the given ID. |
| QSharedPointer< RObject > | queryObjectByHandle(RObject::Handle objectHandle) constQueries an object by its handle. |
| RObject * | queryObjectCC(RObject::Id objectId) constQueries the object with the given ID using the internal storage representation. |
| QSharedPointer< RObject > | queryObjectDirect(RObject::Id objectId) constQueries the object with the given ID. |
| QSet< RObject::Id > | queryPropertyEditorObjects()Queries all objects that should be shown in the property editor. |
| QSet< RObject::Id > | querySelectedEntities() constQueries all selected entities. |
| QSet< RObject::Id > | querySelectedLayerEntities(RObject::Id layerId, bool allBlocks=false) const |
| QSet< RObject::Id > | querySelectedLayers() constQueries all selected objects. |
| QSharedPointer< RUcs > | queryUcs(const QString &ucsName) constQueries the UCS with the given name. |
| QSharedPointer< RUcs > | queryUcs(RObject::Id ucsId) constQueries the UCS with the given ID. |
| QSharedPointer< RView > | queryView(const QString &viewName) constQueries the view with the given name. |
| QSharedPointer< RView > | queryView(RObject::Id viewId) constQueries the view with the given ID. |
| QSharedPointer< REntity > | queryVisibleEntityDirect(RObject::Id entityId) constQueries a visible entity with the given ID, returning the direct instance. |
| QSet< RObject::Id > | queryWorkingSetEntities() const |
| virtual void | rebuildSpatialIndex()Rebuilds the entire spatial index from scratch (e.g. |
| QList< RTransaction > | redo()Redoes a previously undone transaction. |
| void | removeBlockFromSpatialIndex(RObject::Id blockId)Removes all entities from the given block from the spatial index. |
| void | removeFromSpatialIndex(QSharedPointer< REntity > entity)Removes an entity from the spatial index using its current bounding boxes. |
| virtual void | removeFromSpatialIndex(QSharedPointer< REntity > entity, const QList< RBox > &boundingBoxes)Removes an entity from the spatial index using the given bounding boxes. |
| void | removeVariable(const QString &key)Removes the custom variable with the given key. |
| void | resetTransactionStack()Resets the transaction stack, clearing all undo and redo history. |
| void | selectAllEntities(QSet< RObject::Id > *affectedEntities=NULL)Selects all not selected entities. |
| int | selectEntities(const QSet< RObject::Id > &entityId, bool add=false, QSet< RObject::Id > *affectedEntities=NULL) |
| void | selectEntity(RObject::Id entityId, bool add=false, QSet< RObject::Id > *affectedEntities=NULL) |
| void | setAutoTransactionGroup(bool on)True: add all operations to the current transaction group. |
| void | setCurrentBlock(const QString &blockName)Sets the current block for editing by name. |
| void | setCurrentBlock(RObject::Id blockId)Sets the current block for editing. |
| void | setCurrentColor(const RColor &color) |
| void | setCurrentLayer(const QString &layerName, RTransaction *transaction=NULL) |
| void | setCurrentLayer(RObject::Id layerId, RTransaction *transaction=NULL) |
| void | setCurrentLinetype(const QString &name) |
| void | setCurrentLinetype(RObject::Id ltId) |
| void | setCurrentLinetypePattern(const RLinetypePattern &p) |
| void | setCurrentLineweight(RLineweight::Lineweight lw) |
| void | setCurrentView(const QString &viewName) |
| void | setCurrentView(RObject::Id viewId) |
| void | setCurrentViewport(RObject::Id viewportId)Sets the current viewport for this document. |
| void | setDimensionFont(const QString &f, RTransaction *transaction=NULL) |
| void | setFileName(const QString &fn)Sets the file name associated with this document. |
| void | setFileVersion(const QString &fv)Sets the file version string for this document. |
| void | setIgnoreWorkingSet(bool on)Sets whether to ignore the working set. |
| void | setKnownVariable(RS::KnownVariable key, const QVariant &value, RTransaction *transaction=NULL)Sets a known DXF/DWG variable for this document. |
| void | setKnownVariable(RS::KnownVariable key, const RVector &value, RTransaction *transaction=NULL)Sets a known DXF/DWG variable for this document. |
| void | setLinearFormat(RS::LinearFormat f)Sets the linear format type for this document. |
| void | setLinetypeScale(double v, RTransaction *transaction=NULL)Sets the global linetype scale of this document to the given value. |
| void | setMeasurement(RS::Measurement m, RTransaction *transaction=NULL)Sets the measurement system for this document (metric or imperial). |
| void | setModified(bool m)Resets the modified flag. |
| void | setNotifyListeners(bool on)Sets whether listeners should be notified of changes to the document. |
| void | setUnit(RS::Unit unit, RTransaction *transaction=NULL)Sets the unit of measurement for this document. |
| void | setVariable(const QString &key, const QVariant &value, bool overwrite=true)Sets a custom variable in the context of this document. |
| bool | showLeadingZeroes() |
| bool | showLeadingZeroesAngle() |
| bool | showTrailingZeroes() |
| bool | showTrailingZeroesAngle() |
| QList< RObject::Id > | sortBlocks(const QList< RObject::Id > &blockIds) const |
| QList< RObject::Id > | sortLayers(const QList< RObject::Id > &layerIds) const |
| void | startTransactionGroup() |
| QString | substituteAutoVariables(const QString &expression)Substitutes all auto variable references in the given expression with their values. |
| QList< RTransaction > | undo()Undoes the last transaction. |
| void | unsetCurrentViewport()Unsets the current viewport for this document. |
| void | updateAllEntities()Updates all entities in the document (recalculates bounding boxes, etc.). |
Static Public Functions
Section titled “Static Public Functions”| static RDocument & | getClipboard() |
Static Protected Attributes
Section titled “Static Protected Attributes”| static RDocument * | clipboard |
Private Attributes
Section titled “Private Attributes”Friends
Section titled “Friends”| QDebug | operator<<(QDebug dbg, RDocument &d)Stream operator for QDebug. |
Member Documentation
Section titled “Member Documentation”RDocument
Section titled “RDocument”RDocument::RDocument(RStorage &storage, RSpatialIndex &spatialIndex, bool beforeLoad=false)Creates a new document with the given storage as back-end.
The document takes ownership of the storage and spatial index. A new document contains one layer (“0”) and a number of default line types. The default unit is Millimeter.
~RDocument
Section titled “~RDocument”virtual RDocument::~RDocument()virtual
addAutoVariable
Section titled “addAutoVariable”QString RDocument::addAutoVariable(double value)Adds an automatically named variable with the given value.
Auto variables are named sequentially (e.g., a0, a1, a2, …).
Parameters:
value: The value for the auto variable.
Returns: The name of the created auto variable.
addBlockToSpatialIndex
Section titled “addBlockToSpatialIndex”bool RDocument::addBlockToSpatialIndex(RObject::Id blockId, RObject::Id ignoreBlockId)Add block references that point to blockId, unless they also point to ignoreBlockId.
addToSpatialIndex
Section titled “addToSpatialIndex”void RDocument::addToSpatialIndex(QSharedPointer< REntity > entity)Adds an entity to the spatial index using its current bounding boxes.
Parameters:
entity: The entity to add to the spatial index.
blockContainsReferences
Section titled “blockContainsReferences”bool RDocument::blockContainsReferences(RObject::Id blockId, RObject::Id referencedBlockId)Checks if a block contains references to another block (directly or indirectly).
This is used to detect circular references.
Parameters:
blockId: The ID of the block to check.referencedBlockId: The ID of the potentially referenced block.
Returns: True if blockId contains references to referencedBlockId, false otherwise.
void RDocument::clear(bool beforeLoad=false)Resets this document to its initial, empty state.
clearSelection
Section titled “clearSelection”void RDocument::clearSelection(QSet< RObject::Id > *affectedEntities=NULL)Deselectes all selected entities.
clearSpatialIndices
Section titled “clearSpatialIndices”void RDocument::clearSpatialIndices()Clears all spatial indices for this document and its blocks.
copyVariablesFrom
Section titled “copyVariablesFrom”void RDocument::copyVariablesFrom(const RDocument &other)Copies all document variables from another document to this one.
This includes known variables, custom variables, and dimension font settings.
Parameters:
other: The document to copy variables from.
countSelectedEntities
Section titled “countSelectedEntities”int RDocument::countSelectedEntities() constconst
Returns: Number of selected entities.
deselectEntities
Section titled “deselectEntities”int RDocument::deselectEntities(const QSet< RObject::Id > &entityId, QSet< RObject::Id > *affectedEntities=NULL)Deselects all entities with the given IDs.
Parameters:
affected: Optional pointer to an empty set of entity IDs. After the call, this set will contain all entity IDs of entities that were affected by the call.
deselectEntity
Section titled “deselectEntity”void RDocument::deselectEntity(RObject::Id entityId, QSet< RObject::Id > *affectedEntities=NULL)Deselects the entity with the given ID.
Parameters:
affected: Optional pointer to an empty set of entity IDs. After the call, this set will contain all entity IDs of entities that were affected by the call.
void RDocument::dump()Dumps document information to qDebug for debugging purposes.
double RDocument::eval(const QString &expression, bool *ok=NULL)Evaluates a mathematical expression, substituting auto variables with their values.
Parameters:
expression: The mathematical expression to evaluate.ok: Optional pointer to bool that will be set to true if evaluation succeeded.
Returns: The result of the evaluation.
formatAngle
Section titled “formatAngle”QString RDocument::formatAngle(double value)Formats an angle value according to this document’s settings.
Parameters:
value: The angle value to format (in radians).
Returns: The formatted string representation of the angle.
formatLinear
Section titled “formatLinear”QString RDocument::formatLinear(double value)Formats a linear value according to this document’s settings.
Parameters:
value: The linear value to format.
Returns: The formatted string representation of the value.
getAngleFormat
Section titled “getAngleFormat”RS::AngleFormat RDocument::getAngleFormat()Returns: The angle format type for this document. This is determined by the variable “$DIMAUNIT”.
getAnglePrecision
Section titled “getAnglePrecision”int RDocument::getAnglePrecision()Returns: The angular precision for this document. This is determined by the variable “$DIMADEC”.
getAutoTransactionGroup
Section titled “getAutoTransactionGroup”bool RDocument::getAutoTransactionGroup() constinline const
getAutoVariables
Section titled “getAutoVariables”QStringList RDocument::getAutoVariables() constconst
Returns: List of all auto variable names in this document.
getBlockId
Section titled “getBlockId”RBlock::Id RDocument::getBlockId(const QString &blockName) constconst
getBlockIdAuto
Section titled “getBlockIdAuto”RBlock::Id RDocument::getBlockIdAuto(const QString &blockLayoutName) constconst
getBlockName
Section titled “getBlockName”QString RDocument::getBlockName(RObject::Id blockId) constconst
getBlockNameFromHandle
Section titled “getBlockNameFromHandle”QString RDocument::getBlockNameFromHandle(RObject::Handle blockHandle) constconst
getBlockNameFromLayout
Section titled “getBlockNameFromLayout”QString RDocument::getBlockNameFromLayout(const QString &layoutName) constconst
getBlockNameFromLayout
Section titled “getBlockNameFromLayout”QString RDocument::getBlockNameFromLayout(RObject::Id layoutId) constconst
getBlockNames
Section titled “getBlockNames”QSet< QString > RDocument::getBlockNames(const QString &rxStr=RDEFAULT_QSTRING, bool undone=false) constconst
getBoundingBox
Section titled “getBoundingBox”RBox RDocument::getBoundingBox(bool ignoreHiddenLayers=true, bool ignoreEmpty=false) constconst
Returns: The bounding box around all visible entities.
getCurrentBlockId
Section titled “getCurrentBlockId”RBlock::Id RDocument::getCurrentBlockId() constconst
getCurrentBlockName
Section titled “getCurrentBlockName”QString RDocument::getCurrentBlockName() constconst
Returns: The name of the current block in this document.
getCurrentColor
Section titled “getCurrentColor”RColor RDocument::getCurrentColor() constconst
getCurrentLayerId
Section titled “getCurrentLayerId”RLayer::Id RDocument::getCurrentLayerId() constconst
getCurrentLayerName
Section titled “getCurrentLayerName”QString RDocument::getCurrentLayerName() constconst
getCurrentLinetypeId
Section titled “getCurrentLinetypeId”RLinetype::Id RDocument::getCurrentLinetypeId() constconst
getCurrentLinetypePattern
Section titled “getCurrentLinetypePattern”RLinetypePattern RDocument::getCurrentLinetypePattern() constconst
getCurrentLineweight
Section titled “getCurrentLineweight”RLineweight::Lineweight RDocument::getCurrentLineweight() constconst
getCurrentViewId
Section titled “getCurrentViewId”RObject::Id RDocument::getCurrentViewId() constconst
getCurrentViewportId
Section titled “getCurrentViewportId”RObject::Id RDocument::getCurrentViewportId()Returns: The ID of the current viewport, or INVALID_ID if no viewport is set.
getDecimalSeparator
Section titled “getDecimalSeparator”char RDocument::getDecimalSeparator()Returns: The decimal separator for this document. This is determined by the variable “$DIMDSEP”. 0 means ‘.’.
getDefaultLinetypes
Section titled “getDefaultLinetypes”QList< QSharedPointer< RObject > > RDocument::getDefaultLinetypes()Returns: List of default linetype objects for the current unit system. Returns metric linetypes if the document uses metric units, imperial linetypes otherwise.
getDimensionFont
Section titled “getDimensionFont”QString RDocument::getDimensionFont() constconst
getEntitiesBox
Section titled “getEntitiesBox”RBox RDocument::getEntitiesBox(QSet< RObject::Id > &ids) constconst
getFileName
Section titled “getFileName”QString RDocument::getFileName() constconst
Returns: The file name associated with this document.
getFileVersion
Section titled “getFileVersion”QString RDocument::getFileVersion() constconst
Returns: The file version string for this document.
getKnownVariable
Section titled “getKnownVariable”QVariant RDocument::getKnownVariable(RS::KnownVariable key, const QVariant &defaultValue=RDEFAULT_QVARIANT) constconst
Returns: Value for the given DXF/DWG variable.
getLastModified
Section titled “getLastModified”QString RDocument::getLastModified() constconst
getLastModifiedDateTime
Section titled “getLastModifiedDateTime”QDateTime RDocument::getLastModifiedDateTime() constconst
Non-Scriptable: This function is not available in script environments.
getLayer0Id
Section titled “getLayer0Id”RLayer::Id RDocument::getLayer0Id() constconst
getLayerId
Section titled “getLayerId”RLayer::Id RDocument::getLayerId(const QString &layerName) constconst
getLayerName
Section titled “getLayerName”QString RDocument::getLayerName(RObject::Id layerId) constconst
getLayerNames
Section titled “getLayerNames”QSet< QString > RDocument::getLayerNames(const QString &rxStr=RDEFAULT_QSTRING) constconst
getLayerStateId
Section titled “getLayerStateId”RObject::Id RDocument::getLayerStateId(const QString &layerStateName) constconst
getLayerStateName
Section titled “getLayerStateName”QString RDocument::getLayerStateName(RObject::Id layerStateId) constconst
getLayerStateNames
Section titled “getLayerStateNames”QSet< QString > RDocument::getLayerStateNames(const QString &rxStr=RDEFAULT_QSTRING) constconst
getLayoutName
Section titled “getLayoutName”QString RDocument::getLayoutName(RObject::Id layoutId) constconst
getLinearFormat
Section titled “getLinearFormat”RS::LinearFormat RDocument::getLinearFormat() constconst
Returns: The linear format type for this document. This is determined by the variable “$DIMLUNIT”.
getLinearPrecision
Section titled “getLinearPrecision”int RDocument::getLinearPrecision()Returns: The linear precision for this document. This is determined by the variable “$DIMDEC”.
getLinetypeByBlockId
Section titled “getLinetypeByBlockId”RObject::Id RDocument::getLinetypeByBlockId() constinline const
getLinetypeByLayerId
Section titled “getLinetypeByLayerId”RObject::Id RDocument::getLinetypeByLayerId() constinline const
getLinetypeDescription
Section titled “getLinetypeDescription”QString RDocument::getLinetypeDescription(RObject::Id linetypeId) constconst
Returns: User readable description for the given linetype.
getLinetypeId
Section titled “getLinetypeId”RLinetype::Id RDocument::getLinetypeId(const QString &linetypeName) constconst
Returns: Linetype ID of the given linetype name or RObject::INVALID_ID.
getLinetypeLabel
Section titled “getLinetypeLabel”QString RDocument::getLinetypeLabel(RObject::Id linetypeId) constconst
Returns: User readable label for the given linetype.
getLinetypeName
Section titled “getLinetypeName”QString RDocument::getLinetypeName(RObject::Id linetypeId) constconst
Returns: Linetype name of the given linetype.
getLinetypeNames
Section titled “getLinetypeNames”QSet< QString > RDocument::getLinetypeNames() constconst
Returns: List of all available linetype pattern names in this document.
getLinetypePatterns
Section titled “getLinetypePatterns”QList< RLinetypePattern > RDocument::getLinetypePatterns() constconst
Returns: List of all available linetype patterns in this document.
getLinetypeScale
Section titled “getLinetypeScale”double RDocument::getLinetypeScale() constconst
getMaxLineweight
Section titled “getMaxLineweight”RLineweight::Lineweight RDocument::getMaxLineweight() constconst
Returns: The maximum lineweight used in this document.
getMeasurement
Section titled “getMeasurement”RS::Measurement RDocument::getMeasurement() constconst
getModelSpaceBlockId
Section titled “getModelSpaceBlockId”RBlock::Id RDocument::getModelSpaceBlockId() constconst
getNotifyListeners
Section titled “getNotifyListeners”bool RDocument::getNotifyListeners() constconst
Returns: True if listener notifications are enabled, false otherwise.
getSelectionBox
Section titled “getSelectionBox”RBox RDocument::getSelectionBox() constconst
getSpatialIndex
Section titled “getSpatialIndex”RSpatialIndex & RDocument::getSpatialIndex()Returns: Reference to the spatial index.
getSpatialIndex
Section titled “getSpatialIndex”const RSpatialIndex & RDocument::getSpatialIndex() constconst
Returns: Const reference to the spatial index.
getSpatialIndexForBlock
Section titled “getSpatialIndexForBlock”RSpatialIndex * RDocument::getSpatialIndexForBlock(RObject::Id blockId) constconst
Gets or creates the spatial index for a specific block.
Each block maintains its own spatial index for efficient entity lookups.
Parameters:
blockId: The ID of the block.
Returns: Pointer to the spatial index for the specified block.
getSpatialIndexForCurrentBlock
Section titled “getSpatialIndexForCurrentBlock”RSpatialIndex * RDocument::getSpatialIndexForCurrentBlock() constconst
Returns: Pointer to the spatial index for the current block.
getStorage
Section titled “getStorage”RStorage & RDocument::getStorage()Returns: Reference to storage that backs the document.
getStorage
Section titled “getStorage”const RStorage & RDocument::getStorage() constconst
Returns: Const reference to storage that backs the document.
getTempBlockName
Section titled “getTempBlockName”QString RDocument::getTempBlockName() constconst
Returns: A randomly generated temporary block name that doesn’t conflict with existing blocks. The name follows the pattern “A$C#####”.
getTransactionGroup
Section titled “getTransactionGroup”int RDocument::getTransactionGroup() constconst
getTransactionStack
Section titled “getTransactionStack”RTransactionStack & RDocument::getTransactionStack()Returns: Reference to the transaction stack for undo/redo handling.
getUniqueBlockName
Section titled “getUniqueBlockName”QString RDocument::getUniqueBlockName(const QString ¤tName, const QStringList &usedBlockNames=RDEFAULT_QSTRINGLIST) constconst
Generates a unique block name based on the given name.
If the name already exists, appends a number suffix (_1, _2, etc.).
Parameters:
currentName: The base name to use for generating a unique name.usedBlockNames: Additional block names to check against (beyond those in the document).
Returns: A unique block name.
getUnit
Section titled “getUnit”RS::Unit RDocument::getUnit() constconst
Returns: The unit of measurement for this document.
getVariable
Section titled “getVariable”QVariant RDocument::getVariable(const QString &key, const QVariant &defaultValue=RDEFAULT_QVARIANT, bool useSettings=false) constconst
Returns: The value of the given variable or an invalid variant if the variable does not exist.
getVariables
Section titled “getVariables”QStringList RDocument::getVariables() constconst
Returns: List of custom variable names stored in this document.
getViewNames
Section titled “getViewNames”QSet< QString > RDocument::getViewNames() constconst
hasBlock
Section titled “hasBlock”bool RDocument::hasBlock(const QString &blockName) constconst
hasBlockEntities
Section titled “hasBlockEntities”bool RDocument::hasBlockEntities(RObject::Id blockId) constconst
Returns: True if the given block contains any entities.
hasChildEntities
Section titled “hasChildEntities”bool RDocument::hasChildEntities(RObject::Id parentId) constconst
hasCurrentViewport
Section titled “hasCurrentViewport”bool RDocument::hasCurrentViewport()Returns: True if a current viewport is set, false otherwise.
hasLayer
Section titled “hasLayer”bool RDocument::hasLayer(const QString &layerName) constconst
hasLayerState
Section titled “hasLayerState”bool RDocument::hasLayerState(const QString &layerStateName) constconst
hasLayerStates
Section titled “hasLayerStates”bool RDocument::hasLayerStates() constconst
hasLayout
Section titled “hasLayout”bool RDocument::hasLayout(const QString &layoutName) constconst
hasLinetype
Section titled “hasLinetype”bool RDocument::hasLinetype(const QString &linetypeName) constconst
hasSelection
Section titled “hasSelection”bool RDocument::hasSelection() constconst
Returns: True if at least one entity is selected in this storage.
hasVariable
Section titled “hasVariable”bool RDocument::hasVariable(const QString &key) constconst
Returns: True if the given variable exists in this storage.
hasView
Section titled “hasView”bool RDocument::hasView(const QString &viewName) constconst
void RDocument::init(bool beforeLoad=false)Initializes this document with default settings, layers, and linetypes.
This method is called internally by the constructor and clear() method.
Parameters:
beforeLoad: True if the document is being initialized before loading from a file, false otherwise.
initLinetypes
Section titled “initLinetypes”void RDocument::initLinetypes(RTransaction *transaction=NULL)Initializes or updates the document’s linetypes based on the current unit setting.
Adds default linetypes (metric or imperial) to the document.
Parameters:
transaction: Optional transaction to use for adding linetypes. If NULL, a new transaction will be created.
isBlockFrozen
Section titled “isBlockFrozen”bool RDocument::isBlockFrozen(RObject::Id blockId) constconst
Returns: True if the given block is frozen.
isByBlock
Section titled “isByBlock”bool RDocument::isByBlock(RObject::Id linetypeId) constconst
Returns: True if the given linetype ID represents the “BYBLOCK” linetype, false otherwise.
isByLayer
Section titled “isByLayer”bool RDocument::isByLayer(RObject::Id linetypeId) constconst
Returns: True if the given linetype ID represents the “BYLAYER” linetype, false otherwise.
isEditingWorkingSet
Section titled “isEditingWorkingSet”bool RDocument::isEditingWorkingSet() constconst
Returns: True if the document is currently editing a working set, false otherwise.
isEntity
Section titled “isEntity”bool RDocument::isEntity(RObject::Id objectId) constconst
Checks if the given object ID refers to an entity.
Parameters:
entityId: The object ID to check.
Returns: True if the object is an entity, false otherwise.
isEntityEditable
Section titled “isEntityEditable”bool RDocument::isEntityEditable(RObject::Id entityId) constconst
Checks if the entity with the given ID is editable.
Parameters:
entityId: The ID of the entity to check.
Returns: True if the entity exists and is editable, false otherwise.
isEntityLayerFrozen
Section titled “isEntityLayerFrozen”bool RDocument::isEntityLayerFrozen(RObject::Id entityId) constconst
Checks if the layer of the entity with the given ID is frozen.
Parameters:
entityId: The ID of the entity to check.
Returns: True if the entity’s layer is frozen, false otherwise.
isEntityVisible
Section titled “isEntityVisible”bool RDocument::isEntityVisible(const REntity &entity, RObject::Id blockId=RObject::INVALID_ID) constconst
Returns: True if the given entity is visible in the context of the given block or the current block (default).
isLayerFrozen
Section titled “isLayerFrozen”bool RDocument::isLayerFrozen(const RLayer &layer) constconst
Returns: True if this layer or one of its parent layers are frozen.
isLayerFrozen
Section titled “isLayerFrozen”bool RDocument::isLayerFrozen(RObject::Id layerId) constconst
Returns: True if this layer or one of its parent layers are frozen.
isLayerLocked
Section titled “isLayerLocked”bool RDocument::isLayerLocked(const RLayer &layer) constconst
isLayerLocked
Section titled “isLayerLocked”bool RDocument::isLayerLocked(RObject::Id layerId) constconst
isLayerOff
Section titled “isLayerOff”bool RDocument::isLayerOff(const RLayer &layer) constconst
Returns: True if this layer is off.
isLayerOff
Section titled “isLayerOff”bool RDocument::isLayerOff(RObject::Id layerId) constconst
Returns: True if this layer is off.
isLayerOffOrFrozen
Section titled “isLayerOffOrFrozen”bool RDocument::isLayerOffOrFrozen(const RLayer &layer) constconst
Returns: True if this layer is off or frozen.
isLayerOffOrFrozen
Section titled “isLayerOffOrFrozen”bool RDocument::isLayerOffOrFrozen(RObject::Id layerId) constconst
Returns: True if this layer is off or frozen.
isLayerPlottable
Section titled “isLayerPlottable”bool RDocument::isLayerPlottable(const RLayer &layer) constconst
Returns: True if this layer and its parent layers are plottable.
isLayerPlottable
Section titled “isLayerPlottable”bool RDocument::isLayerPlottable(RObject::Id layerId) constconst
Returns: True if this layer and its parent layers are plottable.
isLayerSnappable
Section titled “isLayerSnappable”bool RDocument::isLayerSnappable(const RLayer &layer) constconst
Returns: True if this layer and its parent layers are snappable.
isLayerSnappable
Section titled “isLayerSnappable”bool RDocument::isLayerSnappable(RObject::Id layerId) constconst
Returns: True if this layer and its parent layers are snappable.
isLayoutBlock
Section titled “isLayoutBlock”bool RDocument::isLayoutBlock(RObject::Id blockId) constconst
Returns: True if the given block is a layout block (i.e. paper space block).
isMetric
Section titled “isMetric”bool RDocument::isMetric() constconst
Returns: True if this document uses the metric measurement system, false otherwise. If the measurement system is unknown, the unit setting is used to determine this.
isModified
Section titled “isModified”bool RDocument::isModified() constconst
Returns: True if the document has unsaved changes.
isParentLayerFrozen
Section titled “isParentLayerFrozen”bool RDocument::isParentLayerFrozen(const RLayer &layer) constconst
Returns: True if a parent layer of the given layer is frozen.
isParentLayerFrozen
Section titled “isParentLayerFrozen”bool RDocument::isParentLayerFrozen(RObject::Id layerId) constconst
Returns: True if a parent layer of the given layer is frozen.
isParentLayerLocked
Section titled “isParentLayerLocked”bool RDocument::isParentLayerLocked(const RLayer &layer) constconst
Returns: True if a parent layer of the given layer is locked.
isParentLayerLocked
Section titled “isParentLayerLocked”bool RDocument::isParentLayerLocked(RObject::Id layerId) constconst
Returns: True if a parent layer of the given layer is locked.
isParentLayerPlottable
Section titled “isParentLayerPlottable”bool RDocument::isParentLayerPlottable(const RLayer &layer) constconst
Returns: True if a parent layer of the given layer is plottable.
isParentLayerPlottable
Section titled “isParentLayerPlottable”bool RDocument::isParentLayerPlottable(RObject::Id layerId) constconst
Returns: True if a parent layer of the given layer is plottable.
isParentLayerSnappable
Section titled “isParentLayerSnappable”bool RDocument::isParentLayerSnappable(const RLayer &layer) constconst
Returns: True if a parent layer of the given layer is snappable.
isParentLayerSnappable
Section titled “isParentLayerSnappable”bool RDocument::isParentLayerSnappable(RObject::Id layerId) constconst
Returns: True if a parent layer of the given layer is snappable.
isRedoAvailable
Section titled “isRedoAvailable”bool RDocument::isRedoAvailable() constconst
Returns: True if there are transactions available for redo, false otherwise.
isSelected
Section titled “isSelected”bool RDocument::isSelected(RObject::Id entityId)isSelectedWorkingSet
Section titled “isSelectedWorkingSet”bool RDocument::isSelectedWorkingSet(RObject::Id entityId)isUndoAvailable
Section titled “isUndoAvailable”bool RDocument::isUndoAvailable() constconst
Returns: True if there are transactions available for undo, false otherwise.
queryAllBlockReferences
Section titled “queryAllBlockReferences”QSet< REntity::Id > RDocument::queryAllBlockReferences() constconst
Returns: A set of all block reference entity IDs.
queryAllBlocks
Section titled “queryAllBlocks”QSet< RBlock::Id > RDocument::queryAllBlocks() constconst
Returns: A set of all block IDs of the document.
queryAllEntities
Section titled “queryAllEntities”QSet< REntity::Id > RDocument::queryAllEntities(bool undone, bool allBlocks, QList< RS::EntityType > types) constconst
Returns: A set of all entity IDs of the document.
queryAllEntities
Section titled “queryAllEntities”QSet< REntity::Id > RDocument::queryAllEntities(bool undone=false, bool allBlocks=false, RS::EntityType type=RS::EntityAll) constconst
Queries all entities of this document.
This operation can be slow, depending on the total number of entities and the storage type that is used for this document.
Returns: Set of entity IDs.
queryAllLayers
Section titled “queryAllLayers”QSet< RLayer::Id > RDocument::queryAllLayers() constconst
Queries all layers of this document.
Returns: Set of layer IDs.
queryAllLayerStates
Section titled “queryAllLayerStates”QSet< RObject::Id > RDocument::queryAllLayerStates() constconst
Queries all layer state objects of this document.
Returns: Set of layer state IDs.
queryAllLayoutBlocks
Section titled “queryAllLayoutBlocks”QSet< RBlock::Id > RDocument::queryAllLayoutBlocks(bool includeModelSpace=false) constconst
Returns: A set of all block IDs of layout blocks of the document.
queryAllLayouts
Section titled “queryAllLayouts”QSet< RLayout::Id > RDocument::queryAllLayouts() constconst
Returns: A set of all layout IDs of layouts of the document.
queryAllLinetypes
Section titled “queryAllLinetypes”QSet< RLinetype::Id > RDocument::queryAllLinetypes() constconst
Returns: A set of all linetype IDs of the document.
queryAllObjects
Section titled “queryAllObjects”QSet< RObject::Id > RDocument::queryAllObjects() constconst
Queries all objects of this document.
Returns: Set of object IDs.
queryAllUcs
Section titled “queryAllUcs”QSet< RUcs::Id > RDocument::queryAllUcs() constconst
Queries all UCSs of this document.
Returns: Set of UCS IDs.
queryAllViewports
Section titled “queryAllViewports”QSet< REntity::Id > RDocument::queryAllViewports() constconst
Returns: A set of all viewport entity IDs.
queryAllViews
Section titled “queryAllViews”QSet< RObject::Id > RDocument::queryAllViews() constconst
Returns: A set of all view IDs of the document.
queryAllVisibleEntities
Section titled “queryAllVisibleEntities”QSet< REntity::Id > RDocument::queryAllVisibleEntities() constconst
queryBlock
Section titled “queryBlock”QSharedPointer< RBlock > RDocument::queryBlock(const QString &blockName) constconst
Queries the block with the given name.
Returns: Pointer to the block or NULL.
queryBlock
Section titled “queryBlock”QSharedPointer< RBlock > RDocument::queryBlock(RObject::Id blockId) constconst
Queries the block with the given ID.
Returns: Pointer to the block or NULL.
queryBlockDirect
Section titled “queryBlockDirect”QSharedPointer< RBlock > RDocument::queryBlockDirect(const QString &blockName) constconst
Queries the block with the given name direct (no cloning).
Blocks queried this way should not be modified unless undo / redo functionality is not required.
Returns: Pointer to the block or NULL.
queryBlockDirect
Section titled “queryBlockDirect”QSharedPointer< RBlock > RDocument::queryBlockDirect(RObject::Id blockId) constconst
Queries the block with the given ID direct (no cloning).
Blocks queried this way should not be modified unless undo / redo functionality is not required.
Returns: Pointer to the block or NULL.
queryBlockEntities
Section titled “queryBlockEntities”QSet< REntity::Id > RDocument::queryBlockEntities(RObject::Id blockId) constconst
Returns: A set of all entity IDs that are part of the given block.
queryBlockReferences
Section titled “queryBlockReferences”QSet< REntity::Id > RDocument::queryBlockReferences(RObject::Id blockId) constconst
Returns: A set of all block reference entity IDs that reference the given block.
queryBlockReferencesForLayers
Section titled “queryBlockReferencesForLayers”QSet< REntity::Id > RDocument::queryBlockReferencesForLayers(const QSet< RObject::Id > &layerIds) constconst
Returns: A set of the IDs of those block reference entities whose visual appearance may change when the visibility of the given layers changes. These are references to blocks which contain entities on one of the given layers (directly or indirectly through nested block references) and block references which are themselves on one of the given layers (the visibility of layer 0 entities in the referenced block depends on the layer of the block reference). The default implementation conservatively returns all block references.
queryChildEntities
Section titled “queryChildEntities”QSet< REntity::Id > RDocument::queryChildEntities(RObject::Id parentId, RS::EntityType type=RS::EntityAll) constconst
Returns: A set of all block attributes which are not stored in the block definition but as separate entities on the same level as the block reference.
queryClosestXY
Section titled “queryClosestXY”REntity::Id RDocument::queryClosestXY(const RVector &wcsPosition, double range, bool draft, double strictRange=RMAXDOUBLE, bool includeLockedLayers=true, bool selectedOnly=false, bool snappable=false)Queries the one entity that is closest to the given position and within the given range (2d).
Parameters:
wcsPosition: The position to which the entity has to be close (2d).range: The range in which to search.
queryClosestXY
Section titled “queryClosestXY”RObject::Id RDocument::queryClosestXY(QSet< RObject::Id > &candidates, const RVector &wcsPosition, double range, bool draft, double strictRange=RMAXDOUBLE)queryClosestXYWithIndices
Section titled “queryClosestXYWithIndices”QPair< REntity::Id, QSet< int > > RDocument::queryClosestXYWithIndices(const RVector &wcsPosition, double range, bool draft, double strictRange=RMAXDOUBLE, bool includeLockedLayers=true, bool selectedOnly=false)Queries the entity closest to the given position within range, along with the indices of the shape elements that are closest (2d).
Parameters:
wcsPosition: The position to which the entity has to be close (2d).range: The range in which to search.draft: True for draft mode (faster but less accurate).strictRange: The strict range for distance checking.includeLockedLayers: True to include entities on locked layers.selectedOnly: True to only consider selected entities.
Returns: Pair of entity ID and set of shape indices.
queryClosestXYWithIndices
Section titled “queryClosestXYWithIndices”QPair< REntity::Id, QSet< int > > RDocument::queryClosestXYWithIndices(QMap< RObject::Id, QSet< int > > &candidates, const RVector &wcsPosition, double range, bool draft, double strictRange=RMAXDOUBLE)Queries the entity closest to the given position from a set of candidates, along with the indices of the shape elements that are closest (2d).
Parameters:
candidates: Map of candidate entity IDs with their shape indices.wcsPosition: The position to which the entity has to be close (2d).range: The range in which to search.draft: True for draft mode (faster but less accurate).strictRange: The strict range for distance checking.
Returns: Pair of entity ID and set of shape indices.
queryConnectedEntities
Section titled “queryConnectedEntities”QSet< REntity::Id > RDocument::queryConnectedEntities(RObject::Id entityId, double tolerance=RS::PointTolerance, RObject::Id layerId=RObject::INVALID_ID)Queries all entities that are connected to the given entity within the specified tolerance.
Two entities are considered connected if their endpoints are within tolerance distance.
Parameters:
entityId: The ID of the entity to find connections for.tolerance: The maximum distance for considering entities connected.layerId: Optional layer ID to restrict search to, or INVALID_ID for all layers.
Returns: Set of entity IDs that are connected to the given entity.
queryContainedEntities
Section titled “queryContainedEntities”QSet< REntity::Id > RDocument::queryContainedEntities(const RBox &box) constconst
Queries all entities which are completely inside the given box.
Parameters:
box: Query box.result: Set of IDs of entities that are completely inside the given area.
queryContainedEntitiesXY
Section titled “queryContainedEntitiesXY”QSet< REntity::Id > RDocument::queryContainedEntitiesXY(const RBox &box) constconst
Queries entities that are completely contained within the given box in the XY plane.
Filters out undone entities, entities not on the current block, and invisible entities.
Parameters:
box: Query box.
Returns: Set of entity IDs that are completely contained in the box.
queryCurrentBlock
Section titled “queryCurrentBlock”QSharedPointer< RBlock > RDocument::queryCurrentBlock()queryCurrentLayer
Section titled “queryCurrentLayer”QSharedPointer< RLayer > RDocument::queryCurrentLayer()queryCurrentView
Section titled “queryCurrentView”QSharedPointer< RView > RDocument::queryCurrentView()queryDimStyle
Section titled “queryDimStyle”QSharedPointer< RDimStyle > RDocument::queryDimStyle() constconst
queryDimStyleDirect
Section titled “queryDimStyleDirect”QSharedPointer< RDimStyle > RDocument::queryDimStyleDirect() constconst
queryDocumentVariables
Section titled “queryDocumentVariables”QSharedPointer< RDocumentVariables > RDocument::queryDocumentVariables() constconst
queryDocumentVariablesDirect
Section titled “queryDocumentVariablesDirect”QSharedPointer< RDocumentVariables > RDocument::queryDocumentVariablesDirect() constconst
queryEntity
Section titled “queryEntity”QSharedPointer< REntity > RDocument::queryEntity(RObject::Id entityId) constconst
Queries the entity with the given ID.
A clone of the actual entity is returned. Clones should always be used when modifying entities.
Returns: Pointer to the entity or NULL.
queryEntityDirect
Section titled “queryEntityDirect”QSharedPointer< REntity > RDocument::queryEntityDirect(RObject::Id entityId) constconst
Queries the entity with the given ID.
If the storage has the entity instantiated, the instance is returned (rather than a clone). Entities queried this way should not be modified unless undo / redo functionality is not required.
Returns: Pointer to the entity or NULL.
queryInfiniteEntities
Section titled “queryInfiniteEntities”QSet< REntity::Id > RDocument::queryInfiniteEntities() constconst
Returns: Set of entity IDs for all infinite entities (such as construction lines).
queryIntersectedEntitiesXY
Section titled “queryIntersectedEntitiesXY”QSet< REntity::Id > RDocument::queryIntersectedEntitiesXY(const RBox &box, bool checkBoundingBoxOnly=false, bool includeLockedLayers=true, RObject::Id blockId=RObject::INVALID_ID, const QList< RS::EntityType > &filter=RDEFAULT_QLIST_RS_ENTITYTYPE, bool selectedOnly=false, RObject::Id layerId=RObject::INVALID_ID, bool snappable=false) constconst
Queries entities that intersect with the given box in the XY plane.
This is a convenience wrapper around queryIntersectedEntitiesXYWithIndex.
Parameters:
box: Query box.checkBoundingBoxOnly: If true, only checks bounding box intersection.includeLockedLayers: If true, includes entities on locked layers.blockId: The block to query, or INVALID_ID for current block.filter: List of entity types to include, or empty for all types.selectedOnly: If true, only returns selected entities.layerId: Layer to filter by, or INVALID_ID for all layers.
Returns: Set of entity IDs that intersect with the box.
queryIntersectedEntitiesXYFast
Section titled “queryIntersectedEntitiesXYFast”QSet< REntity::Id > RDocument::queryIntersectedEntitiesXYFast(const RBox &box)Queries entities that intersect with the given box (fast approximation based on bounding boxes).
Parameters:
box: Query box.
Returns: Set of entity IDs that may intersect with the box.
queryIntersectedEntitiesXYWithIndex
Section titled “queryIntersectedEntitiesXYWithIndex”QMap< REntity::Id, QSet< int > > RDocument::queryIntersectedEntitiesXYWithIndex(const RBox &box, bool checkBoundingBoxOnly=false, bool includeLockedLayers=true, RObject::Id blockId=RObject::INVALID_ID, const QList< RS::EntityType > &filter=RDEFAULT_QLIST_RS_ENTITYTYPE, bool selectedOnly=false, RObject::Id layerId=RObject::INVALID_ID, bool snappable=false) constconst
Queries entities that intersect with the given box in the XY plane, returning both entity IDs and shape element indices.
Parameters:
box: Query box.checkBoundingBoxOnly: If true, only checks bounding box intersection.includeLockedLayers: If true, includes entities on locked layers.blockId: The block to query, or INVALID_ID for current block.filter: List of entity types to include, or empty for all types.selectedOnly: If true, only returns selected entities.layerId: Layer to filter by, or INVALID_ID for all layers.
Returns: Map of entity IDs to sets of intersecting shape element indices.
queryIntersectedShapesXY
Section titled “queryIntersectedShapesXY”QMap< REntity::Id, QSet< int > > RDocument::queryIntersectedShapesXY(const RBox &box, bool checkBoundingBoxOnly=false, bool includeLockedLayers=true, RObject::Id blockId=RObject::INVALID_ID, const QList< RS::EntityType > &filter=RDEFAULT_QLIST_RS_ENTITYTYPE, bool selectedOnly=false, RObject::Id layerId=RObject::INVALID_ID, bool snappable=false) constconst
Queries entity shapes that intersect with the given box in the XY plane, returning both entity IDs and shape element indices.
This method performs more precise intersection testing than the fast variant.
Parameters:
box: Query box.checkBoundingBoxOnly: If true, only checks bounding box intersection.includeLockedLayers: If true, includes entities on locked layers.blockId: The block to query, or INVALID_ID for current block.filter: List of entity types to include, or empty for all types.selectedOnly: If true, only returns selected entities.layerId: Layer to filter by, or INVALID_ID for all layers.
Returns: Map of entity IDs to sets of intersecting shape element indices.
queryIntersectedShapesXYFast
Section titled “queryIntersectedShapesXYFast”QSet< REntity::Id > RDocument::queryIntersectedShapesXYFast(const RBox &box, bool noInfiniteEntities=false)Queries entity shapes that intersect with the given box (fast approximation).
Returns only visible entities.
Parameters:
box: Query box.noInfiniteEntities: If true, excludes infinite entities like construction lines.
Returns: Set of entity IDs whose shapes intersect with the box.
queryLayer
Section titled “queryLayer”QSharedPointer< RLayer > RDocument::queryLayer(const QString &layerName) constconst
Queries the layer with the given name.
Returns: Pointer to the layer or NULL.
queryLayer
Section titled “queryLayer”QSharedPointer< RLayer > RDocument::queryLayer(RObject::Id layerId) constconst
Queries the layer with the given ID.
Returns: Pointer to the layer or NULL.
queryLayerBlockEntities
Section titled “queryLayerBlockEntities”QSet< REntity::Id > RDocument::queryLayerBlockEntities(RObject::Id layerId, RObject::Id blockId) constconst
queryLayerDirect
Section titled “queryLayerDirect”QSharedPointer< RLayer > RDocument::queryLayerDirect(RObject::Id layerId) constconst
Queries the layer with the given ID direct (no cloning).
Layers queried this way should not be modified unless undo / redo functionality is not required.
Returns: Pointer to the layer or NULL.
queryLayerEntities
Section titled “queryLayerEntities”QSet< REntity::Id > RDocument::queryLayerEntities(RObject::Id layerId, bool allBlocks=false) constconst
Returns: A set of all entity IDs on the given layer.
queryLayerState
Section titled “queryLayerState”QSharedPointer< RLayerState > RDocument::queryLayerState(const QString &layerStateName) constconst
Queries the layer state with the given name.
Returns: Pointer to the layer state or NULL.
queryLayerState
Section titled “queryLayerState”QSharedPointer< RLayerState > RDocument::queryLayerState(RObject::Id layerStateId) constconst
Queries the layer state with the given ID.
Returns: Pointer to the layer state or NULL.
queryLayerStateDirect
Section titled “queryLayerStateDirect”QSharedPointer< RLayerState > RDocument::queryLayerStateDirect(RObject::Id layerStateId) constconst
Queries the layer state with the given ID direct (no cloning).
Layer states queried this way should not be modified unless undo / redo functionality is not required.
Returns: Pointer to the layer state or NULL.
queryLayout
Section titled “queryLayout”QSharedPointer< RLayout > RDocument::queryLayout(const QString &layoutName) constconst
Queries the layout with the given name.
Returns: Pointer to the layout or NULL.
queryLayout
Section titled “queryLayout”QSharedPointer< RLayout > RDocument::queryLayout(RObject::Id layoutId) constconst
Queries the layout with the given ID.
Returns: Pointer to the layout or NULL.
queryLayoutDirect
Section titled “queryLayoutDirect”QSharedPointer< RLayout > RDocument::queryLayoutDirect(RObject::Id layoutId) constconst
Queries the layout with the given ID direct (no cloning).
Layouts queried this way should not be modified unless undo / redo functionality is not required.
Returns: Pointer to the layout or NULL.
queryLinetype
Section titled “queryLinetype”QSharedPointer< RLinetype > RDocument::queryLinetype(const QString &linetypeName) constconst
Queries the linetype with the given name.
Returns: Pointer to the linetype or NULL.
queryLinetype
Section titled “queryLinetype”QSharedPointer< RLinetype > RDocument::queryLinetype(RObject::Id linetypeId) constconst
Queries the linetype with the given ID.
Returns: Pointer to the linetype or NULL.
queryObject
Section titled “queryObject”QSharedPointer< RObject > RDocument::queryObject(RObject::Id objectId) constconst
Queries the object with the given ID.
Returns: Shared pointer to the object or a null pointer.
queryObjectByHandle
Section titled “queryObjectByHandle”QSharedPointer< RObject > RDocument::queryObjectByHandle(RObject::Handle objectHandle) constconst
Queries an object by its handle.
Parameters:
objectHandle: The handle of the object to query.
Returns: Shared pointer to the object or a null pointer.
queryObjectCC
Section titled “queryObjectCC”RObject * RDocument::queryObjectCC(RObject::Id objectId) constconst
Queries the object with the given ID using the internal storage representation.
This is faster than queryObject but returns a pointer that should not be modified.
Parameters:
objectId: The ID of the object to query.
Returns: Raw pointer to the object or NULL.
queryObjectDirect
Section titled “queryObjectDirect”QSharedPointer< RObject > RDocument::queryObjectDirect(RObject::Id objectId) constconst
Queries the object with the given ID.
If the storage has the object instantiated, the instance is returned (rather than a clone). Objects queried this way should not be modified unless undo / redo functionality is not required.
Returns: Pointer to the object or NULL.
queryPropertyEditorObjects
Section titled “queryPropertyEditorObjects”QSet< RObject::Id > RDocument::queryPropertyEditorObjects()Queries all objects that should be shown in the property editor.
If entities are selected, returns those. Otherwise returns selected layers, current block, and associated layout.
Returns: Set of object IDs for the property editor.
querySelectedEntities
Section titled “querySelectedEntities”QSet< REntity::Id > RDocument::querySelectedEntities() constconst
Queries all selected entities.
Returns: Set of IDs of all selected entities.
querySelectedLayerEntities
Section titled “querySelectedLayerEntities”QSet< REntity::Id > RDocument::querySelectedLayerEntities(RObject::Id layerId, bool allBlocks=false) constconst
Returns: A set of all entity IDs of selected entities on the given layer.
querySelectedLayers
Section titled “querySelectedLayers”QSet< RObject::Id > RDocument::querySelectedLayers() constconst
Queries all selected objects.
Returns: Set of IDs of all selected objects.
queryUcs
Section titled “queryUcs”QSharedPointer< RUcs > RDocument::queryUcs(const QString &ucsName) constconst
Queries the UCS with the given name.
Returns: Pointer to the UCS or NULL.
queryUcs
Section titled “queryUcs”QSharedPointer< RUcs > RDocument::queryUcs(RObject::Id ucsId) constconst
Queries the UCS with the given ID.
Returns: Pointer to the UCS or NULL.
queryView
Section titled “queryView”QSharedPointer< RView > RDocument::queryView(const QString &viewName) constconst
Queries the view with the given name.
Returns: Pointer to the view or NULL.
queryView
Section titled “queryView”QSharedPointer< RView > RDocument::queryView(RObject::Id viewId) constconst
Queries the view with the given ID.
Returns: Pointer to the view or NULL.
queryVisibleEntityDirect
Section titled “queryVisibleEntityDirect”QSharedPointer< REntity > RDocument::queryVisibleEntityDirect(RObject::Id entityId) constconst
Queries a visible entity with the given ID, returning the direct instance.
If the entity is not visible, returns a null pointer.
Parameters:
entityId: The ID of the entity to query.
Returns: Shared pointer to the entity or a null pointer.
queryWorkingSetEntities
Section titled “queryWorkingSetEntities”QSet< REntity::Id > RDocument::queryWorkingSetEntities() constconst
Returns: A set of all entity IDs in the current working set.
rebuildSpatialIndex
Section titled “rebuildSpatialIndex”virtual void RDocument::rebuildSpatialIndex()virtual
Rebuilds the entire spatial index from scratch (e.g.
when current block is changed).
QList< RTransaction > RDocument::redo()Redoes a previously undone transaction.
Returns: Set of affected entity IDs. Higher level callers can use this set to update scenes, views, etc accordingly.
removeBlockFromSpatialIndex
Section titled “removeBlockFromSpatialIndex”void RDocument::removeBlockFromSpatialIndex(RObject::Id blockId)Removes all entities from the given block from the spatial index.
This is typically done when entering a block for editing.
Parameters:
blockId: The ID of the block to remove from the spatial index.
removeFromSpatialIndex
Section titled “removeFromSpatialIndex”void RDocument::removeFromSpatialIndex(QSharedPointer< REntity > entity)Removes an entity from the spatial index using its current bounding boxes.
Parameters:
entity: The entity to remove from the spatial index.
removeFromSpatialIndex
Section titled “removeFromSpatialIndex”virtual void RDocument::removeFromSpatialIndex(QSharedPointer< REntity > entity, const QList< RBox > &boundingBoxes)virtual
Removes an entity from the spatial index using the given bounding boxes.
If no bounding boxes are provided, uses the entity’s current bounding boxes.
Parameters:
entity: The entity to remove from the spatial index.boundingBoxes: The bounding boxes to use for removal.
removeVariable
Section titled “removeVariable”void RDocument::removeVariable(const QString &key)Removes the custom variable with the given key.
resetTransactionStack
Section titled “resetTransactionStack”void RDocument::resetTransactionStack()Resets the transaction stack, clearing all undo and redo history.
selectAllEntities
Section titled “selectAllEntities”void RDocument::selectAllEntities(QSet< RObject::Id > *affectedEntities=NULL)Selects all not selected entities.
selectEntities
Section titled “selectEntities”int RDocument::selectEntities(const QSet< RObject::Id > &entityId, bool add=false, QSet< RObject::Id > *affectedEntities=NULL)Selects all entities with the given IDs.
Parameters:
add: True to add the entities to the current selection. False to replace the current selection with the new entities.affected: Optional pointer to an empty set of entity IDs. After the call, this set will contain all entity IDs of entities that were affected by the call.
selectEntity
Section titled “selectEntity”void RDocument::selectEntity(RObject::Id entityId, bool add=false, QSet< RObject::Id > *affectedEntities=NULL)Selects the entity with the given ID.
Parameters:
add: True to add the entity to the current selection. False to replace the current selection with the given entity.affected: Optional pointer to an empty set of entity IDs. After the call, this set will contain all entity IDs of entities that were affected by the call.
setAutoTransactionGroup
Section titled “setAutoTransactionGroup”void RDocument::setAutoTransactionGroup(bool on)inline
True: add all operations to the current transaction group.
setCurrentBlock
Section titled “setCurrentBlock”void RDocument::setCurrentBlock(const QString &blockName)Sets the current block for editing by name.
Parameters:
blockName: The name of the block to set as current.
setCurrentBlock
Section titled “setCurrentBlock”void RDocument::setCurrentBlock(RObject::Id blockId)Sets the current block for editing.
Removes the block from the spatial index while it’s being edited and adds the previous block back to the spatial index.
Parameters:
blockId: The ID of the block to set as current.
setCurrentColor
Section titled “setCurrentColor”void RDocument::setCurrentColor(const RColor &color)setCurrentLayer
Section titled “setCurrentLayer”void RDocument::setCurrentLayer(const QString &layerName, RTransaction *transaction=NULL)setCurrentLayer
Section titled “setCurrentLayer”void RDocument::setCurrentLayer(RObject::Id layerId, RTransaction *transaction=NULL)setCurrentLinetype
Section titled “setCurrentLinetype”void RDocument::setCurrentLinetype(const QString &name)setCurrentLinetype
Section titled “setCurrentLinetype”void RDocument::setCurrentLinetype(RObject::Id ltId)setCurrentLinetypePattern
Section titled “setCurrentLinetypePattern”void RDocument::setCurrentLinetypePattern(const RLinetypePattern &p)setCurrentLineweight
Section titled “setCurrentLineweight”void RDocument::setCurrentLineweight(RLineweight::Lineweight lw)setCurrentView
Section titled “setCurrentView”void RDocument::setCurrentView(const QString &viewName)setCurrentView
Section titled “setCurrentView”void RDocument::setCurrentView(RObject::Id viewId)setCurrentViewport
Section titled “setCurrentViewport”void RDocument::setCurrentViewport(RObject::Id viewportId)Sets the current viewport for this document.
Parameters:
viewportId: The ID of the viewport to set as current.
setDimensionFont
Section titled “setDimensionFont”void RDocument::setDimensionFont(const QString &f, RTransaction *transaction=NULL)setFileName
Section titled “setFileName”void RDocument::setFileName(const QString &fn)Sets the file name associated with this document.
Parameters:
fn: The file name to set.
setFileVersion
Section titled “setFileVersion”void RDocument::setFileVersion(const QString &fv)Sets the file version string for this document.
Parameters:
fv: The file version string to set.
setIgnoreWorkingSet
Section titled “setIgnoreWorkingSet”void RDocument::setIgnoreWorkingSet(bool on)Sets whether to ignore the working set.
Parameters:
on: True to ignore the working set, false otherwise.
setKnownVariable
Section titled “setKnownVariable”void RDocument::setKnownVariable(RS::KnownVariable key, const QVariant &value, RTransaction *transaction=NULL)Sets a known DXF/DWG variable for this document.
Parameters:
key: Variable key (see DXF reference)value: New value of the variable.transaction: RTransaction to use for the change or NULL (default) to create a transaction on the fly.
setKnownVariable
Section titled “setKnownVariable”void RDocument::setKnownVariable(RS::KnownVariable key, const RVector &value, RTransaction *transaction=NULL)Sets a known DXF/DWG variable for this document.
Parameters:
key: Variable key (see DXF reference)value: New value of the variable.transaction: RTransaction to use for the change or NULL (default) to create a transaction on the fly.
setLinearFormat
Section titled “setLinearFormat”void RDocument::setLinearFormat(RS::LinearFormat f)Sets the linear format type for this document.
This updates the dimension style variable “$DIMLUNIT”.
Parameters:
f: The linear format type to set.
setLinetypeScale
Section titled “setLinetypeScale”void RDocument::setLinetypeScale(double v, RTransaction *transaction=NULL)Sets the global linetype scale of this document to the given value.
Parameters:
transaction: Transaction to use for the modification or NULL to create a local transaction (default).
setMeasurement
Section titled “setMeasurement”void RDocument::setMeasurement(RS::Measurement m, RTransaction *transaction=NULL)Sets the measurement system for this document (metric or imperial).
Also reinitializes linetypes to match the new measurement system.
Parameters:
m: The measurement system to set.transaction: Optional transaction to use. If NULL, changes are made directly.
setModified
Section titled “setModified”void RDocument::setModified(bool m)Resets the modified flag.
Modification time is stored.
setNotifyListeners
Section titled “setNotifyListeners”void RDocument::setNotifyListeners(bool on)Sets whether listeners should be notified of changes to the document.
Parameters:
on: True to enable listener notifications, false to disable.
setUnit
Section titled “setUnit”void RDocument::setUnit(RS::Unit unit, RTransaction *transaction=NULL)Sets the unit of measurement for this document.
Also reinitializes linetypes to match the new unit system.
Parameters:
unit: The unit of measurement to set.transaction: Optional transaction to use. If NULL, changes are made directly.
setVariable
Section titled “setVariable”void RDocument::setVariable(const QString &key, const QVariant &value, bool overwrite=true)Sets a custom variable in the context of this document.
Parameters:
key: Variable key (name)value: Variable valueoverwrite: True to overwrite an existing variable with the same key (default)
showLeadingZeroes
Section titled “showLeadingZeroes”bool RDocument::showLeadingZeroes()Returns: True if leading zeroes should be shown in linear dimensions, false otherwise. This is determined by the dimension style variable “$DIMZIN”.
showLeadingZeroesAngle
Section titled “showLeadingZeroesAngle”bool RDocument::showLeadingZeroesAngle()Returns: True if leading zeroes should be shown in angular dimensions, false otherwise. This is determined by the dimension style variable “$DIMAZIN”.
showTrailingZeroes
Section titled “showTrailingZeroes”bool RDocument::showTrailingZeroes()Returns: True if trailing zeroes should be shown in linear dimensions, false otherwise. This is determined by the dimension style variable “$DIMZIN”.
showTrailingZeroesAngle
Section titled “showTrailingZeroesAngle”bool RDocument::showTrailingZeroesAngle()Returns: True if trailing zeroes should be shown in angular dimensions, false otherwise. This is determined by the dimension style variable “$DIMAZIN”.
sortBlocks
Section titled “sortBlocks”QList< RBlock::Id > RDocument::sortBlocks(const QList< RObject::Id > &blockIds) constconst
sortLayers
Section titled “sortLayers”QList< RLayer::Id > RDocument::sortLayers(const QList< RObject::Id > &layerIds) constconst
startTransactionGroup
Section titled “startTransactionGroup”void RDocument::startTransactionGroup()substituteAutoVariables
Section titled “substituteAutoVariables”QString RDocument::substituteAutoVariables(const QString &expression)Substitutes all auto variable references in the given expression with their values.
Parameters:
expression: The expression containing auto variable references.
Returns: The expression with auto variables replaced by their values.
QList< RTransaction > RDocument::undo()Undoes the last transaction.
Returns: The transaction that was undone. Higher level callers can use this set to update scenes, views, etc accordingly.
unsetCurrentViewport
Section titled “unsetCurrentViewport”void RDocument::unsetCurrentViewport()Unsets the current viewport for this document.
updateAllEntities
Section titled “updateAllEntities”void RDocument::updateAllEntities()Updates all entities in the document (recalculates bounding boxes, etc.).
This is typically done after changing document-level settings.
getClipboard
Section titled “getClipboard”static RDocument & RDocument::getClipboard()static
Returns: Reference to the global clipboard document. The clipboard is created on first access.
clipboard
Section titled “clipboard”static RDocument * RDocument::clipboard = NULLstatic protected
All rights reserved.
This file is part of the QCAD project.
QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with QCAD.
autoTransactionGroup
Section titled “autoTransactionGroup”bool RDocument::autoTransactionGroupprivate
disableSpatialIndicesByBlock
Section titled “disableSpatialIndicesByBlock”bool RDocument::disableSpatialIndicesByBlockprivate
fileName
Section titled “fileName”QString RDocument::fileNameprivate
fileVersion
Section titled “fileVersion”QString RDocument::fileVersionprivate
linetypeByBlockId
Section titled “linetypeByBlockId”RObject::Id RDocument::linetypeByBlockIdprivate
linetypeByLayerId
Section titled “linetypeByLayerId”RObject::Id RDocument::linetypeByLayerIdprivate
spatialIndex
Section titled “spatialIndex”RSpatialIndex& RDocument::spatialIndexprivate
spatialIndicesByBlock
Section titled “spatialIndicesByBlock”QMap<RObject::Id, RSpatialIndex*> RDocument::spatialIndicesByBlockprivate
storage
Section titled “storage”RStorage& RDocument::storageprivate
transactionStack
Section titled “transactionStack”RTransactionStack RDocument::transactionStackprivate
operator<<
Section titled “operator<<”QDebug operator<<(QDebug dbg, RDocument &d)Stream operator for QDebug.
Non-Scriptable: This function is not available in script environments.