Jayme McColgan Posted August 9, 2021 Share Posted August 9, 2021 morning y'all, so i've been writing python plugins for a little bit and i got a pretty good handle on that... i'm looking to make a small SDK project that runs a python script at startup and every 5-10 mins after that i have no idea where to start with using the SDK... i downloaded the sdk and looked around but im at a loss... lol Quote Link to comment
JBenghiat Posted August 9, 2021 Share Posted August 9, 2021 That's a fairly broad question, and getting started with the SDK is a lot harder than scripting. I'm not even sure if a step-by-step guide, as the process has so many variables. Guidance depends on your familiarity with: - Coding in c++ - Compiling software in an IDE - Your OS and VW version - Whether the solution is for personal use or for distribution Configuring your IDE to correctly compile and test for Vectorworks the first time can be a significant task. If you have the above set, you probably need to disclose a little more about what the script does. If you're dealing with document objects, you need to make sure a file is open and the document has the expected object types. That can be tricky if you're simply running the script at regular intervals. A better approach might be to trigger on certain events, for example, document open, document save, or making the document window inactive. You can also trigger off of creating or editing certain object types. See UpdateSupport for this. You would also have to look at the interfaces for running a python script from the SDK. Because of the above, coding your actions directly in the SDK might be preferable to loading a python script, because coding in error checks is much more difficult. Quote Link to comment
Jayme McColgan Posted August 9, 2021 Author Share Posted August 9, 2021 the script is a serial license checker and a logger for which serial is in the drawing a certain time. it basically just needs to make a http call(with a few args) to an external web server if it has an internet connection. i have this currently built into all my plugins but i think it would be lighter and faster to have it running as a background task when a cad opens and then every few minutes after that. Quote Link to comment
JBenghiat Posted August 10, 2021 Share Posted August 10, 2021 I might recommend a different solution altogether. When your plug-in is event enabled, the init event only runs once per session (or during certain events like exiting the plug-in manager). You can place your check here. (Note, in developer mode, the init event runs with every reset). You can have the the check set a value in saved setting or the string repository, so subsequent regen calls can do a quick validation check. If you really want the call to be periodic, have your regen event write a time stamp to settings or the string repository. Check the time stamp, and if your desired time has passed, send the htttp request. This sends your request at regular intervals, but only is the user is using the plug-in, which seems like it would suit your needs. These options would be simpler than going down the SDK rabbit hole. With copy protection, remember it only has to be strong enough that the price point of the plug-in is less than the value of someone’s time to defeat the protection. Also, your time in creating the protection should be less valuable than the missed revenue from the few people who can defeat it. Quote Link to comment
Jayme McColgan Posted August 11, 2021 Author Share Posted August 11, 2021 (edited) yeah that workflow is basically what i have in place now. some of my motivation to work with the SDK is to keep learning more and building my skillset. ill come back to it at some point after i have a far better understanding of building plugins. i still have a few challenges to overcome with a few of my preexisting plugins. Edited August 11, 2021 by Jayme McColgan Quote Link to comment
JBenghiat Posted August 11, 2021 Share Posted August 11, 2021 I would start by getting TesterModule to compile and debug. It has examples of menus, tools, objects, and commands. 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.