Jump to content
Developer Wiki and Function Reference Links ×

Notepad++ for Vectorscript


BillW

Recommended Posts

Recently I moved to Notepad++ for coding and have a full environment geared to Vectorscript.

 

If interested, information can be found at   http://www.whwsolution.co.uk/tag/vectorscript

 

select post “Vectorworks: Notepad++ for Vectorscript”

 

- download documentation PDF "notepad for vectorscript" for information on implementation/installation.

- download "notepad plus extras.zip" file
- unzip in your prefered location on your computer
- copy the following files to your Notepad++ installation directory as indicated.

 

Any problems drop me a line at info@whwsolution.co.uk

 

Find enclosed two flyer images giving an idea on the implementation.

 

The Notepad Pythonscript plugin allows extending of the environment which is impressive. It was a good exercise to understand how regex works in Python.

notepadflyer_1.thumb.jpg.96b6dcdcf55a8571b3042eb45c87d035.jpg

notepadflyer_2.thumb.jpg.e92153db2c6edaded184e446966c6ec1.jpg

 

  • Love 4
Link to comment
  • 3 weeks later...

I have just updated the autocompletion file "pascal.xml" for Vectorscript 2024. Find enclosed amended file. Replace existing file in folder "notepad plus\autoCompletion"

 

Calls added are:

 

CreateBorderlessBtn
CreateBorderlessMenu
CreateDataVisPDMenu
GISDimStringToMM
GetProjectElevation
IFC_GetStructureGUID
IFC_ReadProjectData
IFC_SetStructureGUID
IFC_WriteProjectData
IsResourceReferenced
SM_FromShape
SM_Preferences
SetProjectElevation
Space_FullyReset

 

Any problems drop me a line at info@whwsolution.co.uk

pascal.xml

  • Like 1
Link to comment
  • 2 weeks later...
  • 3 months later...

@BillW Thanks for taking the time to create, document, and share this, I've been using it for the last couple weeks and found it very helpful. A (possibly) silly question - is there a better work flow than copying and pasting the code back and forth between VW and Notepad ++? Using the Text File option in the script editor pulls it once but my ideal workflow would to be able to have the code refreshed each time the editor is open.

Any suggestions to be able to quickly push the code from Notepad ++ to VW?

Link to comment

Don't think there is an automatic way although I stand to be corrected.

 

But, in, for instance a plugin object, you could have the code content referenced by {$INCLUDE <codefilename>.px}  (contained in the user Plug-Ins folder) which references the code file in Notepad and setup developer mode but you'll still have to "Recompile the script" I believe.

You can also specify a pathname for the file.

ie   {$INCLUDE C:\Projects\Vectorworks\mytool\source scripts\mytool.px}

 

I'm old school and prefer to copy/paste to the Plugin Editor. I sometimes do not immediately save a file in Notepad but wait till I get things working. If things don't work I reload the file in Notepad and start again. Been using Notepad for quite a while.

 

I use Notepad Pascal language option much of the time (rather than Vectorscript User Defined Language) as the Function List tab displays the file routines. Although I do have a script to swap languages.

Link to comment

{$INCLUDE is the best way.

 

In the past (not certain about now), the VS Editor had a character limit of 32,000 characters. If you were working on a big project you had to use $INCLUDE to get all the code to compile.

 

And you only need the .PX file extension if you want to Encrypt the file.  You can us .vs, .text, or basically anything you like if you don't mind that part of the script not being encrypted.

 

For the few files I have encrypted, I used .vs for development. And then when I was ready to encrypt I duplicated everything, changed the extensions on the files and in the $Include lines. That way I knew I had an unencrypted version to fall back on.

Link to comment

You can use $INCLUDE statements in Palette Scripts, and in Plug-in Scripts. You can also set VW to recompile on each execution (VW Pref 21 – Developer Mode, or VW Pref 407 – ImmediateVSMode), but it is only "automatic" for scripts run inside Plug-ins. If you want to recompile a script that has an $INCLUDE statement in a Palette Script, then after you make changes to the disk file you will have to open the Script Editor for the script in the palette (Opt/Alt–Double Click) and then close the Editor with the OK button. No changes to the file are necessary. If you use the ESC key or click the Cancel button, nothing happens and the script will not be recompiled. 

 

If you have your $INCLUDE statement inside a Plug-in and set VW to recompile for each execution, VW will automatically recompile before each execution, so you can make edits in your disk file and rerun the Plug-in. Your disk changes will be recompiled.

 

Bottom Line: The Automatic Recompile option for Palette Scripts is meaningless. It only applies to Plug-in scripts.

 

HTH,

Raymond

Edited by MullinRJ
Typo - changed Pref 12 to Pref 21.
Link to comment
5 hours ago, MullinRJ said:

Bottom Line: The Automatic Recompile option for Palette Scripts is meaningless. It only applies to Plug-in scripts.

I actually think this is a bug. I believe that Developer Mode is supposed to recompile scripts as well as PIOs.

 

And I have actually had problems in VW2024 and 2023 where it was caching the compiled version of a script even after editing it. The work around I came up with was to Select and Cut the script, close the editor, open the editor and Paste.  Very annoying.

 

But are you certain that SetPref(12) is Developer mode? According to the Appendix, that is Log Time in Program.  21 is Stop Vectorscripts on Warnings.

 

 

  • Like 1
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...