you have several files and example delivered with the SDK (need to be installed) located in the installation subdirectory ...\SDK.
Look also to this topic
Best Regards
I have the SDK installed and API references for robot are active in visual studio
But still have problem, I guess related to syntaxe, that is why I need a document (pdf) where i can found syntaxe of C# for RSA.
using System;
using System.Runtime.InteropServices;
using RobotOM;
namespace RSAExample
{
class Program
{
static void Main(string[] args)
{
IRobotApplication rsaApp = null;
try
{
// Création de l'instance de l'interface IRobotApplication
rsaApp = (IRobotApplication)Activator.CreateInstance(Type.GetTypeFromProgID("Robot.Application"));
// Vérifier si RSA est en cours d'exécution
if (rsaApp != null)
{
rsaApp.Interactive = 1; // Démarrer en mode interactif
// Spécifier le chemin du projet existant
string fullProjectPath = @"C:\Users\bechir.hammadi\Desktop\NDC\NomDuFichier01.rtd";
// Ouvrir le projet existant
rsaApp.Project.Open(fullProjectPath);
IRobotStructure structure = rsaApp.Project.Structure;
IRobotNodeServer nodeServer = structure.Nodes;
nodeServer.Create(1, 0, 0, 0);
nodeServer.Create(2, 0, 0, 3);
IRobotBarServer barServer = structure.Bars;
barServer.Create(1, 1, 2);
rsaApp.Project.Preferences.SetCurrentDatabase(IRobotDatabaseType.I_DT_SECTIONS, "SIMPL");
IRobotLabel Section = rsaApp.Project.Structure.Labels.Create(IRobotLabelType.I_LT_BAR_SECTION, "HEA 120");
IRobotBarSectionData SData = Section.Data;
SData.LoadFromDBase("HEA 120");
rsaApp.Project.Structure.Labels.Store(Section);
RobotBar Bar1 = (RobotBar)rsaApp.Project.Structure.Bars.Get(1);
Bar1.SetLabel(IRobotLabelType.I_LT_BAR_SECTION, "HEA 120");
// Enregistrer les modifications apportées au projet
rsaApp.Project.Save();
Console.WriteLine("Modifications enregistrées avec succès.");
}
else
{
Console.WriteLine("Robot Structural Analysis n'est pas en cours d'exécution.");
}
}
catch (Exception ex)
{
Console.WriteLine("Une erreur s'est produite : " + ex.Message);
}
finally
{
// Libérer les ressources
if (rsaApp != null)
{
Marshal.FinalReleaseComObject(rsaApp);
}
}
}
}
}
For exemple the script is good and executed but than I cant find the file, may be there is an other method to save it
refer to the “Getting Started Guide Robot API.pdf” in the SDK directory on page 31 for the code in C#
instead of FinalReleaseComObject:
while (Marshal.ReleaseComObject(rsaApp) != 0); rsaApp = null;
Best Regards
Can't find what you're looking for? Ask the community or share your knowledge.