parent
d63983fa43
commit
736b6ff2f8
|
|
@ -41,9 +41,21 @@ namespace PutTowerPosition
|
|||
public string towerName;
|
||||
}
|
||||
|
||||
struct Tower
|
||||
{
|
||||
public ObjectId point;
|
||||
public ObjectId name;
|
||||
}
|
||||
|
||||
private static List<Tower> latestTowerList = null;//记录最近一次加点的ID。
|
||||
|
||||
[CommandMethod("ptp", CommandFlags.Session)]
|
||||
public static void PutTowerPositionCmd()
|
||||
{
|
||||
if (latestTowerList == null)
|
||||
{
|
||||
latestTowerList = new List<Tower>();
|
||||
}
|
||||
Gui gui = new Gui();
|
||||
gui.Show();
|
||||
}
|
||||
|
|
@ -74,7 +86,19 @@ namespace PutTowerPosition
|
|||
acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
|
||||
|
||||
OpenMode.ForWrite) as BlockTableRecord;
|
||||
|
||||
//先删除最后一次的塔位
|
||||
if (latestTowerList != null)
|
||||
{
|
||||
foreach(Tower tower in latestTowerList)
|
||||
{
|
||||
DBText latestTowerName = acTrans.GetObject(tower.name, OpenMode.ForWrite) as DBText;
|
||||
DBPoint latestTowerPoint = acTrans.GetObject(tower.point, OpenMode.ForWrite) as DBPoint;
|
||||
latestTowerName.Erase();
|
||||
latestTowerPoint.Erase();
|
||||
}
|
||||
latestTowerList.Clear();
|
||||
|
||||
}
|
||||
Position[] cordinationList = calTowerXYPostion(cordDic, spanList);
|
||||
foreach (Position point in cordinationList)
|
||||
{
|
||||
|
|
@ -92,6 +116,10 @@ namespace PutTowerPosition
|
|||
dbTowerName.Height = 40;
|
||||
acBlkTblRec.AppendEntity(dbTowerName);
|
||||
acTrans.AddNewlyCreatedDBObject(dbTowerName,true);
|
||||
Tower latestTower;
|
||||
latestTower.name = dbTowerName.ObjectId;
|
||||
latestTower.point = dbPoint.ObjectId;
|
||||
latestTowerList.Add(latestTower);
|
||||
}
|
||||
acTrans.Commit();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue