示例#1
0
t.insertWaypoints(StartTcp)
App.activeDocument().Trajectory.Trajectory = t
print App.activeDocument().Trajectory.Trajectory

# insert some more Waypoints and the start point at the end again:
for i in range(7):
    t.insertWaypoints(
        Waypoint(Placement(Vector(0, 1000, i * 100 + 500), Vector(1, 0, 0), i),
                 "LIN", "Pt"))

t.insertWaypoints(StartTcp)  # end point of the trajectory
App.activeDocument().Trajectory.Trajectory = t
print App.activeDocument().Trajectory.Trajectory

# === Simulation ===
# To be done..... ;-)

# === Exporting the trajectory ===
# the Trajectory is exported by python. That means for every Control Cabinet type is a Post processor
# python module. Here is in detail the Kuka Postprocessor descriped
from KukaExporter import ExportCompactSub

ExportCompactSub(App.activeDocument().Robot,
                 App.activeDocument().Trajectory, 'D:/Temp/TestOut.src')

# and thats kind of how its done:
for w in App.activeDocument().Trajectory.Trajectory.Waypoints:
    (A, B, C) = (w.Pos.Rotation.toEuler())
    print("LIN {X %.3f,Y %.3f,Z %.3f,A %.3f,B %.3f,C %.3f} ; %s" %
          (w.Pos.Base.x, w.Pos.Base.y, w.Pos.Base.z, A, B, C, w.Name))
示例#2
0
App.activeDocument().Trajectory.Trajectory = t
print(App.activeDocument().Trajectory.Trajectory)

# insert some more Waypoints and the start point at the end again:
for i in range(7):
    t.insertWaypoints(
        Waypoint(Placement(Vector(0, 1000, i * 100 + 500), Vector(1, 0, 0), i),
                 "LIN", "Pt"))

t.insertWaypoints(StartTcp)  # end point of the trajectory
App.activeDocument().Trajectory.Trajectory = t
print(App.activeDocument().Trajectory.Trajectory)

# === Simulation ===
# To be done..... ;-)

# === Exporting the trajectory ===
# the Trajectory is exported by python. That means for every Control Cabinet type is a Post processor
# python module. Here is in detail the Kuka Postprocessor descriped
from KukaExporter import ExportCompactSub

ExportCompactSub(App.activeDocument().Robot,
                 App.activeDocument().Trajectory,
                 tempfile.gettempdir() + '/TestOut.src')

# and thats kind of how its done:
for w in App.activeDocument().Trajectory.Trajectory.Waypoints:
    (A, B, C) = (w.Pos.Rotation.toEuler())
    print("LIN {X %.3f,Y %.3f,Z %.3f,A %.3f,B %.3f,C %.3f} ; %s" %
          (w.Pos.Base.x, w.Pos.Base.y, w.Pos.Base.z, A, B, C, w.Name))