Dominique Corpataux Posted January 27 Share Posted January 27 Hello My actually (succesful) approach is, to connect python (import pymysql) to an sql database, query data from this database and do the same with a website. So far that works but this needs a costly infrastructure to run. I am searching a way to directly share data via Session-Variable or at least a JSON download inside the web Dialoge and grab this data with Vectorworks after leaving the dialog. If I would download a file inside the web dialog this file is nowhere, also cookies or session variables are stored encapsulated from the system and also reversed system is encapsulated for the webbrowser. By the way that is good generally for our all security. I think there must be an undocumented API to directly securely transfer local data between the web Dialog and Vectorworks. Maybe SDK technique has to be used for this? I'm curious about it. Quote Link to comment
PatW Posted January 31 Share Posted January 31 (edited) In the SDK you would use the class IExtensionWebPalette to define your webpalette and IWebJavaScriptProvider to register the JavaScript functions which can hand data back to the C++ part. class YourCustom_JSProvider: public VCOMImmediateImpl<IWebJavaScriptProvider> { public: CableToolWebPaletteJSProvider(); virtual ~CableToolWebPaletteJSProvider(); virtual void OnInit(IInitContext* context); virtual void VCOM_CALLTYPE OnFunction(const TXString& name, const std::vector<VWVariant>& args, VectorWorks::UI::IJSFunctionCallbackContext* context); private: IWebPaletteFrame* fWebFrame; }; // -------------------------------------------------------------------------------------------------------- class YourCustom_JSProviderCableToolWebPalette : public VCOMImmediateImpl<IExtensionWebPalette> { DEFINE_VWPaletteExtension; DEFINE_VWProtection; public: CableToolWebPalette(CallBackPtr); virtual ~CableToolWebPalette(); virtual IEventSink* VCOM_CALLTYPE QueryEventSink(const TSinkIID& iid); virtual TXString VCOM_CALLTYPE GetTitle(); virtual bool VCOM_CALLTYPE GetInitialSize(ViewCoord& outCX, ViewCoord& outCY); virtual TXString VCOM_CALLTYPE GetInitialURL(); private: CableToolWebPaletteJSProvider fJSProvider; }; Register the function: void YourCustom_JSProvider::OnInit(IInitContext* context) context->AddFunction( "VW_UpdateData" ); When it is triggered in the webpalette this callback is executed: void YourCustom_JSProvider::OnFunction(const TXString& name, const std::vector<VWVariant>& args, VectorWorks::UI::IJSFunctionCallbackContext* context) Unfortunately there is no doc about this on the vw wiki. Edited January 31 by PatW 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.