乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 15|回复: 2

[编程交流] Database concepts (Dictionary,

[复制链接]

2

主题

5

帖子

3

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 15:09:01 | 显示全部楼层 |阅读模式
Hello .
 
I don't know am I on the right path here, and
I have a couple of questions.
 
First, the database.
 
I create a "private" dictionary in the main dictionary;
  1. (setq my_dict (entmakex '((0 . "DICTIONARY")((0 . AcDbDictionary))))(setq my_dict (dictadd (namedobjdict) "My Dictionary" my_dict))(setq my_dict (cdr (assoc 5 (entget my_dict))))
In the last line I assoc entity handle with the var
to use with vlax-ldata-*** functions.
 
So now I do next;
(vlax-ldata-put my_dict "My List" list)
 
(my lists are lists of entities obtained with (entget (car (entsel))) lots of them)
 
And now my lists are associated with that entity handle so I can
exit acad, and find my data when I start it again.
 
My lists are retieved with dictsearch and that entity handle.
 
Is this way ok? This is my first question.
(it works fine, but I want to be sure, you know better for sure)
 
My other question.
If the first question answer is yes only.
 
Is it possible to use that saved data from another
drawing?
 
Thats it, thank you for reading and helping and everithing.
My english sucks, it is hard to me to explane, and I can
imagine what is like to understand this for you
Greetings !
 
 
p.s. I have used the search option
but I couldnt find nothing, I am very sorry.
回复

使用道具 举报

2

主题

439

帖子

536

银币

限制会员

铜币
-14
发表于 2022-7-6 16:02:49 | 显示全部楼层
Your fist three lines isn't no need, because vlax-ldata-put creates dictionary and XRecord automatically. Try in command line:
 
  1. Command: (vlax-ldata-put "My Dictionary2" "My List" '(1 2 3 4))(1 2 3 4)
 
Now check the "My Dictionary2" dictionary existance:
 
  1. Command: (entget(namedobjdict))((-1 . ) (0 . "DICTIONARY") (330 . ) (5 . "C") (100 . "AcDbDictionary") (280 . 0) (281 . 1) (3 . "ACAD_COLOR") (350 . ) (3 . "ACAD_GROUP") (350 . ) (3 . "ACAD_IMAGE_DICT") (350 . ) (3 . "ACAD_IMAGE_VARS") (350 . ) (3 . "ACAD_LAYOUT") (350 . ) (3 . "ACAD_MATERIAL") (350 . ) (3 . "ACAD_MLEADERSTYLE") (350 . ) (3 . "ACAD_MLINESTYLE") (350 . ) (3 . "ACAD_PLOTSETTINGS") (350 . ) (3 . "ACAD_PLOTSTYLENAME") (350 . ) (3 . "ACAD_SCALELIST") (350 . ) (3 . "ACAD_TABLESTYLE") (350 . ) (3 . "ACAD_VISUALSTYLE") (350 . )[color="Blue"] (3 . "My Dictionary2") (350 . )[/color])
 
As you can see the dictionary has been automatically added.
 
 
Of course yes. Again in command line. For example you have open Drawing1.dwg with "My Dictionary2" dictionary. Try from another drawing to get documents collection:
 
  1. Command: (setq dCol(vla-get-Documents(vlax-get-acad-object)))#
 
Get object of Drawing1.dwg:
 
  1. Command: (setq cDoc(vla-Item dCol "Drawing1.dwg"))#
 
Get dictionaries collection:
 
  1. Command: (setq dicts(vla-get-Dictionaries cDoc))#
 
Get object of "My Dictionary2" dictionary:
 
  1. Command: (setq di2(vla-Item dicts "My Dictionary2"))#
 
Successfully. Extract first record:
 
  1. Command: (setq cRec(vla-Item di2 0))#
 
Check data inside:
 
  1. Command: (entget(vlax-vla-object->ename cRec))((-1 . ) (0 . "VLO-VL") (5 . "14D") (102 . "{ACAD_REACTORS") (330 . ) (102 . "}") (330 . ) (100 . "vlo_VL") (90 . -64512) (91 . 9) (92 . 0) [color="Blue"](300 . "(1 2 3 4)")[/color])
 
It of course very simplified example without any checkups.
回复

使用道具 举报

2

主题

5

帖子

3

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 16:21:35 | 显示全部楼层
ThankYou Mr.Asmi you are the king
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-4 19:41 , Processed in 0.431737 second(s), 58 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表