VS:AddAssociation

From Vectorworks Developer
Revision as of 14:25, 12 August 2013 by Root (talk | contribs) (1 revision)
Jump to navigation Jump to search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Adds an object-to-object association.

FUNCTION AddAssociation(
ioOwnerObj :HANDLE;
inKind :INTEGER;
ioTargetObj :HANDLE) :BOOLEAN;
def vs.AddAssociation(ioOwnerObj, inKind, ioTargetObj):
    return BOOLEAN

Parameters

ioOwnerObj HANDLE
inKind INTEGER
ioTargetObj HANDLE

Example

VectorScript

PROCEDURE Example;
   {This script operates on any three parametric objects in the drawing.
     The objects must be named as required in GetObject Below.

   After the script has succeeded the following should be tested:
   1) deleting 'stairOne' deletes 'stairTwo'
   2) deleting 'stairTwo' deletes 'stairOne' and resets 'stairThree'
   
   Invoke Undo after each delete.}
CONST
   kOnDeleteDelete = 4; {Target object is deleted when owner is deleted.}
   kOnDeleteReset = 5;  {Target object is reset when owner is deleted.}
VAR
   obj1, obj2, obj3 :HANDLE;
   result :BOOLEAN;
BEGIN
   obj1 := GetObject('stairOne');
   obj2 := GetObject('stairTwo');
   obj3 := GetObject('stairThree');

   result := RemoveAssociation(obj1, kOnDeleteDelete, obj2);
   result := RemoveAssociation(obj2, kOnDeleteDelete, obj1);
   result := RemoveAssociation(obj2, kOnDeleteReset, obj3);

   result := AddAssociation(obj1, kOnDeleteDelete, obj2);
   result := AddAssociation(obj2, kOnDeleteDelete, obj1);
   result := AddAssociation(obj2, kOnDeleteReset, obj1);
END;
RUN(Example);

Python


Version

Availability: from All Versions

This is drop-in function.