明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1894|回复: 5

[求助]跟DWG保存个人数据问题?

[复制链接]
发表于 2010-2-24 09:27:00 | 显示全部楼层 |阅读模式

我想写一个图层分组管理的程序,但我不知道图层分组后的信息如何跟着DWG保存,

在下次打开DWG时还能读取这些分组信息呢,请问各位前辈,这些个人的信息一般

都保存在哪里啊!如何实现呢?请给些参考吧?

发表于 2010-2-24 09:46:00 | 显示全部楼层

放在字典

 楼主| 发表于 2010-2-24 19:19:00 | 显示全部楼层

谢谢!早上就看了版主的答复。

但我对字典不熟,查了一下资料,只找到了给实体加扩展数据的程序片断。

没找到添加命名扩展字典的程序片断,如果版主有添加扩展字典的程序片断,

能否粘一个上来参考一下吗?谢谢!

发表于 2010-2-24 22:18:00 | 显示全部楼层
 楼主| 发表于 2010-2-24 23:08:00 | 显示全部楼层

非常感谢!

我要慢慢研究消化一下。没搞过扩展记录这东西。

 楼主| 发表于 2010-3-4 11:55:00 | 显示全部楼层

实现了一部分功能,不错,下面是扩展记录的部分代码,由于扩展记录分析手段不懂,有些功能没实现。

Try
            Dim NOD As DBDictionary = trans1.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForWrite, False)
            Dim lpDict As DBDictionary
            Try
                lpDict = trans1.GetObject(NOD.GetAt("图层分组"), OpenMode.ForRead)
                Dim dgv As DataGridView() = {DataGridView1, DataGridView2, DataGridView3, DataGridView4, DataGridView5}
                Dim dgvn As Integer
                For j = 0 To li - 1
                    dgvn = 1
                    Dim objxRec As Xrecord
                    Try
                        objxRec = trans1.GetObject(lpDict.GetAt(ltr(j).Name), OpenMode.ForRead)
                        Dim resbuf As TypedValue = objxRec.Data.AsArray(0)
                        dgvn = resbuf.Value
                    Finally
                    End Try
                    With dgv(dgvn - 1)
                        Dim tpa As System.Drawing.Image = tpn
                        Dim tpb As System.Drawing.Image = tpn
                        If ltr(j).IsOff Then
                            tpa = tpc
                        Else
                            tpa = tpo
                        End If
                        If ltr(j).IsLocked Then
                            tpb = tpl
                        Else
                            tpb = tpu
                        End If
                        .Rows.Add(tpa, tpb, ltr(j).Name)
                    End With
                Next
            Catch
                lpDict = New DBDictionary()
                NOD.SetAt("图层分组", lpDict)
                trans1.AddNewlyCreatedDBObject(lpDict, True)

                Dim xRec(li) As Xrecord
                For i = 0 To li - 1
                    xRec(i) = New Xrecord()
                    xRec(i).Data = New ResultBuffer(New TypedValue(DxfCode.Int8, 1))
                    lpDict.SetAt(ltr(i).Name, xRec(i))
                    trans1.AddNewlyCreatedDBObject(xRec(i), True)
                Next

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 20:55 , Processed in 0.177567 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表