乐筑天下

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

[编程交流] Xrecord不';t创建

[复制链接]

44

主题

139

帖子

95

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
221
发表于 2022-7-5 18:44:22 | 显示全部楼层 |阅读模式
大家好,很高兴再次见到你们!
 
我在创建这个xrecord时遇到了一个问题:
 
  1. (setq anXrec (entmakex '((0 . "XRECORD")
  2.                                (100 . "AcDbXrecord")
  3.                                (300 . posizione)
  4.                         (301 . altezza)
  5.                                (302 . larghezza)
  6.                         (303 . colore_cordolo)
  7.                          
  8.                         (280 . n_superiore)
  9.                         (281 . phi_superiore)
  10.                          
  11.                                (282 . n_inferiore)
  12.                         (283 . phi_inferiore)
  13.                          
  14.                                (284 . phi_staffa)
  15.                         (285 . passo_staffa)
  16.                         (286 . n_legature)
  17.                        
  18.                                )
  19.                     )
  20.        )

 

                               
登录/注册后可看大图

 
数据应该是一致的,对吗?也许entmake不接受这种类型的sytax。。有人能给我一个建议吗?
 
谢谢
丹尼斯
回复

使用道具 举报

44

主题

139

帖子

95

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
221
发表于 2022-7-5 19:13:39 | 显示全部楼层
我正在尝试使用(缺点)计算表达式,但我得到一个错误
 
这是完整的脚本:
  1. (defun c:cordoli/cordoli/aggiungi_cordolo#OnClicked (/)
  2. (dcl-ComboBox-AddString cordoli/cordoli/n_tipo_cordoli (dcl-Control-GetText cordoli/cordoli/nome))
  3. (setq nome (dcl-Control-GetText cordoli/cordoli/nome)
  4. posizione (dcl-Control-GetText cordoli/cordoli/posizione)
  5.    altezza (dcl-Control-GetText cordoli/cordoli/altezza)
  6.      larghezza (dcl-Control-GetText cordoli/cordoli/larghezza)
  7. ;;COLORE
  8.      colore_cordolo (dcl-Control-GetText cordoli/cordoli/colore_cordolo)
  9. estensione (dcl-Control-GetText cordoli/cordoli/estensione)
  10.      
  11.      
  12.      n_superiore (atoi (dcl-Control-GetText cordoli/cordoli/n_superiore))
  13.      phi_superiore (atoi (dcl-Control-GetText cordoli/cordoli/phi_superiore))
  14.      n_inferiore (atoi (dcl-Control-GetText cordoli/cordoli/n_inferiore))
  15.      phi_inferiore (atoi (dcl-Control-GetText cordoli/cordoli/phi_inferiore))
  16.      phi_staffa (atoi (dcl-Control-GetText cordoli/cordoli/phi_staffa))
  17.      passo_staffa (atoi (dcl-Control-GetText cordoli/cordoli/passo_staffa))
  18.      
  19.      n_legature (atoi (dcl-Control-GetText cordoli/cordoli/n_legature))
  20.      
  21.      )
  22. (get-or-make-Xrecord nome)
  23. );this sets the variables
  24. ;//////////////////////////////
  25. (defun get-or-create-Dict (/ adict)
  26. ;;test if "Cordoli" is already present in the main dictionary
  27. (if (not (setq adict (dictsearch (namedobjdict) "Cordoli")))
  28.    ;;if not present then create a new one and set the main
  29.    ;; dictionary as owner
  30.    (progn
  31.      (setq adict (entmakex '((0 . "DICTIONARY")(100 . "AcDbDictionary"))))
  32.      ;;if succesfully created, add it to the main dictionary
  33.      (if adict (setq adict (dictadd (namedobjdict) "Cordoli" adict)))
  34.    )
  35.    ;;if present then just return its entity name
  36.    (setq adict (cdr (assoc -1 adict)))
  37. )
  38. )
  39. (defun get-or-make-Xrecord ( nome / adict anXrec nome)
  40. (cond
  41.    ;;first get our dictionary. Notice that "Cordoli" will be
  42.    ;;created here in case it doesn't exist
  43.    ((setq adict (get-or-create-Dict))
  44.     (cond
  45.       ;;if "Cordoli" is now valid then look for "Cordoli" Xrecord
  46.       ((not (setq anXrec (dictsearch adict nome)))
  47.        ;;if "Cordoli" was not found then create it
  48.        (setq anXrec (entmakex '((0 . "XRECORD")
  49.                                (100 . "AcDbXrecord")
  50.                         (cons 300 posizione)
  51.                         (cons 301 altezza)
  52.                                (cons 302  larghezza)
  53.                         (cons 303  colore_cordolo)
  54.                          
  55.                         (cons 280  n_superiore)
  56.                         (cons 281  phi_superiore)
  57.                          
  58.                                (cons 282  n_inferiore)
  59.                         (cons 283  phi_inferiore)
  60.                          
  61.                                (cons 284  phi_staffa)
  62.                         (cons 285  passo_staffa)
  63.                         (cons 286  n_legature)                       
  64.                                )
  65.                     )
  66.        )
  67.        ;;if creation succeeded then add it to our dictionary
  68.        (if anXrec (setq anXrec (dictadd adict nome anXrec)))
  69.       )
  70.       ;;if it's already present then just return its entity name
  71.       (setq anXrec
  72.        (cdr (assoc -1 (dictsearch adict nome)))
  73.       )
  74.     )
  75.    )
  76. )
  77. )

 
谢谢
回复

使用道具 举报

0

主题

301

帖子

301

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-5 19:35:47 | 显示全部楼层
您需要cons包含变量的行
 
  1. (setq anXrec (entmakex (list   '(0 . "XRECORD")
  2.                               '(100 . "AcDbXrecord")
  3.                                (cons 300 posizione)
  4.                         (cons 301  altezza)
  5.                                (cons 302  larghezza)
  6.                         (cons 303  colore_cordolo)
  7.                          
  8.                         (cons 280  n_superiore)
  9.                         (cons 281  phi_superiore)
  10.                          
  11.                                (cons 282  n_inferiore)
  12.                         (cons 283  phi_inferiore)
  13.                          
  14.                                (cons 284  phi_staffa)
  15.                         (cons 285  passo_staffa)
  16.                         (cons 286  n_legature)
  17.                        
  18.                                )
  19.                     )
  20.        )
回复

使用道具 举报

44

主题

139

帖子

95

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
221
发表于 2022-7-5 19:53:35 | 显示全部楼层
非常感谢你!它起作用了!
 
如何删除xrecord?改变它的价值观?
 
谢谢
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 13:53 , Processed in 0.850850 second(s), 64 queries .

© 2020-2025 乐筑天下

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