Skip to content

Commit

Permalink
Merge pull request #133 from evil-mad/v3.6.0
Browse files Browse the repository at this point in the history
V3.6.0
  • Loading branch information
oskay committed Oct 6, 2022
2 parents 6f52ff3 + 6a03ba7 commit c3af0e3
Show file tree
Hide file tree
Showing 25 changed files with 778 additions and 628 deletions.
7 changes: 5 additions & 2 deletions cli/axicli/axidraw_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
from plotink.plot_utils_import import from_dependency_import # plotink
exit_status = from_dependency_import("ink_extensions_utils.exit_status")

cli_version = "AxiDraw Command Line Interface 3.5.0"
cli_version = "AxiDraw Command Line Interface 3.6.0"

quick_help = '''
Basic syntax to plot a file: axicli svg_in [OPTIONS]
Expand Down Expand Up @@ -162,7 +162,7 @@ def axidraw_CLI(dev = False):

parser.add_argument("-w","--walk_dist", \
metavar='DISTANCE', type=float, \
help="Distance for manual walk (inches)")
help="Distance for manual walk")

parser.add_argument("-l","--layer", \
type=int, \
Expand Down Expand Up @@ -345,4 +345,7 @@ def axidraw_CLI(dev = False):
if utils.has_output(adc) and not use_trivial_file:
utils.output_result(args.output_file, adc.outdoc)

if adc.status_code >= 100: # Give non-zero exit code.
sys.exit(1) # No need to be more verbose; we have already printed error messages.

return adc if dev else None # returning adc is useful for tests
63 changes: 36 additions & 27 deletions cli/examples_python/estimate_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@
Run this demo by calling: python estimate_time.py
---------------------------------------------------------------------
About the interactive API:
Interactive mode is a mode of use, designed for plotting individual motion
segments upon request, using direct XY control. It is a complement to the
usual plotting modes, which take an SVG document as input.
So long as the AxiDraw is started in the home corner, moves are limit checked,
and constrained to be within the safe travel range of the AxiDraw.
AxiDraw python API documentation is hosted at: https://axidraw.com/doc/py_api/
'''
---------------------------------------------------------------------
'''
About this software:
The AxiDraw writing and drawing machine is a product of Evil Mad Scientist
Expand All @@ -28,13 +40,14 @@
Additional AxiDraw documentation is available at http://axidraw.com/docs
AxiDraw owners may request technical support for this software through our
AxiDraw owners may request technical support for this software through our
github issues page, support forums, or by contacting us directly at:
https://shop.evilmadscientist.com/contact
---------------------------------------------------------------------
Copyright 2021 Windell H. Oskay, Evil Mad Scientist Laboratories
Copyright 2022 Windell H. Oskay, Evil Mad Scientist Laboratories
The MIT License (MIT)
Expand All @@ -58,7 +71,7 @@
'''


import sys
import os.path
from pyaxidraw import axidraw

Expand All @@ -70,37 +83,33 @@
in the same directory with the test file.
'''

location1 = "test/assets/AxiDraw_trivial.svg"
location2 = "../test/assets/AxiDraw_trivial.svg"
location3 = "AxiDraw_trivial.svg"
LOCATION1 = "test/assets/AxiDraw_trivial.svg"
LOCATION2 = "../test/assets/AxiDraw_trivial.svg"
LOCATION3 = "AxiDraw_trivial.svg"

file = None
FILE = None

if os.path.exists(location1):
file = location1
if os.path.exists(location2):
file = location2
if os.path.exists(location3):
file = location3
if os.path.exists(LOCATION1):
FILE = LOCATION1
if os.path.exists(LOCATION2):
FILE = LOCATION2
if os.path.exists(LOCATION3):
FILE = LOCATION3

if file:
print("Example file located at: " + file)
ad.plot_setup(file) # Parse the input file
if FILE:
print("Example file located at: " + FILE)
ad.plot_setup(FILE) # Parse the input file
else:
print("Unable to locate example file; exiting.")
exit()

'''
The above code, starting with "location1" can all be replaced by a single line
if you already know where the file is. This can be as simple as:
sys.exit() # end script

