ggy0648 发表于 2008-9-22 16:59:00

有高手吗?请教autodskmap objectdata

<div class="t_msgfont" id="postmessage_8145">Dim db As Database = New Database(False, True)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;HostApplicationServices.WorkingDatabase = db<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;db.ReadDwgFile(dwgstr, IO.FileShare.ReadWrite, False, Nothing)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim db As Database = HostApplicationServices.WorkingDatabase<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim trans As Transaction = db.TransactionManager.StartTransaction<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim ids As ObjectId()<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim id As ObjectId<br/><br/>For Each id In ids<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Dim mapApp As MapApplication<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;mapApp = HostMapApplicationServices.Application<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim activeProject As Project.ProjectModel = mapApp.ActiveProject<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim tableList As ObjectData.Tables = activeProject.ODTables<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim records As Records<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim record As Record<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim val_1 As MapValue<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim valInt As Integer = 0<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim valDouble As Double = 0.0<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim str As String = Nothing<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim str_list As String = Nothing<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;For Each record In records<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Dim table As ObjectData.Table = tableList("XZQ")<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;records = table.GetObjectTableRecords(0, id, Constants.OpenMode.OpenForRead, True)&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; <br/><br/>next id<br/><br/>为什么用ReadDwgFile读取的文件使用map函数ObjectData.Table失效</div>

小狼 发表于 2008-11-27 18:37:00

我也很想知道怎么样能通过后台方式提取dwg的对象数据

问号兄233 发表于 2017-11-3 13:32:59

小狼 发表于 2008-11-27 18:37
我也很想知道怎么样能通过后台方式提取dwg的对象数据

后台读取dwg你要用到openfiledialog类选取你要后台读取的文件,然后再用db.ReadDwgFile就能获取全部的id了,我比较在意题主的objectdata是如何定义生成的。
页: [1]
查看完整版本: 有高手吗?请教autodskmap objectdata