February 10, 2022 at 7:48 pm #29764
Is it possible to use the Axidraw CLI Layer command and, at the end of plotting an Inkscape layer, return the x,y coordinates, and then simply stop (without going Home)?
Use case: I am plotting a half-dozen Inkscape layers, and have a pen-changing mechanism. Right now, at the end of each layer, Axidraw goes home; I then issue manual walk commands to change pens, then a manual walk command to return home. Then the next layer begins. So it travels home often, which wastes time.
It would be much faster if, at the end of a layer, the pen did not return home. Instead, give me the x,y coordinates, I’ll do my manual walks, and finally put Axidraw at home, ready for the next layer.
Thanx! =CliffFebruary 10, 2022 at 8:28 pm #29765
In a way, yes, by either “properly using” or “hacking” the pause and resume capabilities, depending on exactly what you need. We’ve helped a few other people build workflows around this.
You can force the AxiDraw to pause — just as though you had pressed the pause button — by adding a layer that has a name beginning with an exclamation point. It will stop where it is at, and then raise the pen. That’s part of the AxiDraw Layer Control syntax:
If you collect the output SVG that the CLI can return, that SVG contains a
plotdataelement that includes the position where it was paused as well as the “current” machine position.
If you use manual walks to return the AxiDraw to the position where it was paused, you can directly use the resume capability, without any modifications to the file, to resume from that point.
If you use manual walks to end up at Home, you can then plot in
res_homemode *with preview enabled* and collect the output SVG: That will update your SVG to show that the “current” machine position, as saved in the SVG file is now Home. From there, you can use
res_plotmode to continue plotting from that point. This would require only adding one empty layer (per pen change) to your SVG file,
(And the hack part: If you use manual walks to end up at a new position that isn’t Home, you could modify the file to indicate the new current position to resume from.)
Two alternate approaches that you might consider:
(1) If the pen change operation can be coded as graphical information, or perhaps graphical plus some layer control codes, then consider building those into the file. SVG is pretty easy to code by hand, if that helps.
(2) The AxiDraw Python API can both plot SVG (doing all of the things that I listed above) as well as do more complex moves in interactive context. Note that if you switch back and forth between Plot and Interactive contexts, it will assume that you’re starting at (0,0) for each. But, it makes it much easier to read out the actual position, so doing complex moves and then returning home might be easier.February 13, 2022 at 2:01 pm #29769
Many thanks Windell!
I’m playing with the exclamation point naming; works just as you say for the Plot command.
But an exclamation point named layer seems to be skipped over when used in the bash cli:
axicli filename.svg –mode layers –layer 1 layer –norotate etc
## after this command, the pen is at Home.
axicli filename.svg –mode layers –layer !2 layer –norotate etc
## nothing is plotted by this command.
What I’m trying to do is:
axicli filename.svg –mode layers –layer 1 layer –Don’t_Go_Home
## after this command, the pen is up and at end of the layer 1
axicli –Get_X_Y_Position X, Y
## return the pen location
## now I calculate the position to walk to and then walk to the pen change location, do the pen change, and walk back to X, Y
## then plot the next layer, without ever going home.
(notice that I’m trying to avoid learning svg coding — guess I may have to)
Best wishes, -CliffFebruary 13, 2022 at 3:03 pm #29770
My suggestion was to use the
plotmode, possibly in combination with the
res_plotmodes, not to use the
res_plotmodes should be sufficient to walk through an entire file, in order, with programmatic pauses and moves, without ever moving back to home during the sequence. (In a sense, using Layers mode is an “opposite” strategy to manage flow through the document.)
Additionally there does appear to be a bug that the programmatic pauses are not working with the
layersmode. (I can see what the issue is and I will log a bug for it; should be an easy fix in the next release.)
There is not a “Get_X_Y_Position” feature at present; for subtle reasons this is a little more tricky that it might seem. We’ll look into the best approach, it may be to read out the paused position from a file.
Here is a “quick and dirty” way for you to implement that yourself:
Open up the main axidraw.py script from your python installation in a text editor. (Mine via homebrew is at:
resume_plot_setup(), after the
self.f_curr_y = [...]line, (Line 496 as of AxiDraw 3.1.0) add this line with the same indent, then save.
self.user_message_fun(str(self.f_curr_x) + ', ' + str(self.f_curr_y))
(3) With that added, the
res_homemodes will both print out the initial position when they run. You can thus use:
axicli paused_file_name.svg -m res_home -vto print out the position where the plot was paused.February 13, 2022 at 3:28 pm #29773
I thought that –mode plot meant that the entire file would be drawn. All layers. It’s unclear to me how to interrupt a drawing other than to press a button. ie, what command do I use to say, “After writing FRAGILE, pause”
How is a plot interrupted? Ie, after writing the first few characters, I can push the pause button. But how do I do this programmatically?
Thanx!February 13, 2022 at 3:45 pm #29774
The exclamation point on a new layer acts almost exactly as though you had manually pressed the pause button: It stops the plot at that point.
So, what you would do is put “FRAGILE” on a layer, then add a new layer on top of that, with a name like “! Pause after fragile”.February 13, 2022 at 3:52 pm #29775
Let me give a more full example, in case that helps.
Here’s a test file: https://evilmadscientist.s3.amazonaws.com/scratch/reverse_and_joins5_pause.svg
Its layer names, bottom to top, are “2”, “!”, “1” and “layer 3”.
I can start to plot it with:
axicli reverse_and_joins5_pause.svg -o output.svg
That plots layer “2”, alone, and then stops, just as you had pressed the pause button.
We then resume the file with:
axicli output.svg -m res_plot -o output2.svg
That plots layers “1” and “layer 3”, resuming from where it was paused, without returning home.
You can also test these workflows in preview mode, with preview rendering turned on, to see which parts of the file are plotted each time that you do so.February 13, 2022 at 3:52 pm #29776
And, I’m guessing, plot with –mode plot
without specifying any layer?
(I assume this will plot in bottom-to-top order as seen in the Inkscape layer sidebar)February 13, 2022 at 3:56 pm #29777
Yes. And, since plot is the default mode, you don’t need to specify it.
Yes, layer order is “bottom to top” in Inkscape’s display. That matches order of creation (putting “one thing on top of another”) and is equivalent to performing actions in the order in which they appear in the SVG file.February 28, 2022 at 2:34 pm #29795
We’ve just released software version 3.2, which fixes the bug with programmatic pauses in layers mode. It also changes the initialization sequence when enabling the motors such that the QS EBB command can be used to read out the position.
Here are two short python scripts, usually runnable on a Mac CLI as:
python3 report_pos_mm.pythat will print the XY position after being paused:February 28, 2022 at 5:37 pm #29798
*** MANY THANKS WINDELL ***
Just got v 3.2.0 of Axidraw s/w and th latest Inkscape. Time to play!
-CliffApril 17, 2022 at 11:35 am #29879
Just working on this and find that script
does, indeed, return the x,y position of the pen.
However, when the script is run a second time (without any intervening motion), it returns 0,0
Shouldn’t it return the same position?
-CliffApril 17, 2022 at 11:50 am #29880
It should indeed return the same position. And, in my test here, it does.
Is there any chance that you only updated the Inkscape-based software to 3.2, but not the API? (They’re actually independent.)
You can test with
axicli --versionApril 17, 2022 at 4:57 pm #29882
As usual, I’m confused.
using instructions at wiki.evilmadscientist.com/Axidraw_Software_Installation
I downloaded and installed AxiDraw_Install_321.app
from Inkscape/Axidraw Control/Options/Config/apply
I see this:
This is AxiDraw Control version 3.2.1.
Your AxiDraw Control software is up to date.
Your AxiDraw has firmware version 2.8.0.
Your firmware is up to date; no updates are available.
Additional system information:
3.8.5 (default, Sep 8 2020, 23:22:40)
[Clang 11.0.0 (clang-1188.8.131.52)]
But from my bash cli script,
AxiDraw Command Line Interface 3.1.0
AxiDraw Software 3.1.0
What should I be doing?April 17, 2022 at 7:29 pm #29883
Inkscape uses its own bundled Python, and the AxiDraw software for Inkscape is essentially only available within Inkscape.
For the Python/CLI API, use the upgrade instructions from its installation instructions ( https://axidraw.com/doc/cli_api/#installation ):
python -m pip install https://cdn.evilmadscientist.com/dl/ad/public/AxiDraw_API.zip --upgrade --upgrade-strategy eager
(For my system, I actually use
python3 -m pip [...])
- You must be logged in to reply to this topic.