Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Have AnchorProcessor pull its start position from the profile.

* Adds start x, y, & z to all profiles
* ProcessorFactory adds profile to each Processor
* Minor change to AnchorProcessor.get_start_position
  • Loading branch information...
commit 550f545820c286a14fc3929d1e305a3255347964 1 parent 465eb90
@tedbrandston tedbrandston authored
View
8 makerbot_driver/GcodeProcessors/AnchorProcessor.py
@@ -103,4 +103,10 @@ def calc_euclidean_distance(self, p1, p2):
return distance
def get_start_position(self):
- return "G1 X-112 Y-73 Z150 F3300.0 (move to waiting position)"
+ start_position = (-112, -73, 150)
+ if hasattr(self, 'profile') and None != self.profile:
+ sp = self.profile.values['print_start_sequence']['start_position']
+ start_position = (sp['start_x'], sp['start_y'], sp['start_z'])
+ start_codes = "G1 X%.3f Y%.3f Z%.3f F3300.0 (move to waiting position)"
+ start_codes = start_codes % start_position
+ return start_codes
View
10 makerbot_driver/GcodeProcessors/ProcessorFactory.py
@@ -14,9 +14,11 @@ def list_processors(self):
pros.remove('errors')
return pros
- def create_processor_from_name(self, name):
+ def create_processor_from_name(self, name, profile = None):
try:
- return getattr(makerbot_driver.GcodeProcessors, name)()
+ processor = getattr(makerbot_driver.GcodeProcessors, name)()
+ processor.profile = profile
+ return processor
except AttributeError:
raise makerbot_driver.GcodeProcessors.ProcessorNotFoundError
@@ -28,8 +30,8 @@ def process_list_with_commas(self, string):
strings.remove(s)
return strings
- def get_processors(self, processors):
+ def get_processors(self, processors, profile = None):
if isinstance(processors, str):
processors = self.process_list_with_commas(processors)
for processor in processors:
- yield self.create_processor_from_name(processor)
+ yield self.create_processor_from_name(processor, profile)
View
9 makerbot_driver/profiles/Replicator2.json
@@ -52,11 +52,14 @@
]
},
"start_position" : {
- "replicator_start_position": [
+ "replicator_start_position" : [
"G92 X152 Y75 Z0 A0 B0",
- "G1 X-112 Y-73 Z150 F3300.0 (move to waiting position)",
+ "G1 X#START_X Y#START_Y Z#START_Z F3300.0 (move to waiting position)",
@skalnik
skalnik added a note

My Replicator 2 is having issues with this line. Do I need to update the firmware for it to handle variables like this?

@tedbrandston Collaborator

No, this should be handled by the GCode parser.
Are you running this through MakerWare, or Conveyor? Have you tried contacting MakerBot support?

@skalnik
skalnik added a note

It's running straight through s3g to the Repliactor 2 via command line. It's part of https://github.com/make-me/make-me. https://github.com/make-me/make-me/blob/master/bin/print_gcode.py this script to be exact

@tedbrandston Collaborator

Very cool project, though it looks like you might be rewriting some things that already exist in https://github.com/makerbot/conveyor
Anyway, I'm not 100% sure, but I think you have to pass an environment (a dict) with those variables to the GCode parser, and it'll do the variable replacement.

Ted is correct about the environment dict. Please see these sections of conveyor to see how we configure the parser to handle g-code variables:

https://github.com/makerbot/conveyor/blob/master/src/main/python/conveyor/machine/s3g.py#L249
Here we create a g-code 'scaffold' object. This object contains the start g-code, the end g-code, and the environment dict. We use s3g's GcodeAssembler to fetch these from the machine's profile.

https://github.com/makerbot/conveyor/blob/master/src/main/python/conveyor/machine/s3g.py#L699
Here we create the g-code parser and s3g object and then set the parser's environment dict.

@skalnik
skalnik added a note

@tedbrandston A little bit of overlap with conveyor, but we didn't want to pull in the whole complexity of conveyor for just sending gcode to the printer, when something much simpler would fit our needs.

Thanks for the help guys! :grin:

@skalnik
skalnik added a note

I went ahead and got make-me working with this, but once I started looking more closely and implemented it, it seems like this should live in s3g. S3g is already replacing some variables like the temperature of the extruder, why not also have it replace this based on the profile you pass to the assembler? Should I file an issue on s3g for this conversation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
"G130 X20 Y20 A20 B20 (Lower stepper Vrefs while heating)"
- ]
+ ],
+ "start_x" : -112,
+ "start_y" : -73,
+ "start_z" : 150
},
"heat_platform" : {
"no_heat" : []
View
7 makerbot_driver/profiles/Replicator2X.json
@@ -68,9 +68,12 @@
"start_position" : {
"replicator_start_position": [
"G92 X163 Y75 Z0 A0 B0",
- "G1 X-112 Y-73 Z150 F3300.0 (move to waiting position)",
+ "G1 X#START_X Y#START_Y #START_Z F3300.0 (move to waiting position)",
"G130 X20 Y20 A20 B20 (Lower stepper Vrefs while heating)"
- ]
+ ],
+ "start_x" : -112,
+ "start_y" : -73,
+ "start_z" : 150
},
"heat_platform" : {
"no_heat" : [],
View
7 makerbot_driver/profiles/ReplicatorDual.json
@@ -67,9 +67,12 @@
"start_position" : {
"replicator_start_position": [
"G92 X152 Y75 Z0 A0 B0",
- "G1 X-112 Y-73 Z150 F3300.0 (move to waiting position)",
+ "G1 X#START_X Y#START_Y Z#START_Z F3300.0 (move to waiting position)",
"G130 X20 Y20 A20 B20 (Lower stepper Vrefs while heating)"
- ]
+ ],
+ "start_x" : -112,
+ "start_y" : -73,
+ "start_z" : 150
},
"heat_platform" : {
"no_heat" : [],
View
7 makerbot_driver/profiles/ReplicatorSingle.json
@@ -58,9 +58,12 @@
"start_position" : {
"replicator_start_position": [
"G92 X152 Y75 Z0 A0 B0",
- "G1 X-112 Y-73 Z150 F3300.0 (move to waiting position)",
+ "G1 X#START_X Y#START_Y Z#START_Z F3300.0 (move to waiting position)",
"G130 X20 Y20 A20 B20 (Lower stepper Vrefs while heating)"
- ]
+ ],
+ "start_x" : -112,
+ "start_y" : -73,
+ "start_z" : 150
},
"heat_platform" : {
"no_heat" : [],
View
7 makerbot_driver/profiles/TOMStepstruderDual.json
@@ -64,8 +64,11 @@
},
"start_position": {
"tom_start_position": [
- "G1 X25 Y-60 Z10 F3300.0 (move to waiting position)"
- ]
+ "G1 X#START_X Y#START_Y Z#START_Z F3300.0 (move to waiting position)"
+ ],
+ "start_x" : 25,
+ "start_y" : -60,
+ "start_z" : 10
},
"heat_platform": {
"no_heat": [],
View
7 makerbot_driver/profiles/TOMStepstruderSingle.json
@@ -55,8 +55,11 @@
},
"start_position": {
"tom_start_position": [
- "G1 X25 Y-60 Z10 F3300.0 (move to waiting position)"
- ]
+ "G1 X#START_X Y#START_Y Z#START_Z F3300.0 (move to waiting position)"
+ ],
+ "start_x" : 25,
+ "start_y" : -60,
+ "start_z" : 10
},
"heat_platform": {
"no_heat": [],
View
2  tests/pi_test_AnchorProcessor.py
@@ -31,7 +31,7 @@ def test_calc_euclidean_distance(self):
self.ap.calc_euclidean_distance(case[0], case[1]), case[2])
def test_get_start_position(self):
- expected_start_position = 'G1 X-112 Y-73 Z150 F3300.0 (move to waiting position)'
+ expected_start_position = 'G1 X-112.000 Y-73.000 Z150.000 F3300.0 (move to waiting position)'
got_start_position = self.ap.get_start_position()
self.assertEqual(expected_start_position, got_start_position)
@skalnik

