- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I wrote code in c# and I stucked.I pointed in text. Please help me
1) loads on cladding this doesn't add load to the list (on cladding 5 and 6 )
when I open tables/Loads there is PZ= -66 , List is an empty
2) doesn't show Table/ bars
3) shows error when debugging
4) error
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using RobotOM;
namespace RobotQ
{
public partial class Form1 : Form
{
private IRobotApplication robApp;
private RobotProjectPreferences ProjectPrefs;
private RobotMeshParams MeshParams;
private IRobotStructure structure;
private RobotLabelServer labels;
private IRobotLabel label;
private RobotSelection SelectionNodes;
private RobotNodeSupportData footData;
private IRobotView robotview;
private IRobotBar bar;
private IRobotLabel Section;
private IRobotBarSectionData SData;
private int TypKod;
private IRobotCladdingData clad;
private RobotSelection kontur;
private RobotLoadRecord LoadRecord;
private RobotSimpleCase caseSW, DachStale;
private RobotSimpleCase SniegLewa, SniegPrawa;
private RobotSimpleCase WiatrLewa, WiatrPrawa, WiatrWzdluz, WiatrWzdluzTyl;
private RobotSimpleCase Techn;
private RobotMaterialData Material;
private RobotObjObject slab;
private RobotPointsArray points;
private int ObjNumber;
private IRobotBarCableData kabel;
private RobotSelection iselKabelSciana;
double odHalaSzer; double odHalaWys; double odRozPolacH;
double aDachKat; double aDachKatD;
private double x; private double y;
private string filepath01 = "d:\\test2011.rtd";
private string filepath02 = "d:\\test03_2011.rtd";
private string excelpath = "e:\\nauka robot c#\\Lublin\\test03_2011.xlsx";
private string Stalklasa = "S 355";
private string StalNosna = "S 235";
private string Stal2rzedna = "S 235";
private string StrSlup = "HEA 280"; // nazwy z odstępem
private string StrRygiel = "HEA 280";
private string StrSlupBrama = "RK 140x140x5";
private string StrScianaSrodek = "UPE 120";
private string StrUsztywn = "HEA 100";
private string StrPolac = "RK 140x140x5";
private double odSlupBrama = 1.0;
private double odBramaLuka = 0.5;
private double odBramaDol = 0;
private double odBramaSzer = 4;
private double odBramaWys = 5;
private double odHalaWysSlup = 5.5;
private double odHalaRozstawSlup = 5.5;
private double odKalenica = 1.75;
private double odOdsPolac = 0.1;
private int odLiczbaHal = 5;
private int liczbaPlatwi = 4;
private int liczbaRygliScn = 4;
private double odRygielScnG = 0.3;
private double obcGpdk = 66;
private double obcSniegL = 1152; // N/m
private double obcSniegP = 1283;
private double obcWtrPlcN = 486;
private double obcWtrPlcZ = 216;
private double obcWtrScnN = 378;
private double obcWtrScnZ = 216;
private double obcWzdluzWtrPlc = 270;
private double obcWzdluzWtrScn = 270;
private double obcWzdluzWtrScnP = 378;
private double obcWzdluzWtrScnT = 162;
private double obcTechn = 100;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
SetRobot();
}
catch
{
MessageBox.Show("Error during initialization");
}
}
private void SetRobot()
{
robApp = new RobotApplicationClass();
// if Robot is not visible
if (robApp.Visible == 0) // robApp.Visible = -1
{
robApp.Interactive = 1; // set robot visible and allow user interaction
robApp.Visible = 1;
}
robApp.Project.New(IRobotProjectType.I_PT_FRAME_3D);
x = 0; y = 0;
odHalaSzer = 2 * (odSlupBrama + odBramaSzer) + odBramaLuka;
odRozPolacH = (0.5 * odHalaSzer) / (liczbaPlatwi - 1);
// aDachKat = Math.Atan(aDachNach * 0.01); //radiany
aDachKat = Math.Atan(odKalenica / (0.5 * odHalaSzer)); //radiany
aDachKatD = (aDachKat * 180) / Math.PI;
odHalaWys = odHalaWysSlup + 0.5 * odHalaSzer * Math.Tan(aDachKat);
points.SetSize(5); // lewa polac
points.Set(1, x, y, odHalaWysSlup);
points.Set(2, x + 0.5 * odHalaSzer, y, odHalaWys);
points.Set(3, x + 0.5 * odHalaSzer, y + (odLiczbaHal - 1) * odHalaRozstawSlup, odHalaWys);
points.Set(4, x, y + (odLiczbaHal - 1) * odHalaRozstawSlup, odHalaWysSlup);
points.Set(5, x, y, odHalaWysSlup);
ObjNumber = 5;
structure.Objects.CreateContour(ObjNumber, points);
points.SetSize(5); // prawa polac
points.Set(1, x + odHalaSzer, y, odHalaWysSlup);
points.Set(2, x + 0.5 * odHalaSzer, y, odHalaWys);
points.Set(3, x + 0.5 * odHalaSzer, y + (odLiczbaHal - 1) * odHalaRozstawSlup, odHalaWys);
points.Set(4, x + odHalaSzer, y + (odLiczbaHal - 1) * odHalaRozstawSlup, odHalaWysSlup);
points.Set(5, x + odHalaSzer, y, odHalaWysSlup);
ObjNumber = 6;
structure.Objects.CreateContour(ObjNumber, points);
Section = structure.Labels.Create(IRobotLabelType.I_LT_CLADDING, "koperta");
kontur = robApp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_GEOMETRY);
clad = (IRobotCladdingData)Section.Data;
clad.Method = IRobotCladdingMethod.I_CM_TRAPEZOIDAL;
clad.Type = IRobotCladdingType.I_CT_X;
robApp.Project.Structure.Labels.Store(Section);
kontur.AddOne(1);
structure.Objects.SetStructuralType(Convert.ToString(kontur), IRobotObjectStructuralType.I_OST_WALL);
structure.Objects.SetLabel(kontur, IRobotLabelType.I_LT_CLADDING, "koperta");
DachStale = structure.Cases.CreateSimple(2, "DachStale", IRobotCaseNature.I_CN_PERMANENT,
IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR);
int UniformDach = DachStale.Records.New(IRobotLoadRecordType.I_LRT_UNIFORM);
LoadRecord = (RobotLoadRecord)DachStale.Records.Get(UniformDach);
// 1
// this doesn't add load to the list (on cladding 5 and 6 )
// when I open tables/Loads there is PZ= -66 , List is an empty
LoadRecord.SetValue(Convert.ToInt16(IRobotUniformRecordValues.I_URV_PX), 0);
LoadRecord.SetValue(Convert.ToInt16(IRobotUniformRecordValues.I_URV_PY), 0);
LoadRecord.SetValue(Convert.ToInt16(IRobotUniformRecordValues.I_URV_PZ), -obcGpdk);
LoadRecord.Objects.AddOne(5); LoadRecord.Objects.AddOne(6);
// 2
RobotTable Rtable;
RobotTableScreenCaptureParams ScPar;
ScPar = (RobotTableScreenCaptureParams)robApp.CmpntFactory.Create(IRobotComponentType.I_CT_TABLE_SCREEN_CAPTURE_PARAMS);
ScPar.Name = "Rtable";
Rtable = robApp.Project.ViewMngr.CreateTable(IRobotTableType.I_TT_BARS, IRobotTableDataType.I_TDT_BAR);
Rtable.MakeScreenCapture(ScPar);
// robApp.Project.ViewMngr.NewViewAsTab
// 3
// RobotNamesArray mtAll = robApp.Project.Preferences.Materials.Get(IRobotMaterialType.I_MT_ALL);
/* // 4 it doesn't work
IRobotUnitComplexData udm = (IRobotUnitComplexData)robApp.Project.Preferences.Units.Get(IRobotUnitType.I_UT_MOMENT);
udm.Name = "N";
udm.Name2 = "m";
robApp.Project.Preferences.Units.Set(IRobotUnitType.I_UT_MOMENT, (IRobotUnitComplexData)udm);
RobotUnitData test;
test.Precision = 4;
test.Name = "MN";
robApp.Project.Preferences.Units.Set(IRobotUnitType.I_UT_FORCE, test);
*/
}
}
}
Solved! Go to Solution.
