ObjectIdToObject引起的CAD崩溃。
本帖最后由 作者 于 2008-7-11 11:30:23 编辑 <br /><br /> <p>这条语句Set Ent = ThisDrawing.ObjectIdToObject(gg.Cells(ii, jj)),能引起系统崩溃,百思不得起解?</p><p>ObjectIDObject读的数据源是</p><p><table cellspacing="0" cellpadding="0" width="402" border="0" style="WIDTH: 303pt; BORDER-COLLAPSE: collapse;"><colgroup><col width="150" style="WIDTH: 113pt; mso-width-source: userset; mso-width-alt: 4800;"></col><col></col><col width="134" style="WIDTH: 101pt; mso-width-source: userset; mso-width-alt: 4288;"></col><col></col><col width="118" style="WIDTH: 89pt; mso-width-source: userset; mso-width-alt: 3776;"></col><col></col></colgroup><tbody><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl24" width="150" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 113pt; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">2127900952</font></td><td class="xl24" width="134" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext; WIDTH: 101pt; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体">2127900960</font></td><td class="xl24" width="118" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext; WIDTH: 89pt; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体">2127900968</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td class="xl24" height="19" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">2127900992</font></td><td class="xl24" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体">2127901776</font></td><td class="xl24" style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent;"><font face="宋体">2127901768</font></td></tr></tbody></table></p><p></p><p>存在问题如下</p><p>1、上表数据获取是从Ent.ObjectID得来,反过来再通过ObjectID来更改其实体属性(如更改文本属性TextString)。可是有的实体读出来后,有实体不存在现象的表述。</p><p>2、解决方法用的是将所有实体copy后册除</p><p>Sub CopyEntityDeleteEntity()<br/> Dim Ent As AcadEntity, Ent1 As AcadEntity<br/> For Each Ent In ThisDrawing.ModelSpace<br/> Set Ent1 = Ent.Copy()<br/> Ent1.Delete<br/> Next Ent <br/>End Sub</p><p>通过ObjectIDObject可得到实体,但也出现了系统崩溃现象。</p><p>3、解决之道,就是将这个文件在文件夹中copy 后,paste重新改名才得以解决。</p><p></p><p></p><p>提示 ObjectIDToOjbect作用于对象ICadDocument失败 error is Run-time error-2147467259(80004005)</p><p>以此为题耗时费力,当网虫,大海捞针。拿本书去肯砖头吧?</p> <p>看来老天爷照顾,没花多少时间,参考了<font color="#008000">discussion.autodesk.com相关内容,基本找到原因。</font></p><p><font color="#008000">不应用</font><font color="#000000">ObjectID而直接用handle </font></p> <p>句柄Handle在图形重新打开后都不会改变,而OjbectID是每次打开图形时都不同。</p>
页:
[1]