CAD/CAM discussion forum > CAD > Custom Drawing properties lisp problem

Custom Drawing properties lisp problem

    
  Subscribe Topic

Rank: 1

OldForumPost

Newbie

posts: 0

Registered: 2012-1-14

Message 1 of 2

03-02-2011 04:37 . am   |   View his/her posts only




welcome everyone

i wrote something like this to add/get/remove custom drawing properties, but it seams it doesn;t work:

  1. <font color="#990099">; ============================================================ ;</font>
  2. <font color="#990099">; Add drawing custom properties ;</font>
  3. <font color="#990099">; Key [STR> - custom properties name ;</font>
  4. <font color="#990099">; Value [STR> - custom properties value ;</font>
  5. <font color="#990099">; Mode [BOOL> - nil = do not update existing key ;</font>
  6. <font color="#990099">; T = update existing key ;</font>
  7. <font color="#990099">; ============================================================ ;</font>
  8. <font color="RED">(</font><font color="BLUE">defun</font> kr:DWG_AddCustomProperties <font color="RED">(</font>Key Value Mode <font color="BLUE">/</font> SI<font color="RED">)</font>
  9. <font color="RED">(</font><font color="BLUE">setq</font> SI
  10. <font color="RED">(</font><font color="BLUE">vla-get-SummaryInfo</font>
  11. <font color="RED">(</font><font color="BLUE">vla-get-ActiveDocument</font>
  12. <font color="RED">(</font><font color="BLUE">vlax-get-acad-object</font><font color="RED">)</font>
  13. <font color="RED">)</font>
  14. <font color="RED">)</font>
  15. <font color="RED">)</font>
  16. <font color="RED">(</font><font color="BLUE">if</font> <font color="RED">(</font><font color="BLUE">member</font> Key <font color="RED">(</font><font color="BLUE">mapcar</font> <font color="DARKRED">'</font><font color="BLUE">car</font> <font color="RED">(</font>kr:DWG_GetCustomProperties<font color="RED">)))</font>
  17. <font color="RED">(</font><font color="BLUE">if</font> Mode <font color="RED">(</font><font color="BLUE">vla-SetCustomByKey</font> SI Key Value<font color="RED">))</font>
  18. <font color="RED">(</font><font color="BLUE">vla-AddCustomInfo</font> SI Key Value<font color="RED">)</font>
  19. <font color="RED">)</font>
  20. <font color="RED">)</font>
  21. <font color="#990099">; ============================================================ ;</font>
  22. <font color="#990099">; Get drawing custom properties ;</font>
  23. <font color="#990099">; ============================================================ ;</font>
  24. <font color="RED">(</font><font color="BLUE">defun</font> kr:DWG_GetCustomProperties <font color="RED">(</font><font color="BLUE">/</font> SI C K V LST<font color="RED">)</font>
  25. <font color="RED">(</font><font color="BLUE">setq</font> SI
  26. <font color="RED">(</font><font color="BLUE">vla-get-SummaryInfo</font>
  27. <font color="RED">(</font><font color="BLUE">vla-get-ActiveDocument</font>
  28. <font color="RED">(</font><font color="BLUE">vlax-get-acad-object</font><font color="RED">)</font>
  29. <font color="RED">)</font>
  30. <font color="RED">)</font>
  31. C <font color="RED">(</font><font color="BLUE">vla-NumCustomInfo</font> SI<font color="RED">)</font>
  32. <font color="RED">)</font>
  33. <font color="RED">(</font><font color="BLUE">while</font> <font color="RED">(</font><font color="BLUE">></font> C <font color="#009900">0</font><font color="RED">)</font>
  34. <font color="RED">(</font><font color="BLUE">vla-GetCustomByIndex</font> SI <font color="RED">(</font><font color="BLUE">-</font> C <font color="#009900">1</font><font color="RED">)</font> <font color="DARKRED">'</font>K <font color="DARKRED">'</font>V<font color="RED">)</font>
  35. <font color="RED">(</font><font color="BLUE">setq</font> LST <font color="RED">(</font><font color="BLUE">cons</font> <font color="RED">(</font><font color="BLUE">cons</font> K V<font color="RED">)</font> LST<font color="RED">)</font>
  36. C <font color="RED">(</font><font color="BLUE">1-</font> C<font color="RED">)</font>
  37. <font color="RED">)</font>
  38. <font color="RED">)</font>
  39. LST
  40. <font color="RED">)</font>
  41. <font color="#990099">; ============================================================ ;</font>
  42. <font color="#990099">; Remove drawing custom properties ;</font>
  43. <font color="#990099">; Mode - list of custom properties name to remove ;</font>
  44. <font color="#990099">; T = remove all ;</font>
  45. <font color="#990099">; ============================================================ ;</font>
  46. <font color="RED">(</font><font color="BLUE">defun</font> kr:DWG_RemoveCustomProperties <font color="RED">(</font>Mode <font color="BLUE">/</font> SI<font color="RED">)</font>
  47. <font color="RED">(</font><font color="BLUE">setq</font> SI
  48. <font color="RED">(</font><font color="BLUE">vla-get-SummaryInfo</font>
  49. <font color="RED">(</font><font color="BLUE">vla-get-ActiveDocument</font>
  50. <font color="RED">(</font><font color="BLUE">vlax-get-acad-object</font><font color="RED">)</font>
  51. <font color="RED">)</font>
  52. <font color="RED">)</font>
  53. <font color="RED">)</font>
  54. <font color="RED">(</font><font color="BLUE">if</font> <font color="RED">(</font><font color="BLUE">listp</font> Mode<font color="RED">)</font>
  55. <font color="RED">(</font><font color="BLUE">foreach</font> % Mode
  56. <font color="RED">(</font><font color="BLUE">vl-catch-all-apply</font>
  57. <font color="DARKRED">'</font><font color="BLUE">vla-RemoveCustomByKey</font>
  58. <font color="RED">(</font><font color="BLUE">list</font> SI %<font color="RED">)</font>
  59. <font color="RED">)</font>
  60. <font color="RED">)</font>
  61. <font color="RED">(</font><font color="BLUE">foreach</font> % <font color="RED">(</font><font color="BLUE">mapcar</font> <font color="DARKRED">'</font><font color="BLUE">car</font> <font color="RED">(</font>kr:DWG_GetCustomProperties<font color="RED">))</font>
  62. <font color="RED">(</font><font color="BLUE">vla-RemoveCustomByKey</font> SI %<font color="RED">)</font>
  63. <font color="RED">)</font>
  64. <font color="RED">)</font>
  65. <font color="RED">)</font>
Copy Code

for example there is an error when i try to run: (kr:DWG_GetCustomProperties). it is zwcad bug?

thanks
jason

jason2011-02-05 16:01:49

Rank: 1

OldForumPost

Newbie

posts: 0

Registered: 2012-1-14

Message 2 of 2

 Custom Drawing properties lisp problem
08-02-2011 09:55 . pm   |   View his/her posts only
Dear Jason,

Thanks for your feedback, we have confirmed it is a bug in ZWCAD, that VLA-GETCUSTOMBYINDEX function is not working. We have sent this problem to developer team and will solve it asap.

Any further update about this, we will let you know.
See also
X