你好
我从pipenetwork请求数据几乎没有问题,尤其是对于没有构造函数的Network类。但是我应该如何获得它们的对象。
- [CommandMethod("infra_pipeProp")]
- public void PipeProp()
- {
- CivilDocument doc = CivilApplication.ActiveDocument;
- Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
-
- // Ask the user to select a Pipeline
- PromptEntityOptions opt = new PromptEntityOptions("\nSelect a pipe");
- opt.SetRejectMessage("\nObject must be a pipeline.");
- opt.AddAllowedClass(typeof(Pipe), false);
- PromptEntityResult res = ed.GetEntity(opt);
- if (res.Status != PromptStatus.OK) return;
- Database db = Application.DocumentManager.MdiActiveDocument.Database;
- using (Transaction ts = db.TransactionManager.StartTransaction())
- {
- // Get PartDataRecord for first pipe in the network
- Network oNetwork = new Network();
- ObjectId pipeId = oNetwork.GetPipeIds()[0];
- Pipe oPipe = ts.GetObject(pipeId, OpenMode.ForRead) as Pipe;
- PartDataField[] oDataFields = oPipe.PartData.GetAllDataFields();
- ed.WriteMessage("Additional info for pipe: {0}\n", oPipe.Name);
- foreach (PartDataField oPartDataField in oDataFields)
- {
- ed.WriteMessage("Name: {0}, Description: {1}, DataType: {2}, Value: {3}\n",
- oPartDataField.Name,
- oPartDataField.Description,
- oPartDataField.DataType,
- oPartDataField.Value);
- }
- }
- }
本帖以下内容被隐藏保护;需要你回复后,才能看到! 游客,如果您要查看本帖隐藏内容请 回复 |