Kevin Lee 11 months ago
parent
commit
ec248aaaad
3 changed files with 55 additions and 49 deletions
  1. 52 23
      README.md
  2. 1 24
      samples/config.yml
  3. 2 2
      src/config/mod.rs

+ 52 - 23
README.md

@@ -30,12 +30,13 @@ Setting values of specific fields for a given pen:
 Ops: 
   - !PatchPen
     Pen: 0                  # Target pen
-    Color: [127, 127, 127]  # Optional - target pen RGB color
-    Enabled: true           # Optional - target pen enable flag
-    LoopCount: 3            # Optional - target pen loop count
-    Speed: 1.234            # Optional - target pen speed
-    Power: 10.5             # Optional - target pen power 
-    Frequency: 10000        # Optional - target pen frequency
+    # Specify one or more of the following:
+    # Color: [127, 127, 127]
+    # Enabled: true
+    # LoopCount: 3
+    # Speed: 1.234
+    # Power: 10.5
+    # Frequency: 10000
 ```
 
 Cloning pen(s) (and optionally override settings):
@@ -43,15 +44,16 @@ Cloning pen(s) (and optionally override settings):
 ``` yaml
 Ops: 
   - !ClonePen
-    From: 0                 # Source pen
-    To: 1                   # Target pen
-    # Inclusive: true       # Optional - will clone to all pens in range
-    # Color: [64, 64, 64]   # Optional - target pen RGB color
-    # Enabled: true         # Optional - target pen enable flag
-    # LoopCount: 3          # Optional - target pen loop count
-    # Speed: 1.234          # Optional - target pen speed
-    # Power: 10.5           # Optional - target pen power 
-    # Frequency: 10000      # Optional - target pen frequency
+    From: 0
+    To: 1
+    # Specify one or more of the following:
+    # Inclusive: true
+    # Color: [64, 64, 64]
+    # Enabled: true
+    # LoopCount: 3
+    # Speed: 1.234
+    # Power: 10.5
+    # Frequency: 10000
 ```
 
 Incrementing a specific field by some value across a sequence of pens:
@@ -59,12 +61,13 @@ Incrementing a specific field by some value across a sequence of pens:
 ``` yaml
 Ops: 
   - !PatternPen
-    From: 1                   # Starting pen to copy settings from
-    To: 5                     # Ending pen to stop at (inclusive)
-    # Field: !Loops 1         # Choose one
-    # Field: !Speed 100.0     # Choose one
-    # Field: !Power 10.0      # Choose one
-    # Field: !Frequency 1000  # Choose one
+    From: 1
+    To: 5
+    # Specify one of the following:
+    # Field: !Loops 1
+    # Field: !Speed 100.0
+    # Field: !Power 10.0
+    # Field: !Frequency 1000
 ```
 
 ### Importing and Exporting Pens and Objects
@@ -118,11 +121,11 @@ Ops:
     Object: 3 # Optional, will delete specific object instead
 ```
 
-Generating a grid of rectangles with incrementing pens:
+Generating a grid of hatched rectangles with incrementing pens:
 
 ``` yaml
 Ops:
-  - !RectangleArray
+  - !HatchArray
     Layer: 0
     Width: 10.0
     Height: 10.0
@@ -131,4 +134,30 @@ Ops:
     Spacing: 0.5
     Z: 0.0
     StartingPen: 0
+    Hatch:
+      LineSpacing: 0.01
+      # The following are optional parameters:
+      # Count: 2
+      # EdgeOffset: 0.0
+      # StartOffset: 0.0
+      # EndOffset: 0.0
+      # Angle: 0.0
+      # RotateAngle: 0.0
+      # LineRedution: 0.0
+      # LoopDistance: 0.0
+      # LoopCount: 0
+      # Pattern: !Bidirectional
+      # FollowEdgeOnce: true
+      # CrossHatch: true
 ```
+
+Available patterns are:
+
+1. Directional
+2. Bidirectional
+3. Ring
+4. Continuous
+5. Gong
+6. Background (not supported)
+7. Fill
+8. Zigzag

+ 1 - 24
samples/config.yml

@@ -7,39 +7,16 @@ Ops:
   - !PatchPen
     Pen: 0
     Power: 10.0
-  #   Color: [127, 127, 127]
-  #   Enabled: true
-  #   LoopCount: 3
-  #   Speed: 20.0
-  #   Frequency: 10000
 
   - !PatternPen
     From: 0
     To: 40
     Field: !Power 2
 
-  # - !ExportPen
-  #   Index: 0
-  #   Path: export_pen.bin
-
-  # - !ImportPen
-  #   Index: 1
-  #   Path: export_pen.bin
-
-  # - !ExportObject
-  #   Layer: 0
-  #   Object: 0
-  #   Path: export_object.bin
-
-  # - !ImportObject
-  #   Layer: 0
-  #   Object: 0
-  #   Path: export_object.bin
-
   - !DeleteObjects
     Layer: 0
 
-  - !RectangleArray
+  - !HatchArray
     Layer: 0
     Width: 3.0
     Height: 2.0

+ 2 - 2
src/config/mod.rs

@@ -19,7 +19,7 @@ pub enum Operation {
     ExportObject(ExportObject),
     ImportObject(ImportObject),
     DeleteObjects(DeleteObjects),
-    RectangleArray(HatchArray),
+    HatchArray(HatchArray),
 }
 
 pub trait Operations {
@@ -38,7 +38,7 @@ impl Operations for Vec<Operation> {
                 Operation::ExportObject(x) => x.export(layers),
                 Operation::ImportObject(x) => x.import(layers),
                 Operation::DeleteObjects(x) => x.delete(layers),
-                Operation::RectangleArray(x) => x.generate(pens, layers),
+                Operation::HatchArray(x) => x.generate(pens, layers),
             }
         }
     }