python: Robot: *.py: Fix python3 syntax
This commit is contained in:
@@ -26,7 +26,7 @@ HeaderSrc = """&ACCESS RVP
|
||||
|
||||
|
||||
def ExportCompactSub(Rob,Trak,FileName):
|
||||
print Rob,Trak,FileName
|
||||
print(Rob,Trak,FileName)
|
||||
Traj = Trak.Trajectory
|
||||
# open the output file
|
||||
SrcFile = open(FileName,'w')
|
||||
@@ -65,5 +65,5 @@ def ExportCompactSub(Rob,Trak,FileName):
|
||||
#DatFile.close()
|
||||
|
||||
def ExportFullSub(Rob,Trak,FileName):
|
||||
print Trak,FileName
|
||||
print(Trak,FileName)
|
||||
|
||||
|
||||
@@ -19,4 +19,4 @@ def run():
|
||||
for l in range(size):
|
||||
Robot.Tcp = Trajectory.position(l/24.0).multiply(Tool)
|
||||
FreeCADGui.updateGui()
|
||||
FreeCADGui.ActiveDocument.ActiveView.saveImage(OutDir + "Rob_" + `l` + ".jpg",x,y,"White")
|
||||
FreeCADGui.ActiveDocument.ActiveView.saveImage(OutDir + "Rob_" + l + ".jpg",x,y,"White")
|
||||
|
||||
@@ -9,31 +9,31 @@ from FreeCAD import *
|
||||
# === Basic robot stuff ===
|
||||
# create the robot. If you not specify a other kinematic it becomes a Puma 560
|
||||
rob = Robot6Axis()
|
||||
print rob
|
||||
print(rob)
|
||||
|
||||
# accessing the axis and the Tcp. Axis go from 1-6 and are in degrees:
|
||||
Start = rob.Tcp
|
||||
print Start
|
||||
print rob.Axis1
|
||||
print(Start)
|
||||
print(rob.Axis1)
|
||||
|
||||
# move the first Axis of the robot:
|
||||
rob.Axis1 = 5.0
|
||||
# the Tcp has changed (forward kinematic)
|
||||
print rob.Tcp
|
||||
print(rob.Tcp)
|
||||
|
||||
# move the robot back to start position (reverse kinematic):
|
||||
rob.Tcp = Start
|
||||
print rob.Axis1
|
||||
print(rob.Axis1)
|
||||
|
||||
# the same with axis 2:
|
||||
rob.Axis2 = 5.0
|
||||
print rob.Tcp
|
||||
print(rob.Tcp)
|
||||
rob.Tcp = Start
|
||||
print rob.Axis2
|
||||
print(rob.Axis2)
|
||||
|
||||
# Waypoints:
|
||||
w = Waypoint(Placement(),name="Pt",type="LIN")
|
||||
print w.Name,w.Type,w.Pos,w.Cont,w.Velocity,w.Base,w.Tool
|
||||
print(w.Name,w.Type,w.Pos,w.Cont,w.Velocity,w.Base,w.Tool)
|
||||
|
||||
# generate more. The Trajectory find allways outomatically a unique name for the waypoints
|
||||
l = [w]
|
||||
@@ -42,12 +42,12 @@ for i in range(5):
|
||||
|
||||
# create a trajectory
|
||||
t = Trajectory(l)
|
||||
print t
|
||||
print(t)
|
||||
for i in range(7):
|
||||
t.insertWaypoints(Waypoint(Placement(Vector(0,0,i*100+500),Vector(1,0,0),0),"LIN","Pt"))
|
||||
|
||||
# see a list of all waypoints:
|
||||
print t.Waypoints
|
||||
print(t.Waypoints)
|
||||
|
||||
del rob,Start,t,l,w
|
||||
|
||||
@@ -79,7 +79,7 @@ t = App.activeDocument().Trajectory.Trajectory
|
||||
StartTcp = App.activeDocument().Robot.Tcp
|
||||
t.insertWaypoints(StartTcp)
|
||||
App.activeDocument().Trajectory.Trajectory = t
|
||||
print App.activeDocument().Trajectory.Trajectory
|
||||
print(App.activeDocument().Trajectory.Trajectory)
|
||||
|
||||
# insert some more Waypoints and the start point at the end again:
|
||||
for i in range(7):
|
||||
@@ -87,7 +87,7 @@ for i in range(7):
|
||||
|
||||
t.insertWaypoints(StartTcp) # end point of the trajectory
|
||||
App.activeDocument().Trajectory.Trajectory = t
|
||||
print App.activeDocument().Trajectory.Trajectory
|
||||
print(App.activeDocument().Trajectory.Trajectory)
|
||||
|
||||
# === Simulation ===
|
||||
# To be done..... ;-)
|
||||
@@ -102,5 +102,5 @@ ExportCompactSub(App.activeDocument().Robot,App.activeDocument().Trajectory,'D:/
|
||||
# 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))
|
||||
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))
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ for so in Gui.Selection.getSelectionEx():
|
||||
if edge.Type != 'Part::TopoShape':continue
|
||||
pos1 = edge.valueAt(0)
|
||||
pos2 = edge.valueAt(edge.Length)
|
||||
print pos1,pos2
|
||||
print(pos1,pos2)
|
||||
if count==0: # first edge
|
||||
FirstPos1 = pos1
|
||||
FirstPos2 = pos2
|
||||
|
||||
Reference in New Issue
Block a user