An object scope describes a set of objects. It can have different forms:
kCADScopeSelectedObjectsdescribes all objects currently selected by the user
kCADScopeObjOnEditableLayersdescribes all objects currently editable (selectable) by the user
kCADScopeAllObjectsdescribes all objects
CADAddScopecreates a programmer scope.
4D CAD differentiates between the various IDs,
so you can pass any of the above values as a scope ID.
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.
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 (
add objects to it (
CADToScope) or apply logical operations on it
like addition, negation and intersection (
Be aware that object scopes can change automatically as a result of user operations or as a side effect of methods being called:
kCADScopeSelectedObjectsand possibly other scopes
kCADScopeSelectedObjects(as in next item)
kCADScopeSelectedObjectsif the object’s new layer or sublayer has a more restricted Layer mode. This side effect can lead to interesting programming errors.
By intercepting certain CAD events, you can manipulate the object scope the user operates on.
An object scope describes objects in a block or in the root drawing. It can not enclose objects in several blocks.