Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Recalculation of Associative Dimensions Implementation

Default implementation for associative dimension recalculation

Implementation is based on the protocol extension represented with the OdDbDimAssocWatcherPE class. This class inherits the OdDbEvalWatcherPE class which is used for catching evaluation requests from associated objects.

OdDbDimAssoc class delegates most functionality to the OdDbDimAssocWatcherPE protocol extension which is responsible for the updating associative dimensions and OdDbDimAssoc objects when objects, that are associated with it, are modified, copied or erased.

Actual functionality should be implemented in class derived from OdDbDimAssocWatcherPE and the protocol extension should be added to OdDbDimAssoc class. By default this protocol extension is absent and recalculating of associative dimensions is off.

This provides a hook for client applications to create a custom implementation and reduces application size if the functionality is not required

Sample implementation for associative dimension recalculation

Sample implementation for associative dimension recalculation is illustrated in the ExDimAssoc.tx module. Source code for this module is located in {RootDir}\Drawing\Examples\ExDimAssoc, where {RootDir} is the ODA installation folder (for example, C:\ODA).

ExDimAssoc.tx module

This module defines the OdExDimAssoc class in order to create an ExDimAssoc object instead of the OdDbDimAssoc objects. Reactor implementation is contained in the ExDimAssocWatcherPE protocol extension class inherited from the OdDbDimAssocWatcherPE class.

To enable recalculation of associative dimensions load ExDimAssoc.tx module.

Limitatons: ExDimAssoc.tx uses GripPoints.tx module and ExEntityIntersection.tx module. In case when getOsnapPoints() and/or intersectWith() is not implemented for some entity, associative dimensions recalculation may fail.

ExDimAssoc class

This class stores run-time data to determine what exactly was modified in the dimension between openedForModify() and modified() notifications. The ExDimAssoc class also encapsulates the transaction reactor object as one of its members. The transaction reactor is activated if a source entity was modified. When the transaction ends, the OdExDimAssoc object checks which relevant objects were modified and determines whether associativity should be removed.

ExDimAssocWatcherPE class

This class redefines the following methods of the base class:

  • modified()
  • copied()
  • erased()

This class also contains the updateDimension() method, with various input parameters for different types of dimensions.

Note that implementation is in a beta state.

See Also

Working with Associative Dimensions

Associative Dimensions Architecture

Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.