SAP2000_API_CHS_C#_GetProjectInfo
时间:2011-04-03 来源:AL小虾
GetProjectInfo
语法
SapObject.SapModel.GetProjectInfo
C#函数
int GetProjectInfo(ref int NumberItems, ref Array Item, ref Array data);
参数
NumberItems:返回工程信息的条数
Item:信息名称
Data:信息内容
备注
该函数用以获取工程信息。成功返回0值,否则返回非0值
C#实例
public void ExampleGetProjectInfo() { //变量定义 int ret; int NumberItems=0; Array Item = Array.CreateInstance(typeof(string), 0); Array Data = Array.CreateInstance(typeof(string), 0); //实例化 Sap2000.SapObject SapObject = new Sap2000.SapObject(); Sap2000.cSapModel SapModel = new Sap2000.cSapModel(); //运行程序 SapObject.ApplicationStart(); //新建模型D ret = SapModel.InitializeNewModel(Sap2000.eUnits.kip_ft_F); //新建空白文档 ret = SapModel.File.NewBlank(); //设置工程信息 ret = SapModel.SetProjectInfo("Company Name", "Computers and Structures, Inc."); ret = SapModel.SetProjectInfo("Project Name", "API Testing"); ret = SapModel.SetProjectInfo("My Item", "My Data"); //获取工程信息 ret = SapModel.GetProjectInfo(ref NumberItems,ref Item, ref Data); //遍历指针显示工程信息 System.Collections.IEnumerator myEnumerator1 = Item.GetEnumerator(); System.Collections.IEnumerator myEnumerator2 = Data.GetEnumerator(); for(int i=0;i<NumberItems;i++){ myEnumerator1.MoveNext(); myEnumerator2.MoveNext(); MessageBox.Show(myEnumerator1.Current.ToString() + ":" + myEnumerator2.Current.ToString()); } //退出程序 SapObject.ApplicationExit(false); SapModel = null; SapObject = null; }
相关阅读 更多 +