What external tools do you use for Ignition development, and why?

They should be relative to the position of the saved VS Code workspace.

So if you do "Save Workspace As" in VS Code, wherever you choose to put that file (We typically do it in the root) of the repo, then it would be relative to that.

Typically we are using this extension with gateways running in docker containers, and not on direct windows installs, so arguably I have not ran through that specific scenario before.

You could try creating a VS Code Workspace in your C:\Program Files\Inductive Automation\Ignition\data directory, and then setting the paths to just be projects?

Or you could try making the workspace in your home directory for your user, and then putting in a full hardcoded projectPath for C:\Program Files\Inductive Automation\Ignition\data\projects? Here is a proposed workspace file for that setup. If you make a folder (wherever you typically use as a working directory, lets pretends its C:\Users\username\ignition

With the file at C:\Users\username\ignition\ignition.code-workspace.json

{
	"folders": [
    {
      "name": "Root", # Reference to C:\Users\username\ignition
      "path": "."
    },
    {
      "name": "Projects Directory",
      "path": "C:\Program Files\Inductive Automation\Ignition\data\projects"
    }
  ],
	"settings": {
    "ignitionFlint.ignitionGateways": [
      {
        "label": "Ignition",
        "address": "http://localhost:8088",
        "projectPaths": [
          "C:\Program Files\Inductive Automation\Ignition\data\projects"
        ],
        "updateDesignerOnSave": true,
        "forceUpdateDesigner": true,
        "supportsProjectScanEndpoint": true
      }
    ]
	}
}

Caveat, that I dont have access to a windows computer at the moment and so I did not test that at all.

3 Likes

Would it ever be possible to allow other JVM languages as the scripting language? It would be nice to write scripts directly in Java or Kotlin.

Technically it may be; Kotlin at one point had support for the now defunct JSR-223 scripting engine thing.

Whether we would actually pursue that is another thing.

2 Likes

Could be a designer feature tbh - Visual Studio lets you type cw then tab to auto type console.writeLine(). Would be huge for system.perspective.print().

I use AutoHotKey for that, as well as my Ignition login/pwd. Together they have undoubtedly saved me hours worth of time over just the last couple years.

When you are using VScode for Project Scripting edits, how do you get VScode to recognize system or other local scripting functions.


Notifications is another Scripting folder within the project.

@thecesrom.git has a set of Python "stubs" that you can import to a modern Python editor corresponding to the system functions:

You will probably still have to manually import system in your editor to convince it things are in scope. You don't want import system to end up in your final script, though it's not really catastrophic if it does.

2 Likes

Why don't you want import system to end up in the final script?

1 Like

From import system many people end up with import MyProjectLibraryScript, which does cause problems [1] [2].

It's also unnecessary and can lead to "cargo culting", where people just assume they have to import system for system functions to work, which is not true anywhere [3].


  1. ↩︎

  2. ↩︎

  3. except in gateway scoped event scripts, until 8.3.0 is released ↩︎

12 Likes

This is probably a code snippet, you can add your own in vscode.

You could also use
import system.perspective.print as log
To shorten it a bit as well.

Be aware that import always takes the interpreter's modules lock, which can stall your script if something big is importing elsewhere (highly parallel as noted above). All use of import should be in project library scripts at the outermost level, never inside function definitions, or performance will suffer.

5 Likes

Thanks @pturmel, you're right, it would stall the script if something else has taken the lock already and seeing as though it's an unnecessary import it's not the best idea.

Referencing this as I had to do some digging into how it works.

I also spent way too long looking at some of your example code https://www.automation-pros.com/ignition/ Thank you for making that available.

1 Like

Can you elaborate using of tailwind css in perspective?

3 Likes

+1

Very interested in that. Can you share more?