ad.plot_setup("AxiDraw_trivial.svg")
'''
# The above code, starting with "LOCATION1" can all be replaced by a single line
# if you already know where the file is. This can be as simple as:
# ad.plot_setup("AxiDraw_trivial.svg")

ad.options.preview = True
ad.options.report_time = True # Enable time estimates

ad.plot_run() # plot the document
print_time_seconds = ad.time_estimate
print("Estimated print time: {0} s".format(print_time_seconds))

print(f"Estimated print time: {print_time_seconds} s")
9 changes: 4 additions & 5 deletions cli/examples_python/interactive_draw_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
Run this demo by calling: python interactive_draw_path.py
---------------------------------------------------------------------
About the interactive API:
Interactive mode is a mode of use, designed for plotting individual motion
segments upon request, using direct XY control. It is a complement to the
Expand Down Expand Up @@ -43,8 +46,7 @@
---------------------------------------------------------------------
Copyright 2020 Windell H. Oskay, Evil Mad Scientist Laboratories
Copyright 2022 Windell H. Oskay, Evil Mad Scientist Laboratories
The MIT License (MIT)
Expand Down Expand Up @@ -75,8 +77,6 @@

ad = axidraw.AxiDraw() # Initialize class



def print_position():
'''
Query, report, and print position and pen state
Expand Down Expand Up @@ -122,7 +122,6 @@ def print_position():
print_position()



ad.options.units = 0 # Switch to inch units
ad.update() # Process changes to options

Expand Down
40 changes: 27 additions & 13 deletions cli/examples_python/interactive_penheights.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,28 @@
interactive_penheights.py
Demonstrate use of axidraw module in "interactive" mode.
Set pen to different heights.
Run this demo by calling: python interactive_penheights.py
'''
'''
---------------------------------------------------------------------
About the interactive API:
Interactive mode is a mode of use, designed for plotting individual motion
segments upon request, using direct XY control. It is a complement to the
usual plotting modes, which take an SVG document as input.
So long as the AxiDraw is started in the home corner, moves are limit checked,
and constrained to be within the safe travel range of the AxiDraw.
AxiDraw python API documentation is hosted at: https://axidraw.com/doc/py_api/
---------------------------------------------------------------------
About this software:
The AxiDraw writing and drawing machine is a product of Evil Mad Scientist
Expand All @@ -28,13 +41,14 @@
Additional AxiDraw documentation is available at http://axidraw.com/docs
AxiDraw owners may request technical support for this software through our
AxiDraw owners may request technical support for this software through our
github issues page, support forums, or by contacting us directly at:
https://shop.evilmadscientist.com/contact
---------------------------------------------------------------------
Copyright 2021 Windell H. Oskay, Evil Mad Scientist Laboratories
Copyright 2022 Windell H. Oskay, Evil Mad Scientist Laboratories
The MIT License (MIT)
Expand Down Expand Up @@ -66,31 +80,31 @@
ad = axidraw.AxiDraw() # Initialize class

ad.interactive() # Enter interactive mode
connected = ad.connect() # Open serial port to AxiDraw
connected = ad.connect() # Open serial port to AxiDraw

if not connected:
sys.exit() # end script

ad.penup()

# Change some options, just to show how we do so:

ad.options.pen_pos_down = 40
ad.options.pen_pos_up = 60
ad.update() # Process changes to options
ad.update() # Process changes to options

ad.pendown()
time.sleep(1.0)
time.sleep(1.0)
ad.penup()
time.sleep(1.0)
time.sleep(1.0)

ad.options.pen_pos_down = 0
ad.options.pen_pos_up = 100

ad.update() # Process changes to options
ad.update() # Process changes to options

ad.pendown()
time.sleep(1.0)
time.sleep(1.0)
ad.penup()

ad.disconnect() # Close serial port to AxiDraw
ad.disconnect() # Close serial port to AxiDraw

0 comments on commit c3af0e3

Please sign in to comment.