/// <summary> /// 根据“大楼”名称获取相应的图层 /// </summary> public static void GetParkBuild(string buildName) { ShapesDefine shape = new ShapesDefine(); shape = GetParkLayerByName(buildName, false); if (shape.shapelist.Count() > 0) { string xml = shape.toXml(); MyTool.TextReport("GetParkBuild", xml, 700, 500); } }
public static void GetRoomsInfoEx() { DateTime start = DateTime.Now; TopoInfo floor = GetFloorInfoEx(); DateTime end = DateTime.Now; TimeSpan t = end - start; string xml = XmlSerializeHelper.GetXmlText(floor); MyTool.TextReport(floor.Name + "|" + t, xml, 700, 500); }
public static void GetParkInfoEx(string parkName, int maxFloorCount) { DateTime start = DateTime.Now; InitInfo initInfo = CreateInitInfo(parkName, maxFloorCount); DateTime end = DateTime.Now; TimeSpan t = end - start; string xml = XmlSerializeHelper.GetXmlText(initInfo); MyTool.TextReport("获取整个园区", xml, 700, 500); }
public static void GetExtentPoints() { var objId = Interaction.GetEntity("Entity"); CADShape shape = objId.ToCADShape(true); if (shape != null) { string xml = shape.ToXml(); MyTool.TextReport("Points", xml, 700, 500); } else { MyTool.TextReport("Points", "NULL", 700, 500); } }
public static void GetPoint1() { var p = Interaction.GetPoint("Point"); var p2 = p.ToWCS(); var p3 = p2.ToUCS(); string txt = string.Format("P1(Original):{0}\nP2(WCS世界坐标):{1}\nP3(UCS局部坐标):{2}\n", p, p2, p3); var zero = new Point3d(0, 0, 0); var zero_WCS = zero.ToWCS(); var zero_UCS = zero.ToUCS(); txt += string.Format("------\nP1(Original):{0}\nP2(WCS世界坐标):{1}\nP3(UCS局部坐标):{2}", (p - zero), (p2 - zero_WCS), (p3 - zero_UCS)); MyTool.TextReport("PT", txt, 700, 500); }
public static void GetRoomInfo() { DateTime start = DateTime.Now; TopoInfo topoInfo = GetRoomEx(); DateTime end = DateTime.Now; TimeSpan t = end - start; string xml = ""; if (topoInfo != null) { xml = XmlSerializeHelper.GetXmlText(topoInfo, true); } MyTool.TextReport(topoInfo.Name + "|" + t, xml, 700, 500); }
public static void GetShapeInfo() { var id = Interaction.GetEntity("Select:"); var sp = id.ToCADShape(true); //add by qclei 2020-04-29 判断是否是封闭的图形 //bool bl = PulicGadget.ifColseShape(sp); //if (bl) { string name = PulicGadget.getShapeName(sp); if (name != "") { sp.Name = name; } var xml = sp.ToXml(); MyTool.TextReport("ShapeInfo", xml, 700, 500); } }
/// <summary> /// 手动获取多个“多边型”图形 /// </summary> public static void GetAllShapeByManual() { ShapesDefine shape = new ShapesDefine(); int iCount = 1; while (true) { string sel = string.Format("Select {0} :", iCount.ToString()); var id = Interaction.GetEntity(sel); if (id.Handle.Value != 0) { var sp = id.ToCADShape(true); //add by qclei 2020-04-29 判断是否是封闭的图形 //bool bl = PulicGadget.ifColseShape(sp); //if (bl) { string name = PulicGadget.getShapeName(sp); if (name != "") { sp.Name = name; } shape.addShape(sp); iCount++; } } else { break; } } if (shape.shapelist.Count() > 0) { string xml = shape.toXml(); MyTool.TextReport("ShapeInfos", xml, 700, 500); } }
public static void GetInitInfo() { DateTime start = DateTime.Now; string txt = Interaction.GetString("输入园区名称"); if (string.IsNullOrEmpty(txt)) { txt = "园区"; } TopoInfo floor = GetFloorInfo(); InitInfo initInfo = CreateParkInitInfoByFloors(txt, "大楼1", floor); DateTime end = DateTime.Now; TimeSpan t = end - start; string xml = XmlSerializeHelper.GetXmlText(initInfo); MyTool.TextReport(floor.Name + "|" + t, xml, 700, 500); }
public static void GetOneFloorWithRoot(string floorLayer, string parkName) { DateTime start = DateTime.Now; TopoInfo floor = GetOneFloorOpt(floorLayer); string xml = ""; if (!string.IsNullOrEmpty(parkName)) { InitInfo initInfo = GetRoomsCommand.CreateParkInitInfoByFloors(parkName, floorLayer, floor); xml = XmlSerializeHelper.GetXmlText(initInfo); MyTool.TextReport("获取一个楼层和园区", xml, 700, 500); } else { xml = XmlSerializeHelper.GetXmlText(floor, true); MyTool.TextReport("获取一个楼层", xml, 700, 500); } DateTime end = DateTime.Now; TimeSpan t = end - start; }
/// <summary> /// Thickness:厚度,层高 /// IsRelative="true" /// BottomHeight:离地面高度,0层为0,6.5层为:6500 /// </summary> /// <param name="name"></param> //获取楼层内的房间 //add by qclei 2020-07-10 public static void GetAllFloors(string buildingName, int buildingFloorCount, string parkName) { DateTime start = DateTime.Now; List <TopoInfo> floors = GetFloorList(buildingName, buildingFloorCount); string xml = ""; if (!string.IsNullOrEmpty(parkName)) { InitInfo initInfo = GetRoomsCommand.CreateParkInitInfoByFloors(parkName, buildingName, floors.ToArray()); xml = XmlSerializeHelper.GetXmlText(initInfo); MyTool.TextReport("获取整个大楼和园区", xml, 700, 500); } else { TopoInfo initInfo = GetRoomsCommand.CreateBuildingInitInfoByFloors(buildingName, floors.ToArray()); xml = XmlSerializeHelper.GetXmlText(initInfo, true); MyTool.TextReport("获取整个大楼", xml, 700, 500); } DateTime end = DateTime.Now; TimeSpan t = end - start; }
public static void TestTextReport() { MyTool.TextReport("title", "content", 200, 300, false); }
public static void GetAnchors() { try { var zero = Interaction.GetPoint("选择原点"); //string[] keys = { "1F", "2F", "3F", "4F" }; //var key = Interaction.GetKeywords("\n选择楼层", keys); var anchorObjects = Interaction.GetEntitysByLayers("-人员定位"); CADShapeList sps = new CADShapeList(); for (int i = 0; i < anchorObjects.Length; i++) { ObjectId item = anchorObjects[i]; var sp = item.ToCADShape(true); sps.Add(sp); Interaction.WriteLine(string.Format("{0}({1}/{2})", sp, i + 1, anchorObjects.Length)); } var types = sps.GetTypesEx(); string typesText = ""; foreach (var item in types) { typesText += item.Key + ","; } Interaction.Write("Types:" + typesText); //var circleList = types["Circle"]; //var zeroCircle = circleList[0]; //var zeroP = zeroCircle.GetPoint(); var pZero = zero.ToCADPoint(false);//获取的坐标原本就是用户坐标系的 foreach (CADShape sp in sps) { sp.SetZero(pZero); } CADShapeList anchorList = new CADShapeList(); if (types.ContainsKey("BlockReference")) { anchorList = types["BlockReference"]; } CADShapeList textList = new CADShapeList(); if (types.ContainsKey("MText")) { textList.AddRange(types["MText"]); } if (types.ContainsKey("DBText")) { textList.AddRange(types["DBText"]); } CADAnchorList result = new CADAnchorList(); List <string> names = new List <string>(); CADShapeList usedText = new CADShapeList(); string repeatNames = ""; for (int i = 0; i < anchorList.Count; i++) { var anchor = anchorList[i]; var text = textList.FindCloset(anchor); if (text != null) { //if (text.Text.Contains(key)) { anchor.Text = text.Text; anchor.Name = text.Text; result.Anchors.Add(anchor); if (!names.Contains(anchor.Name)) { names.Add(anchor.Name); } else { repeatNames += anchor.Name + ";"; } usedText.Add(text); } } } string noUseNames = ""; foreach (var item in textList) { if (!usedText.Contains(item)) { noUseNames += item.Text + ";"; } } result.Anchors.Sort(); for (int i = 0; i < result.Anchors.Count; i++) { result.Anchors[i].Num = i + 1; } if (repeatNames != "") { MyTool.TextReport("重复基站", repeatNames, 700, 500); } if (noUseNames != "") { MyTool.TextReport("遗漏基站", noUseNames, 700, 500); } var txt = result.ToXml(); MyTool.TextReport("Anchors", txt, 700, 500); } catch (System.Exception ex) { MyTool.TextReport("Exception", ex.ToString(), 700, 500); } }
public static void NewUCS() { MyTool.NewUCS(); }
public static void SetUCS2WCS() { MyTool.SetUCS2WCS(); }
public static void GetUCS() { var ucs = MyTool.GetUCS(); Interaction.WriteLine("Origin:" + ucs.Origin); }