Browse Source

tested KRL template, src changes

master
Jörg Kurlbaum 3 years ago
parent
commit
2921fbcb1f
  1. 4
      InitGui.py
  2. 18
      lasercladding/kuka.py

4
InitGui.py

@ -17,7 +17,7 @@ class LaserCladding (Workbench): @@ -17,7 +17,7 @@ class LaserCladding (Workbench):
It is executed once in a FreeCAD session followed by the Activated function.
"""
import lasercladding
self.list = ["CreateCladdingJob", "SelectBaseReference", "CreatePad"] # A list of command names created in the line above
self.appendToolbar("My Commands",self.list) # creates a new toolbar with your commands
self.appendMenu("LaserCladding",self.list) # creates a new menu
@ -38,7 +38,7 @@ class LaserCladding (Workbench): @@ -38,7 +38,7 @@ class LaserCladding (Workbench):
# "recipient" will be either "view" or "tree"
self.appendContextMenu("My commands",self.list) # add commands to the context menu
def GetClassName(self):
def GetClassName(self):
# This function is mandatory if this is a full Python workbench
# This is not a template, the returned string should be exactly "Gui::PythonWorkbench"
return "Gui::PythonWorkbench"

18
lasercladding/kuka.py

@ -11,7 +11,7 @@ $BWDSTART = FALSE @@ -11,7 +11,7 @@ $BWDSTART = FALSE
LDAT_ACT=LCPDAT1
FDAT_ACT=FP4
BAS(#CP_PARAMS,0.2)
LIN XP4
LIN XP4
;ENDFOLD
"""
@ -24,7 +24,7 @@ DECL LDAT LCPDAT1={VEL 2.0,ACC 100.0,APO_DIST 100.0,APO_FAC 50.0,ORI_TYP #VAR} @@ -24,7 +24,7 @@ DECL LDAT LCPDAT1={VEL 2.0,ACC 100.0,APO_DIST 100.0,APO_FAC 50.0,ORI_TYP #VAR}
header_src = """&ACCESS RVP
&REL 1
&PARAM TEMPLATE = C:\KRC\Roboter\Template\ExpertVorgabe
&PARAM EDITMASK = *
&PARAM EDITMASK = *
"""
@ -65,23 +65,25 @@ class Kuka_Prog: @@ -65,23 +65,25 @@ class Kuka_Prog:
def save_prog(self, filename):
srcfile = open(filename+'.src','w')
srcfile.write(header_src)
# subroutine definition
# subroutine definition
srcfile.write("DEF "+filename+"( )\n\n")
srcfile.write(";- Kuka src file, generated by KVT\n")
srcfile.write(";- "+ time.asctime()+"\n\n")
# defining world and base
srcfile.write("E6POS startp\n")
srcfile.write(";------------- definitions ------------\n")
srcfile.write("EXT BAS (BAS_COMMAND :IN,REAL :IN ) ;set base to World\n")
srcfile.write("BAS (#INITMOV,0 ) ;Initialicing the defaults for Vel and so on \n\n")
srcfile.write("$BASE = BASE_DATA[6] ; SET BASE to WORKPLACE\n\n")
srcfile.write("\n;------------- main part ------------\n")
srcfile.write("BAS (#TOOL,6) ;Initialicing the defaults for Vel and so on \n\n")
srcfile.write("BAS (#BASE,2) ;Initialicing the defaults for Vel and so on \n\n")
srcfile.write("PTP {A1 -1.9, A2 -105.76, A3 79.97, A4 178.83, A5 -20.3, A6 -4.37, E1 -90, E2 0}\n")
srcfile.write(";------------- main part ------------\n")
srcfile.write("startp=$POS_ACT\n")
#V = w.Velocity / 1000.0 # from mm/s to m/s
V = 0.05
srcfile.write("$VEL.CP = %f ; m/s ; m/s \n"%V)
for pose in self.pose_list:
srcfile.write("LIN {} ; GENERATED\n".format(pose.to_string()))
srcfile.write("LIN startp:{} C_VEL; GENERATED\n".format(pose.to_string()))
# end of subroutine
srcfile.write("\n;------------- end ------------\n")
srcfile.write("END \n\n")

Loading…
Cancel
Save