Next: , Previous: Object, Up: Concepts


3.10 Scope

An object scope describes a set of objects. It can have different forms:

4D CAD differentiates between the various IDs, so you can pass any of the above values as a scope ID. The method CADTypeOfScope returns which kind of scope an ID is.

4D CAD methods that expect an object ID operate on a single object, those that expect a scope ID operate on a number of objects (0 or more). Letting 4D CAD operate on a scope is faster and more convenient than working with single objects in a loop (Iterating object scopes).

A target object scope is a scope that a method will change. It can be kCADScopeSelectedObjects or a programmer scope. By passing a programmer scope, you can manipulate objects while leaving the current user selection of objects intact. This is a fundamental programming concept, not found in 4D Draw.

Call CADRemoveScope when you are finished using a programmer scope. CADRemoveBlock removes all programmer scopes attached to the block. CADClear removes all programmer scopes in an area. All other scopes are maintained automatically by 4D CAD.

Scopes change when you remove objects from it (CADFromScope), add objects to it (CADToScope) or apply logical operations on it like addition, negation and intersection (CADScopeLogic).

Be aware that object scopes can change automatically as a result of user operations or as a side effect of methods being called:

By intercepting certain CAD events, you can manipulate the object scope the user operates on.

Important
An object scope describes objects in a block or in the root drawing. It can not enclose objects in several blocks.

Methods
CADAddScope, CADRemoveScope, CADGetScopeIDs, CADTypeOfScope, CADCount, CADGetObjIDsArray, CADOneObjID, CADGetObjID, CADEmptyScope, CADCopyScope, CADToScope, CADFromScope, CADInScope, CADScopeLogic.