My Replicator 2 is having issues with this line. Do I need to update the firmware for it to handle variables like this?

@tedbrandston

No, this should be handled by the GCode parser.
Are you running this through MakerWare, or Conveyor? Have you tried contacting MakerBot support?

@skalnik

It's running straight through s3g to the Repliactor 2 via command line. It's part of https://github.com/make-me/make-me. https://github.com/make-me/make-me/blob/master/bin/print_gcode.py this script to be exact

@tedbrandston

Very cool project, though it looks like you might be rewriting some things that already exist in https://github.com/makerbot/conveyor
Anyway, I'm not 100% sure, but I think you have to pass an environment (a dict) with those variables to the GCode parser, and it'll do the variable replacement.

@msamsonoff

Ted is correct about the environment dict. Please see these sections of conveyor to see how we configure the parser to handle g-code variables:

https://github.com/makerbot/conveyor/blob/master/src/main/python/conveyor/machine/s3g.py#L249
Here we create a g-code 'scaffold' object. This object contains the start g-code, the end g-code, and the environment dict. We use s3g's GcodeAssembler to fetch these from the machine's profile.

https://github.com/makerbot/conveyor/blob/master/src/main/python/conveyor/machine/s3g.py#L699
Here we create the g-code parser and s3g object and then set the parser's environment dict.

@skalnik

@tedbrandston A little bit of overlap with conveyor, but we didn't want to pull in the whole complexity of conveyor for just sending gcode to the printer, when something much simpler would fit our needs.

Thanks for the help guys! :grin:

@skalnik

I went ahead and got make-me working with this, but once I started looking more closely and implemented it, it seems like this should live in s3g. S3g is already replacing some variables like the temperature of the extruder, why not also have it replace this based on the profile you pass to the assembler? Should I file an issue on s3g for this conversation?

Please sign in to comment.
Something went wrong with that request. Please try again.