对齐 LinuxCNC 解析器覆盖

This commit is contained in:
wangdequan
2026-05-23 17:28:41 +08:00
parent 7fe7ea6038
commit ed4e674d1e
40 changed files with 8881 additions and 313 deletions

View File

@@ -6,12 +6,22 @@ void CanonEventSink::reset() {
position_ = {};
plane_ = 17;
unit_scale_ = 1.0;
traverse_rate_ = 0.0;
feed_ = 0.0;
spindle_ = 0.0;
spindle_direction_ = 0;
selected_tool_ = 0;
probe_position_ = {};
probe_tripped_ = false;
tool_length_offset_ = {};
callback_status_ = 0;
kinematics_type_ = 1;
feed_override_ = false;
speed_override_ = false;
adaptive_feed_ = false;
feed_hold_ = false;
mist_on_ = false;
flood_on_ = false;
}
void CanonEventSink::set_callback(CncSimEventCallback callback, void *user_data) {
@@ -48,6 +58,10 @@ void CanonEventSink::set_tool_length(int h_code, double tool_length) {
}
}
void CanonEventSink::set_tool_length_offset(const CncSimPose &offset) {
tool_length_offset_ = offset;
}
void CanonEventSink::set_rtcp_state(bool enabled, int h_code, int line) {
rtcp_enabled_ = enabled;
rtcp_h_code_ = enabled ? h_code : 0;
@@ -104,6 +118,10 @@ void CanonEventSink::select_plane(int plane, int line) {
emit(event);
}
void CanonEventSink::set_traverse_rate(double rate) {
traverse_rate_ = rate;
}
void CanonEventSink::set_feed_rate(double feed, int line) {
feed_ = feed;
CncSimEvent event = base_event(CNC_SIM_EVENT_SET_FEED, line);
@@ -111,9 +129,10 @@ void CanonEventSink::set_feed_rate(double feed, int line) {
emit(event);
}
void CanonEventSink::set_feed_mode(int mode, int line) {
void CanonEventSink::set_feed_mode(int spindle, int mode, int line) {
CncSimEvent event = base_event(CNC_SIM_EVENT_SET_FEED, line);
event.feed = feed_;
event.tool = spindle;
event.reserved = mode;
emit(event);
}
@@ -126,6 +145,89 @@ void CanonEventSink::set_spindle_speed(double spindle, int line) {
emit(event);
}
void CanonEventSink::set_spindle_mode(int spindle, double mode, int line) {
CncSimEvent event = base_event(CNC_SIM_EVENT_COMMENT, line);
event.tool = spindle;
event.feed = mode;
event.reserved = mode == 0.0 ? 970 : 960;
emit(event);
}
void CanonEventSink::set_speed_feed_sync(int spindle, double feed_per_revolution, bool velocity_mode, bool enabled, int line) {
CncSimEvent event = base_event(CNC_SIM_EVENT_COMMENT, line);
event.tool = spindle;
event.feed = feed_per_revolution;
event.reserved = enabled ? (velocity_mode ? 3302 : 3301) : 3300;
emit(event);
}
void CanonEventSink::orient_spindle(int spindle, double orientation, int mode, int line) {
CncSimEvent event = base_event(CNC_SIM_EVENT_COMMENT, line);
event.tool = spindle;
event.feed = orientation;
event.arc_turns = mode;
event.reserved = 1901;
emit(event);
}
void CanonEventSink::wait_spindle_orient_complete(int spindle, double timeout, int line) {
CncSimEvent event = base_event(CNC_SIM_EVENT_COMMENT, line);
event.tool = spindle;
event.dwell_seconds = timeout;
event.reserved = 1902;
emit(event);
}
void CanonEventSink::set_digital_output(int index, bool enabled, bool motion_synchronized, int line) {
CncSimEvent event = base_event(CNC_SIM_EVENT_COMMENT, line);
event.tool = index;
event.feed = enabled ? 1.0 : 0.0;
event.reserved = motion_synchronized ? (enabled ? 62 : 63) : (enabled ? 64 : 65);
emit(event);
}
void CanonEventSink::set_analog_output(int index, double value, bool motion_synchronized, int line) {
CncSimEvent event = base_event(CNC_SIM_EVENT_COMMENT, line);
event.tool = index;
event.feed = value;
event.reserved = motion_synchronized ? 67 : 68;
emit(event);
}
void CanonEventSink::wait_input(int index, int input_type, int wait_type, double timeout, int line) {
CncSimEvent event = base_event(CNC_SIM_EVENT_COMMENT, line);
event.tool = index;
event.feed = wait_type;
event.dwell_seconds = timeout;
event.arc_turns = input_type;
event.reserved = 66;
emit(event);
}
void CanonEventSink::set_override_control(int control, bool enabled, int spindle, int line) {
switch (control) {
case 50:
feed_override_ = enabled;
break;
case 51:
speed_override_ = enabled;
break;
case 52:
adaptive_feed_ = enabled;
break;
case 53:
feed_hold_ = enabled;
break;
default:
break;
}
CncSimEvent event = base_event(CNC_SIM_EVENT_COMMENT, line);
event.tool = spindle;
event.feed = enabled ? 1.0 : 0.0;
event.reserved = control;
emit(event);
}
void CanonEventSink::start_spindle(int direction, int line) {
spindle_direction_ = direction < 0 ? 2 : 1;
CncSimEvent event = base_event(CNC_SIM_EVENT_SET_SPINDLE, line);
@@ -181,11 +283,14 @@ void CanonEventSink::arc_feed(int line, const CncSimPose &end, const CncSimPose
position_ = end;
}
void CanonEventSink::straight_probe(int line, const CncSimPose &end) {
void CanonEventSink::straight_probe(int line, const CncSimPose &end, int probe_type) {
CncSimEvent event = base_event(CNC_SIM_EVENT_PROBE, line);
event.start = position_;
event.end = end;
event.reserved = probe_type;
emit(event);
probe_position_ = end;
probe_tripped_ = (probe_type & 2) == 0;
position_ = end;
}
@@ -224,6 +329,10 @@ double CanonEventSink::unit_scale() const {
return unit_scale_;
}
double CanonEventSink::traverse_rate() const {
return traverse_rate_;
}
double CanonEventSink::feed_rate() const {
return feed_;
}
@@ -236,6 +345,18 @@ int CanonEventSink::spindle_direction() const {
return spindle_direction_;
}
const CncSimPose &CanonEventSink::tool_length_offset() const {
return tool_length_offset_;
}
const CncSimPose &CanonEventSink::probe_position() const {
return probe_position_;
}
bool CanonEventSink::probe_tripped() const {
return probe_tripped_;
}
int CanonEventSink::selected_tool() const {
return selected_tool_;
}
@@ -252,6 +373,38 @@ double CanonEventSink::rtcp_tool_length() const {
return rtcp_tool_length_;
}
bool CanonEventSink::feed_override() const {
return feed_override_;
}
bool CanonEventSink::speed_override() const {
return speed_override_;
}
bool CanonEventSink::adaptive_feed() const {
return adaptive_feed_;
}
bool CanonEventSink::feed_hold() const {
return feed_hold_;
}
bool CanonEventSink::mist_on() const {
return mist_on_;
}
bool CanonEventSink::flood_on() const {
return flood_on_;
}
void CanonEventSink::set_mist_on(bool enabled) {
mist_on_ = enabled;
}
void CanonEventSink::set_flood_on(bool enabled) {
flood_on_ = enabled;
}
void CanonEventSink::emit(CncSimEvent event) {
if (callback_ && callback_status_ == 0) {
callback_status_ = callback_(&event, user_data_);

View File

@@ -12,6 +12,7 @@ public:
bool callback_aborted() const;
void configure_rtcp(bool enabled, double tool_length);
void set_tool_length(int h_code, double tool_length);
void set_tool_length_offset(const CncSimPose &offset);
void set_rtcp_state(bool enabled, int h_code, int line);
void switch_kinematics(int kinematics_type, bool rtcp_enabled, int line);
void set_g5x_offset(int index, const CncSimPose &offset, int line);
@@ -20,9 +21,18 @@ public:
void use_length_units(double scale, int line);
void select_plane(int plane, int line);
void set_traverse_rate(double rate);
void set_feed_rate(double feed, int line);
void set_feed_mode(int mode, int line);
void set_feed_mode(int spindle, int mode, int line);
void set_spindle_speed(double spindle, int line);
void set_spindle_mode(int spindle, double mode, int line);
void set_speed_feed_sync(int spindle, double feed_per_revolution, bool velocity_mode, bool enabled, int line);
void orient_spindle(int spindle, double orientation, int mode, int line);
void wait_spindle_orient_complete(int spindle, double timeout, int line);
void set_digital_output(int index, bool enabled, bool motion_synchronized, int line);
void set_analog_output(int index, double value, bool motion_synchronized, int line);
void wait_input(int index, int input_type, int wait_type, double timeout, int line);
void set_override_control(int control, bool enabled, int spindle, int line);
void start_spindle(int direction, int line);
void stop_spindle(int line);
void select_tool(int tool);
@@ -30,7 +40,7 @@ public:
void straight_traverse(int line, const CncSimPose &end);
void straight_feed(int line, const CncSimPose &end);
void arc_feed(int line, const CncSimPose &end, const CncSimPose &center, int turns);
void straight_probe(int line, const CncSimPose &end);
void straight_probe(int line, const CncSimPose &end, int probe_type = 0);
void dwell(double seconds, int line);
void program_end(int line);
void program_stop(int line, int kind);
@@ -39,13 +49,25 @@ public:
const CncSimPose &position() const;
int plane() const;
double unit_scale() const;
double traverse_rate() const;
double feed_rate() const;
double spindle_speed() const;
int spindle_direction() const;
const CncSimPose &tool_length_offset() const;
const CncSimPose &probe_position() const;
bool probe_tripped() const;
int selected_tool() const;
int kinematics_type() const;
bool rtcp_enabled() const;
double rtcp_tool_length() const;
bool feed_override() const;
bool speed_override() const;
bool adaptive_feed() const;
bool feed_hold() const;
bool mist_on() const;
bool flood_on() const;
void set_mist_on(bool enabled);
void set_flood_on(bool enabled);
private:
void emit(CncSimEvent event);
@@ -58,14 +80,24 @@ private:
CncSimPose position_{};
int plane_ = 17;
double unit_scale_ = 1.0;
double traverse_rate_ = 0.0;
double feed_ = 0.0;
double spindle_ = 0.0;
int spindle_direction_ = 0;
int selected_tool_ = 0;
CncSimPose probe_position_{};
bool probe_tripped_ = false;
bool rtcp_enabled_ = false;
double default_rtcp_tool_length_ = 0.0;
double rtcp_tool_length_ = 0.0;
int rtcp_h_code_ = 0;
CncSimPose tool_length_offset_{};
int kinematics_type_ = 1;
bool feed_override_ = false;
bool speed_override_ = false;
bool adaptive_feed_ = false;
bool feed_hold_ = false;
bool mist_on_ = false;
bool flood_on_ = false;
std::unordered_map<int, double> tool_lengths_;
};

View File

@@ -19,6 +19,11 @@ CanonEventSink *active_sink = nullptr;
int active_line = 0;
bool flood_on = false;
bool mist_on = false;
bool block_delete = false;
bool optional_program_stop = false;
CANON_MOTION_MODE motion_control_mode = CANON_EXACT_STOP;
double motion_control_tolerance = 0.0;
double naivecam_tolerance = 0.0;
std::string parameter_file_name = "rs274ngc.var";
CncSimPose make_pose(double x, double y, double z,
@@ -102,14 +107,23 @@ void emit_state_event(CncSimEventType type, int reserved) {
active_sink->emit_raw(event);
}
void reset_bridge_state() {
flood_on = false;
mist_on = false;
block_delete = false;
optional_program_stop = false;
motion_control_mode = CANON_EXACT_STOP;
motion_control_tolerance = 0.0;
naivecam_tolerance = 0.0;
}
} // namespace
void cnc_sim_linuxcnc_set_canon_sink(CanonEventSink *sink) {
trace_call("cnc_sim_linuxcnc_set_canon_sink");
active_sink = sink;
active_line = 0;
flood_on = false;
mist_on = false;
reset_bridge_state();
}
CanonEventSink *cnc_sim_linuxcnc_get_canon_sink() {
@@ -125,8 +139,7 @@ void INIT_CANON() {
if (active_sink) {
active_sink->reset();
}
flood_on = false;
mist_on = false;
reset_bridge_state();
}
void USE_LENGTH_UNITS(CANON_UNITS units) {
@@ -291,19 +304,24 @@ void CANON_UPDATE_END_POINT(double x, double y, double z,
}
}
void SET_TRAVERSE_RATE(double) {
void SET_TRAVERSE_RATE(double rate) {
if (active_sink) {
active_sink->set_traverse_rate(rate);
}
}
void SET_FEED_REFERENCE(CANON_FEED_REFERENCE) {
}
void SET_FEED_MODE(int, int) {
void SET_FEED_MODE(int spindle, int mode) {
if (active_sink) {
active_sink->set_feed_mode(0, event_line());
active_sink->set_feed_mode(spindle, mode, event_line());
}
}
void SET_MOTION_CONTROL_MODE(CANON_MOTION_MODE mode, double tolerance) {
motion_control_mode = mode;
motion_control_tolerance = tolerance;
int reserved = 0;
switch (mode) {
case CANON_EXACT_PATH:
@@ -330,7 +348,8 @@ void SET_MOTION_CONTROL_MODE(CANON_MOTION_MODE mode, double tolerance) {
}
}
void SET_NAIVECAM_TOLERANCE(double) {
void SET_NAIVECAM_TOLERANCE(double tolerance) {
naivecam_tolerance = tolerance;
}
void SET_CUTTER_RADIUS_COMPENSATION(double) {
@@ -342,10 +361,16 @@ void START_CUTTER_RADIUS_COMPENSATION(int) {
void STOP_CUTTER_RADIUS_COMPENSATION() {
}
void START_SPEED_FEED_SYNCH(int, double, bool) {
void START_SPEED_FEED_SYNCH(int spindle, double feed_per_revolution, bool velocity_mode) {
if (active_sink) {
active_sink->set_speed_feed_sync(spindle, feed_per_revolution, velocity_mode, true, event_line());
}
}
void STOP_SPEED_FEED_SYNCH() {
if (active_sink) {
active_sink->set_speed_feed_sync(0, 0.0, false, false, event_line());
}
}
void NURBS_G5_FEED(int lineno, const std::vector<NURBS_CONTROL_POINT> &points, unsigned int, CANON_PLANE) {
@@ -378,7 +403,7 @@ void RIGID_TAP(int lineno, double x, double y, double z, double) {
end.x = x;
end.y = y;
end.z = z;
active_sink->straight_feed(lineno, end);
active_sink->straight_feed(event_line(lineno), end);
}
}
@@ -386,16 +411,21 @@ void STRAIGHT_PROBE(int lineno,
double x, double y, double z,
double a, double b, double c,
double u, double v, double w,
unsigned char) {
unsigned char probe_type) {
if (active_sink) {
active_sink->straight_probe(event_line(lineno), make_pose(x, y, z, a, b, c, u, v, w));
active_sink->straight_probe(event_line(lineno),
make_pose(x, y, z, a, b, c, u, v, w),
probe_type);
}
}
void STOP() {
}
void SET_SPINDLE_MODE(int, double) {
void SET_SPINDLE_MODE(int spindle, double mode) {
if (active_sink) {
active_sink->set_spindle_mode(spindle, mode, event_line());
}
}
void SPINDLE_RETRACT_TRAVERSE() {
@@ -422,10 +452,16 @@ void STOP_SPINDLE_TURNING(int) {
void SPINDLE_RETRACT() {
}
void ORIENT_SPINDLE(int, double, int) {
void ORIENT_SPINDLE(int spindle, double orientation, int mode) {
if (active_sink) {
active_sink->orient_spindle(spindle, orientation, mode, event_line());
}
}
void WAIT_SPINDLE_ORIENT_COMPLETE(int, double) {
void WAIT_SPINDLE_ORIENT_COMPLETE(int spindle, double timeout) {
if (active_sink) {
active_sink->wait_spindle_orient_complete(spindle, timeout, event_line());
}
}
void LOCK_SPINDLE_Z() {
@@ -444,14 +480,16 @@ void USE_TOOL_LENGTH_OFFSET(const EmcPose &offset) {
if (!active_sink) {
return;
}
const CncSimPose tool_offset = make_pose(offset.tran.x, offset.tran.y, offset.tran.z,
offset.a, offset.b, offset.c,
offset.u, offset.v, offset.w);
active_sink->set_tool_length_offset(tool_offset);
CncSimEvent event{};
event.version = 1;
event.type = CNC_SIM_EVENT_COMMENT;
event.line = event_line();
event.reserved = 430;
event.start = make_pose(offset.tran.x, offset.tran.y, offset.tran.z,
offset.a, offset.b, offset.c,
offset.u, offset.v, offset.w);
event.start = tool_offset;
active_sink->emit_raw(event);
}
@@ -482,36 +520,66 @@ void COMMENT(const char *message) {
}
void DISABLE_ADAPTIVE_FEED() {
if (active_sink) {
active_sink->set_override_control(52, false, 0, event_line());
}
}
void ENABLE_ADAPTIVE_FEED() {
if (active_sink) {
active_sink->set_override_control(52, true, 0, event_line());
}
}
void DISABLE_FEED_OVERRIDE() {
if (active_sink) {
active_sink->set_override_control(50, false, 0, event_line());
}
}
void ENABLE_FEED_OVERRIDE() {
if (active_sink) {
active_sink->set_override_control(50, true, 0, event_line());
}
}
void DISABLE_SPEED_OVERRIDE(int) {
void DISABLE_SPEED_OVERRIDE(int spindle) {
if (active_sink) {
active_sink->set_override_control(51, false, spindle, event_line());
}
}
void ENABLE_SPEED_OVERRIDE(int) {
void ENABLE_SPEED_OVERRIDE(int spindle) {
if (active_sink) {
active_sink->set_override_control(51, true, spindle, event_line());
}
}
void DISABLE_FEED_HOLD() {
if (active_sink) {
active_sink->set_override_control(53, false, 0, event_line());
}
}
void ENABLE_FEED_HOLD() {
if (active_sink) {
active_sink->set_override_control(53, true, 0, event_line());
}
}
void FLOOD_OFF() {
flood_on = false;
if (active_sink) {
active_sink->set_flood_on(false);
}
emit_state_event(CNC_SIM_EVENT_COMMENT, 20);
}
void FLOOD_ON() {
flood_on = true;
if (active_sink) {
active_sink->set_flood_on(true);
}
emit_state_event(CNC_SIM_EVENT_COMMENT, 21);
}
@@ -532,11 +600,17 @@ void LOGCLOSE() {
void MIST_OFF() {
mist_on = false;
if (active_sink) {
active_sink->set_mist_on(false);
}
emit_state_event(CNC_SIM_EVENT_COMMENT, 10);
}
void MIST_ON() {
mist_on = true;
if (active_sink) {
active_sink->set_mist_on(true);
}
emit_state_event(CNC_SIM_EVENT_COMMENT, 11);
}
@@ -564,11 +638,12 @@ void NURB_CONTROL_POINT(int, double, double, double, double) {
void NURB_FEED(double, double) {
}
void SET_BLOCK_DELETE(bool) {
void SET_BLOCK_DELETE(bool enabled) {
block_delete = enabled;
}
bool GET_BLOCK_DELETE(void) {
return false;
return block_delete;
}
void OPTIONAL_PROGRAM_STOP() {
@@ -577,11 +652,12 @@ void OPTIONAL_PROGRAM_STOP() {
}
}
void SET_OPTIONAL_PROGRAM_STOP(bool) {
void SET_OPTIONAL_PROGRAM_STOP(bool state) {
optional_program_stop = state;
}
bool GET_OPTIONAL_PROGRAM_STOP() {
return false;
return optional_program_stop;
}
void PROGRAM_STOP() {
@@ -590,25 +666,46 @@ void PROGRAM_STOP() {
}
}
void SET_MOTION_OUTPUT_BIT(int) {
void SET_MOTION_OUTPUT_BIT(int index) {
if (active_sink) {
active_sink->set_digital_output(index, true, true, event_line());
}
}
void CLEAR_MOTION_OUTPUT_BIT(int) {
void CLEAR_MOTION_OUTPUT_BIT(int index) {
if (active_sink) {
active_sink->set_digital_output(index, false, true, event_line());
}
}
void SET_AUX_OUTPUT_BIT(int) {
void SET_AUX_OUTPUT_BIT(int index) {
if (active_sink) {
active_sink->set_digital_output(index, true, false, event_line());
}
}
void CLEAR_AUX_OUTPUT_BIT(int) {
void CLEAR_AUX_OUTPUT_BIT(int index) {
if (active_sink) {
active_sink->set_digital_output(index, false, false, event_line());
}
}
void SET_MOTION_OUTPUT_VALUE(int, double) {
void SET_MOTION_OUTPUT_VALUE(int index, double value) {
if (active_sink) {
active_sink->set_analog_output(index, value, true, event_line());
}
}
void SET_AUX_OUTPUT_VALUE(int, double) {
void SET_AUX_OUTPUT_VALUE(int index, double value) {
if (active_sink) {
active_sink->set_analog_output(index, value, false, event_line());
}
}
int WAIT(int, int, int wait_type, double) {
int WAIT(int index, int input_type, int wait_type, double timeout) {
if (active_sink) {
active_sink->wait_input(index, input_type, wait_type, timeout, event_line());
}
return wait_type;
}
@@ -645,15 +742,15 @@ int GET_EXTERNAL_MIST() {
}
CANON_MOTION_MODE GET_EXTERNAL_MOTION_CONTROL_MODE() {
return CANON_EXACT_STOP;
return motion_control_mode;
}
double GET_EXTERNAL_MOTION_CONTROL_TOLERANCE() {
return 0.0;
return motion_control_tolerance;
}
double GET_EXTERNAL_MOTION_CONTROL_NAIVECAM_TOLERANCE() {
return 0.0;
return naivecam_tolerance;
}
void GET_EXTERNAL_PARAMETER_FILE_NAME(char *filename, int max_size) {
@@ -680,22 +777,22 @@ double GET_EXTERNAL_POSITION_U() { return current_position().u; }
double GET_EXTERNAL_POSITION_V() { return current_position().v; }
double GET_EXTERNAL_POSITION_W() { return current_position().w; }
double GET_EXTERNAL_PROBE_POSITION_A() { return current_position().a; }
double GET_EXTERNAL_PROBE_POSITION_B() { return current_position().b; }
double GET_EXTERNAL_PROBE_POSITION_C() { return current_position().c; }
double GET_EXTERNAL_PROBE_POSITION_X() { return current_position().x; }
double GET_EXTERNAL_PROBE_POSITION_Y() { return current_position().y; }
double GET_EXTERNAL_PROBE_POSITION_Z() { return current_position().z; }
double GET_EXTERNAL_PROBE_POSITION_U() { return current_position().u; }
double GET_EXTERNAL_PROBE_POSITION_V() { return current_position().v; }
double GET_EXTERNAL_PROBE_POSITION_W() { return current_position().w; }
double GET_EXTERNAL_PROBE_POSITION_A() { return active_sink ? active_sink->probe_position().a : 0.0; }
double GET_EXTERNAL_PROBE_POSITION_B() { return active_sink ? active_sink->probe_position().b : 0.0; }
double GET_EXTERNAL_PROBE_POSITION_C() { return active_sink ? active_sink->probe_position().c : 0.0; }
double GET_EXTERNAL_PROBE_POSITION_X() { return active_sink ? active_sink->probe_position().x : 0.0; }
double GET_EXTERNAL_PROBE_POSITION_Y() { return active_sink ? active_sink->probe_position().y : 0.0; }
double GET_EXTERNAL_PROBE_POSITION_Z() { return active_sink ? active_sink->probe_position().z : 0.0; }
double GET_EXTERNAL_PROBE_POSITION_U() { return active_sink ? active_sink->probe_position().u : 0.0; }
double GET_EXTERNAL_PROBE_POSITION_V() { return active_sink ? active_sink->probe_position().v : 0.0; }
double GET_EXTERNAL_PROBE_POSITION_W() { return active_sink ? active_sink->probe_position().w : 0.0; }
double GET_EXTERNAL_PROBE_VALUE() {
return 0.0;
}
int GET_EXTERNAL_PROBE_TRIPPED_VALUE() {
return 0;
return active_sink && active_sink->probe_tripped() ? 1 : 0;
}
int GET_EXTERNAL_QUEUE_EMPTY() {
@@ -719,15 +816,15 @@ CANON_DIRECTION GET_EXTERNAL_SPINDLE(int) {
return CANON_STOPPED;
}
double GET_EXTERNAL_TOOL_LENGTH_XOFFSET() { return 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_YOFFSET() { return 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_ZOFFSET() { return 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_AOFFSET() { return 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_BOFFSET() { return 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_COFFSET() { return 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_UOFFSET() { return 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_VOFFSET() { return 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_WOFFSET() { return 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_XOFFSET() { return active_sink ? active_sink->tool_length_offset().x : 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_YOFFSET() { return active_sink ? active_sink->tool_length_offset().y : 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_ZOFFSET() { return active_sink ? active_sink->tool_length_offset().z : 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_AOFFSET() { return active_sink ? active_sink->tool_length_offset().a : 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_BOFFSET() { return active_sink ? active_sink->tool_length_offset().b : 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_COFFSET() { return active_sink ? active_sink->tool_length_offset().c : 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_UOFFSET() { return active_sink ? active_sink->tool_length_offset().u : 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_VOFFSET() { return active_sink ? active_sink->tool_length_offset().v : 0.0; }
double GET_EXTERNAL_TOOL_LENGTH_WOFFSET() { return active_sink ? active_sink->tool_length_offset().w : 0.0; }
int GET_EXTERNAL_TOOL_SLOT() {
return active_sink ? active_sink->selected_tool() : 0;
@@ -755,23 +852,23 @@ int GET_EXTERNAL_TC_REASON() {
}
double GET_EXTERNAL_TRAVERSE_RATE() {
return 0.0;
return active_sink ? active_sink->traverse_rate() : 0.0;
}
int GET_EXTERNAL_FEED_OVERRIDE_ENABLE() {
return 1;
return active_sink ? (active_sink->feed_override() ? 1 : 0) : 1;
}
int GET_EXTERNAL_SPINDLE_OVERRIDE_ENABLE(int) {
return 1;
return active_sink ? (active_sink->speed_override() ? 1 : 0) : 1;
}
int GET_EXTERNAL_ADAPTIVE_FEED_ENABLE() {
return 1;
return active_sink ? (active_sink->adaptive_feed() ? 1 : 0) : 1;
}
int GET_EXTERNAL_FEED_HOLD_ENABLE() {
return 1;
return active_sink ? (active_sink->feed_hold() ? 1 : 0) : 1;
}
int GET_EXTERNAL_DIGITAL_INPUT(int, int def) {

File diff suppressed because it is too large Load Diff

View File

@@ -14,6 +14,10 @@ public:
private:
CanonEventSink &sink_;
bool absolute_ = true;
bool arc_absolute_ = false;
bool lathe_diameter_mode_ = false;
bool cutter_comp_on_ = false;
int feed_mode_ = 0;
int canned_cycle_ = 0;
bool canned_return_to_initial_ = false;
bool canned_has_r_ = false;
@@ -21,9 +25,17 @@ private:
bool canned_has_p_ = false;
bool canned_has_q_ = false;
bool canned_has_d_ = false;
bool canned_has_i_ = false;
bool canned_has_j_ = false;
bool canned_has_k_ = false;
double canned_r_ = 0.0;
double canned_z_ = 0.0;
double canned_p_ = 0.0;
double canned_q_ = 0.0;
double canned_d_ = 1.0;
double canned_i_ = 0.0;
double canned_j_ = 0.0;
double canned_k_ = 0.0;
double oword_return_value_ = 0.0;
bool oword_value_returned_ = false;
};