matteoluigi Posted January 5, 2023 Share Posted January 5, 2023 Hi, is there any possibility to run a script inside another script. sth like "run(anotherscript)" or vs.run(anotherscript) (anotherscript here of course is the name of another script which I want to run in a script) Quote Link to comment
JBenghiat Posted January 5, 2023 Share Posted January 5, 2023 No, you can’t call one script from another. If you want to share code among scripts, you can use include files. In VS, an include works as though the external file were inserted at the point of the include statement. 1 Quote Link to comment
matteoluigi Posted January 5, 2023 Author Share Posted January 5, 2023 and 1) i guess, I have to store the code as a py or vs file somewhere 2) with which command can i include that file? Quote Link to comment
JBenghiat Posted January 5, 2023 Share Posted January 5, 2023 For Python you are creating a standard import file or module, and the rules are a little different. I think the python form includes some relevant posts. For VS, create a vile with the extension .vs, .vss, or .px. px files will include and encrypt themselves for locked plug-ins. They also work for unencrypted plug-ins, so that's what I tend to use. The syntax is {$INCLUDE filename.extension}. You can see more in the Vectorscript Language Guide: https://developer.vectorworks.net/images/7/72/VectorScriptGuide.pdf If no path is provided, Vectorworks will look for a file in the same directory as the calling script, which if called from a plug-in, will be in the plug-ins folder. You can also include an absolute path or a valid POSIX path (including relative paths) to access the include file anywhere on your system. 1 Quote Link to comment
Gibson431 Posted January 23, 2023 Share Posted January 23, 2023 On 1/6/2023 at 6:47 AM, JBenghiat said: If no path is provided, Vectorworks will look for a file in the same directory as the calling script, which if called from a plug-in, will be in the plug-ins folder. You can also include an absolute path or a valid POSIX path (including relative paths) to access the include file anywhere on your system. Is there a way to use relative / posix paths to include files one folder down? I am attempting to organise a fairly involved plugin that ideally references files in a hierarchical structure e.g.: plugin.vso modules/ module1.px module2.px models/ model1script.px model2script.px I can easily import files in the same same level as the plugin folder but attempting to include any files further down don't seem to be recognised. My best guess is that this is a quirk of the version of pascal VectorScript is but unfortunately I can't move to python. Thanks Quote Link to comment
matteoluigi Posted January 23, 2023 Author Share Posted January 23, 2023 another solution could be (surprise surprise) MARIONETTE 😄 (create modular scripts or take already existing ones from the library in order to combine tham to... whatever!) 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.