Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Siemens Sinumerik Force Z-Axis Value

#1
Hello, 
I was having a problem with the output from the Siemens Sinumerik post processor, which does not include a Z value if it has not changed, here is an example.
Z value no change: 
Code:
N26 G1 X158.585 Y99.391 Z295.351 A=180.000 B=0.000 C=-173.733 F30000.0
N27 G1 X158.528 Y98.895 A=180.000 B=0.000 C=-173.734 F30000.0
N28 G1 X158.470 Y98.400 A=180.000 B=0.000 C=-173.736 F30000.0
I obtained the 'source' post processor from info@robodk.com, and revised the 'pose_2_str' function which produced:

Z Value forced every line:
Code:
N26 G1 X158.585 Y99.391 Z472.948 A180.000 B0.000 C-173.733 F30000.0
N27 G1 X158.527 Y98.895 Z472.948 A180.000 B0.000 C-173.725 F30000.0
N28 G1 X158.470 Y98.400 Z472.948 A180.000 B0.000 C-173.717 F30000.0
Not a question, but I searched extensively before posting and could not find an answer.

In case anyone else needs to force a z-axis value, or I forget how to do it in 6 months...
Attached is python program that adds the Z value to gcode. 

Talk to you soon,
Tony

Code:
def pose_2_str(self, pose, remember_last=False):
    """Prints a pose target"""
    [x,y,z,a,b,c] = Pose_2_Staubli(pose)
    x = x * self.MM_2_UNITS
    y = y * self.MM_2_UNITS
    z = z * self.MM_2_UNITS
    G_LINE = 'X%.3f Y%.3f Z%.3f A%.3f B%.3f C%.3f' % (x,y,z,a,b,c)
    return G_LINE


Attached Files
.py   add_z_values.py (Size: 3.82 KB / Downloads: 66)
#2
Excellent! Thank you for letting us know about this modifications.

On the other hand, as an alternative to output the code you want directly from the post processor and always set the XYZABC values you can simply set the remember_last variable to False with the following function:
Code:
    def pose_2_str(self, pose, remember_last=False):
        """Prints a pose target"""
        [x,y,z,a,b,c] = Pose_2_Staubli(pose)
        x = x * self.MM_2_UNITS
        y = y * self.MM_2_UNITS
        z = z * self.MM_2_UNITS
        if remember_last:
            G_LINE = ''
            if self.LAST_X != x:
                G_LINE += 'X%.3f ' % x
            if self.LAST_Y != y:
                G_LINE += 'Y%.3f ' % y
            if self.LAST_Z != z or len(G_LINE) == 0:
                G_LINE += 'Z%.3f ' % z
            G_LINE += 'A=%.3f ' % a
            G_LINE += 'B=%.3f ' % b
            G_LINE += 'C=%.3f ' % c
            self.LAST_X = x
            self.LAST_Y = y
            self.LAST_Z = z           
            G_LINE = G_LINE[:-1]       
            return G_LINE
        else:
            return ('X%.3f Y%.3f Z%.3f A%.3f B%.3f C%.3f' % (x,y,z,a,b,c))
  




Users browsing this thread:
1 Guest(s)