CoordinateFile Import
The CoordinateFileImport project is a RobotStudio addin project which gives option to import the coordinate file data and modify the instructions setting parameters like tool,workobject, speed and zone. The end result of the addin is a path in RobotStudio.
Download
Click here to download
Note
If you encounter some build errors when add-in is built, you need to add the DLL references from RobotStudio application folder.
Refer to the How to add a reference to your Add-in section in the
Creating a Robot
User Interface
This addin has an option to Import coordinate file and select the Instruction setting parameters namely tool, workobject, speed and zone.
Import File button click raise an event to browse for a file.
Speed control shows the list of speeds for the active system.
Zone control shows the list of zones for the active system.
Tool control shows all the available tools in active station.
Workobject shows all the available workobjects in active task.
Parameters description
RsToolData: Rs
RsWorkObject: Rs
Speed: Speed is an RsMoveInstruction Instruction argument parameter.
Zone: Zone is an RsMoveInstruction Instruction argument parameter.
Supported Coordinate file formats
This addin accepts .cls,.nc, .csv, .S3euler, .S3quaternion, .S3text, .aptsource, .axson and .aml coordinate file formats
Internals
This addin reads an imported file line-by-line and fetches the coordinates and put it into the list till the EOF is reached. List of coordinates (Output of read file functions) along with other Instruction setting parameters (mentioned above) are taken as input to create the RsMoveInstrustions. RsMoveInstructions are taken as input to create RsPathProcedure.
Read the extention of input coordinate file and execute the matching switch-case block in openFileDialog_FileOk method.
string strFileExt = System.IO.Path.GetExtension(openFileDialog.FileName); switch (strFileExt) { case ".cls": //.... default: return; }
switch-case block reads the file and assigns list of coordinates to arrFileData (reference object of arraylist type)
ImportCoordinateFileTool.ActFileType = ImportCoordinateFileTool.FileType.cls; arrFileData = ImportCoordinateFileTool.ReadCLSfile(openFileDialog.FileName);
Get the RsWorkObject and RsToolData object from the RsDataDecleration.
foreach (RsDataDeclaration rsd in station.ActiveTask.DataDeclarations) { if (rsd is RsToolData) { if (rsd.Name == strTool) { rsTD = rsd as RsToolData; } } if (rsd is RsWorkObject) { if (rsd.Name == strWobj) { rsWD = rsd as RsWorkObject; station.ActiveTask.ActiveWorkObject = rsWD; } } }
Get updated speeddata and zonedata information from rapid using RapidSymbol.
RapidSymbol[] rapidsymbol; ABB.Robotics.Controllers.RapidDomain.RapidSymbolSearchProperties searchProperties = ABB.Robotics.Controllers.RapidDomain.RapidSymbolSearchProperties.CreateDefault(); searchProperties.SearchMethod = SymbolSearchMethod.Scope; searchProperties.Types = SymbolTypes.Constant; searchProperties.Recursive = true; //search for speeddata values rapidsymbol = controller.Rapid.GetTask("T_ROB1").SearchRapidSymbol(searchProperties, "speeddata", string.Empty); //search for zonedata values rapidsymbol = controller.Rapid.GetTask("T_ROB1").SearchRapidSymbol(searchProperties, "zonedata", string.Empty);
Pass the results of step 2., 3. along with speed and zone value in step 4. to CreatePath of ImportCoordinateFileTool module.
a. Get imported file name without extension
string strFileName = System.IO.Path.GetFileNameWithoutExtension(openFileDialog.FileName);
b. Create valid path procedure name.
if (arrFileData.Count > 0) { intLoggerData = ImportCoordinateFileTool.CreatePath( strFileName, arrFileData, rsTD, rsWD, strSpeed, strZone); }
c. Create Instance of RsPathProcedure using the name in step 5.b.
// Create instance of RsPathProcedure RsPathProcedure pathCF = new RsPathProcedure(strPathName); // Add Empty to the pathprocedure collection of active task. station.ActiveTask.PathProcedures.Add(pathCF);
d. Enumerate Step 2. resulted object to create RsRobTargets and RsTarget object.
RsRobTarget rsrtCFtarget = new RsRobTarget(); // Create target from robtarget and associate with workobject RsTarget rstCFtarget = new RsTarget(workObject, rsrtCFtarget);
e. Create RsMoveInstruction from RsTarget.
RsMoveInstruction rsmCFinstruction = new RsMoveInstruction( station.ActiveTask, "Move", "Default", MotionType.Joint, workObject.Name, rsrtCFtarget.Name, toolData.Name);
f. Add resulted object from step 5.c. to 5.e.
pathCF.Instructions.Add(rsmCFinstruction);
See the Path Procedure in RobotStudio's graphical window.
How to run an Addin
Load Addin: CoordinateFileImport addin will appear under General node of Add-Ins tab. Right click the addin to see load options. Click on "Load Add-In" to see the addin in ribbon.
CoordinateFileImport Addin Button: Coordinate File Import button will appear as shown in Figure.
CoordinateFileImport ToolWindow: Click on the button shown in Figure 1. to launch the tool window of addin. Tool window will show the editable Instruction Settings parameters to modify the Tool, Workobject, Speed, Zone value and Import file button to Import the coordinate file.
Output: See an output in Graphic window of RobotStudio