Jump to content
Developer Wiki and Function Reference Links Read more... ×
Cmb

Associations equivalent in C++

Recommended Posts

Hello !

I'd like to know if there is an equivalent as this method in Vectorscript in the SDK

AddAssociation(obj1, kOnDeleteDelete, obj2);

or what is the best way to have the same behavior, as I want to delete a child when an Object is removed.

 

I also tried to catch the event in VWParametric_EventSink, but can't find a virtual for that.

Is there a way to do this without having to override :

virtual Sint32 VCOM_CALLTYPE	Execute(ParametricMessage* message);

 

Thanks

Share this post


Link to post

You can add an association with Kludge.  I couldn't find a way to remove an association, so I call VS.

    // ------------------------------------------------------------------------------------------------------
    void AddDeleteAssociation(MCObjectHandle FromObject, MCObjectHandle ToObject)
    {
        PluginLibraryArgTable argTable;
        argTable.args[0].argType = kHandleArgType;
        argTable.args[0].handleValue  = FromObject;
        argTable.args[1].argType = kIntegerArgType;
        argTable.args[1].intValue   = 4;
        argTable.args[2].argType = kHandleArgType;
        argTable.args[2].handleValue  = ToObject;
        
        EPE_Kludge in( EPE_Kludge::kKludgeAddAssociation, & argTable );
        ::GS_Kludge( gCBP, EPE_Kludge::kKludgeSelector, & in, nil ) && argTable.functionResult.boolValue;;
    }
    
    void RemoveDeleteAssociation(MCObjectHandle FromObject, MCObjectHandle ToObject)
    {
        PluginLibraryArgTable argTable;
        argTable.args[0].argType = kHandleArgType;
        argTable.args[0].handleValue  = ToObject;
        argTable.args[1].argType = kIntegerArgType;
        argTable.args[1].intValue   = 4;
        argTable.args[2].argType = kHandleArgType;
        argTable.args[2].handleValue  = FromObject;
        
        gSDK->CallPluginLibrary("RemoveAssociation", &argTable, 0);
    }
    // ------------------------------------------------------------------------------------------------------

If you want to handle deletions on the event level, look at the UpdateSupport example in the SDK.  The update manager runs independently of the plug-in objects, so it can handle deletions.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×