Generation of new RAPID code-lines via SDK

Hi.

Is it in any way possible to generate new lines of rapid instructions in a module of an active station, using an Add-in written in C# in visual studio?
Eg. if I want my add-in to generate a number of speeddata dataobjects, or if I want to add an “CirPathMode\CirPointOri” instruction to my RAPID module.
This means that I do not wish to alter existing rapid instruction, but to add new ones.

Sincerely Patrick

Well, yes. There is no easy way though. You can either do it through RobotStudio SDK by using instruction templates, or using the PCSDK by updating a module textwise (streamwriter or somesuch) and loading it again.

Of the two I usually prefer the RobotStudio SDK Instruction Template way since you keep a somewhat syntactic integrity. The limitation is logic though like IF WHILE or such, then you have to go with the PCSDK approach of text editing.

What you do with the RobotStudio SDK way is to create Instruction Templates of the types that you want to add.

http://developercenter.robotstudio.com:80/Index.aspx?DevCenter=DevCenterManualStore&OpenDocument&Url=../RobotStudioOpManual/doc116.html

you can do this by code as well if you want but its much harder, in this example you can see them add a rsmoveinstruction using Path.instruction.add

http://developercenter.robotstudio.com:80/Index.aspx?DevCenter=RobotStudio&OpenDocument&Url=html/82827066-9839-74e0-c44b-34d655a20c34.htm

and then sync it to the Virtual Controller. You can do that with action instructions and data declarations as well

http://developercenter.robotstudio.com:80/Index.aspx?DevCenter=RobotStudio&OpenDocument&Url=html/8e534399-f842-bb86-49e9-190462590cc6.htm

http://developercenter.robotstudio.com:80/Index.aspx?DevCenter=RobotStudio&OpenDocument&Url=html/be6393c1-1acd-44b1-be6f-18e962409f0b.htm

http://developercenter.robotstudio.com:80/Index.aspx?DevCenter=RobotStudio&OpenDocument&Url=html/8c438994-18a1-d4ea-10f5-5fad4214ffaf.htm

So the speeddata would go under sync data declarations and the CirPath stuff would be move instructions or actions instructions depending on.

Hello John,

the links don’t work, how can I find the documents.

Best Regards
Wolfgang