// Helper function to determine if Robot has an active project open private bool IsRobotActive() { // Initialise connection to Robot if none exists if (!(iapp is RobotApplication)) { iapp = new RobotApplication(); } try { structure = iapp.Project.Structure; nodes = structure.Nodes; bars = structure.Bars; } catch (System.Runtime.InteropServices.COMException) { ErrorDialog("Robot does not appear to be running", "ERROR: Robot not running"); return(false); } if (iapp.Project.IsActive == 0) { ErrorDialog("No active Robot project was found", "ERROR: No active project"); return(false); } return(true); }
public static int AddNode(RobotStructure structureRSA, double x, double y, double z) { RobotNodeServer nodesRSA = structureRSA.Nodes; int freeNum = nodesRSA.FreeNumber; nodesRSA.Create(freeNum, x, y, z); return(freeNum); }
public void test() { RobotApplication appRSA = new RobotApplication(); getMaterialNameListRSA(appRSA); getBarSectionNamesRSA(appRSA); RobotStructure structureRSA = appRSA.Project.Structure; RobotBarServer barsRSA = structureRSA.Bars; RobotNodeServer nodesRSA = structureRSA.Nodes; RobotObjObjectServer objRSA = structureRSA.Objects; RobotLabelServer labelsRSA = appRSA.Project.Structure.Labels; //Определение выборок выделенных в модели объектов RobotSelection barSel = structureRSA.Selections.Get(IRobotObjectType.I_OT_BAR); RobotSelection plateSel = structureRSA.Selections.Get(IRobotObjectType.I_OT_PANEL); RobotSelection holesSel = structureRSA.Selections.Get(IRobotObjectType.I_OT_GEOMETRY); RobotBarCollection barsMany = (RobotBarCollection)barsRSA.GetMany(barSel); RobotObjObjectCollection platesMany = (RobotObjObjectCollection)objRSA.GetMany(plateSel); IRobotBar barRSA = barsMany.Get(3); IRobotObjObject plate = platesMany.Get(1); IRobotLabel labelPlate = plate.GetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS); RobotGeoPoint3DCollection defPoints = (RobotGeoPoint3DCollection)plate.Main.DefPoints; RobotGeoPoint3D pt1 = defPoints.Get(1); RobotGeoPoint3D pt2 = defPoints.Get(2); RobotGeoPoint3D pt3 = defPoints.Get(defPoints.Count); //IRobotGeoContour geoContour=(IRobotGeoContour)plate.Main.Geometry; //IRobotGeoObject geoObj=plate.Main.Geometry; IRobotLabel labelBar = barRSA.GetLabel(IRobotLabelType.I_LT_BAR_SECTION); RobotBarSectionData data = labelBar.Data; RobotBarSectionConcreteData cData = data.Concrete; double b = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_B); double h = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_H); double l1 = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_L1); double l2 = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_L2); double h1 = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_H1); double h2 = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_H2); double de = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_DE); double alfa = barRSA.Gamma; }
/// <summary> /// Extract the straight-line geometry of a Robot bar as a Nucleus line /// </summary> /// <param name="bar">The bar to extract geometry for</param> /// <param name="structureNodes">The full collection of nodes within the structure that contains the bar</param> /// <returns></returns> public static Line GeometryOf(IRobotBar bar, RobotNodeServer structureNodes) { return(new Line(PositionOf(bar.Start, structureNodes), PositionOf(bar.End, structureNodes))); }
/// <summary> /// Extract the position of a Robot bar end as a Nucleus Vector, /// assembled from the position of the end's node and offset vector. /// </summary> /// <param name="barEnd">The bar end to extract the position of</param> /// <param name="structureNodes">The full collection of nodes within the structure that contains the bar</param> /// <returns></returns> public static Vector PositionOf(IRobotBarEnd barEnd, RobotNodeServer structureNodes) { var node = (IRobotNode)structureNodes.Get(barEnd.Node); return(PositionOf(node) + Convert(barEnd.GetOffsetValue())); }