Short answer: You cannot access environment variables directly.
There are a few ways to pass parameters to drawj2d in order to access them from the hcl script:
1. source someinput.hcl
2. read data from file: open
3. system.getproperty user.dir gives access to some system properties, e.g. the user working directory. Get the complete list in jshell:
System.getProperties().forEach((key, value) -> System.out.println(key + ": " + value));`
4. $argv gives access to the list of command line arguments, passed to the drawing script
Long answer : drawj2d accessEnv.hcl "$(env)"
It is valid for Linux (and probably Mac) and uses way number 4.
accessEnv.hcl
if{<$argc1}{puts{USAGE:}puts{drawj2daccessEnv.hcl"$(env)"}exit1}setenvList[split[lindex$argv0]\n]puts"Number of variables: [llength $envList]"# foreach entry [sort $envList] {# puts $entry # }setitemLANG
setvalue{}foreachentry$envList{setindex[strfind${item}=$entry]if{=$index0}{setvalue[strtriml$entry${item}=]break}}puts"environment variable $item is: $value"
may return:
Number of variables: 99
environment variable LANG is: de_CH.UTF-8
The complete list of the available commands is printed in the drawj2d function reference. The hecl commands are documented on the hecl website.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A Monospaced Lines font would have to be added. I will have to look at it to see, if it can be implemented with a reasonable effort.
The stroke with of the letters is hard coded. It is related to the font size (but not linearly).
The width of the text block can be changed, see program documentation.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
have added to font LinesMono. It currently is just the single line font Lines monospaced.
There is no new release yet. If you want to test it, you'll need to download the source code and run ant to compile the program (requires JDK and Apache Ant).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2023-11-04
Hello, newbie here. I must miss something obvious, so please excuse my ignorance:
using command prompt (or PowerShell), I can cd to the directory where I unzipped Drawj2d files. I launch by typing "drawj2d" (without the quotes of course).
I get the welcome prompt (with wopyright and version 1.32). Mode says: Freehep
Problem: when typing the example prompt: ''drawj2d -T svg -W 100 -H 60 drawing.hcl'' nothing happens...
drawing.hcl contains the prompted input: (# variables set dx 50 etc. etc.)
What am I doing wrong?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Have you tried to type drawj2d -T svg -W 100 -H 60 drawing.hcl immediately (not testing "drawj2d" before)?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2024-01-25
A. Vontobel,
Would you customise this library for generating some enclosure drawings? We will pay you. If you are interested please contact yashodhan.joshi@gmail.com
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Personally I am not interested, but thanks for asking.
Drawj2d is is free software, subject to the GPL. The license allows the modification of the software, you just have to grant the users the same rights when redistributing the modified version (e.g. give them the source code). Thus you may ask any programmer to customize the software.
By the way, chances are that you can create customized drawings without modifying the drawj2d program. The hcl input files are "scriptable". Have a look at the manual, chapter "Programming commands". Again, you may ask any programmer (hcl is similar to the widely known TCL Tool Command Language).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please use this forum topic for comments about these releases.
Is there a way to access environment variables from HCL ?
Short answer: You cannot access environment variables directly.
There are a few ways to pass parameters to drawj2d in order to access them from the hcl script:
1. source someinput.hcl
2. read data from file: open
3.
system.getproperty user.dir
gives access to some system properties, e.g. the user working directory. Get the complete list in jshell:System.getProperties().forEach((key, value) -> System.out.println(key + ": " + value));`
4. $argv gives access to the list of command line arguments, passed to the drawing script
Long answer :
drawj2d accessEnv.hcl "$(env)"
It is valid for Linux (and probably Mac) and uses way number 4.
accessEnv.hcl
may return:
Number of variables: 99
environment variable LANG is: de_CH.UTF-8
The complete list of the available commands is printed in the drawj2d function reference. The hecl commands are documented on the hecl website.
Thanks for you quick answer and list of options. I now think I know how to proceed.
I have two questions regarding the font "Lines".
A Monospaced Lines font would have to be added. I will have to look at it to see, if it can be implemented with a reasonable effort.
The stroke with of the letters is hard coded. It is related to the font size (but not linearly).
The width of the text block can be changed, see program documentation.
have added to font LinesMono. It currently is just the single line font Lines monospaced.
There is no new release yet. If you want to test it, you'll need to download the source code and run ant to compile the program (requires JDK and Apache Ant).
Released in 1.3.2
Hello, newbie here. I must miss something obvious, so please excuse my ignorance:
using command prompt (or PowerShell), I can cd to the directory where I unzipped Drawj2d files. I launch by typing "drawj2d" (without the quotes of course).
I get the welcome prompt (with wopyright and version 1.32). Mode says: Freehep
Problem: when typing the example prompt: ''drawj2d -T svg -W 100 -H 60 drawing.hcl'' nothing happens...
drawing.hcl contains the prompted input: (# variables set dx 50 etc. etc.)
What am I doing wrong?
Thanks
Have you tried to type
drawj2d -T svg -W 100 -H 60 drawing.hcl
immediately (not testing "drawj2d" before)?A. Vontobel,
Would you customise this library for generating some enclosure drawings? We will pay you. If you are interested please contact yashodhan.joshi@gmail.com
Personally I am not interested, but thanks for asking.
Drawj2d is is free software, subject to the GPL. The license allows the modification of the software, you just have to grant the users the same rights when redistributing the modified version (e.g. give them the source code). Thus you may ask any programmer to customize the software.
By the way, chances are that you can create customized drawings without modifying the drawj2d program. The hcl input files are "scriptable". Have a look at the manual, chapter "Programming commands". Again, you may ask any programmer (hcl is similar to the widely known TCL Tool Command Language).