Renaming Dynamic Block Visibility States using VBA











up vote
0
down vote

favorite












How can I change or rename visibility states for a dynamic block in AutoCAD using VBA, similar to clicking RENAME in the Visibility State dialog box which appears when issuing the BVSTATE command in the Block Editor?



Thanks so much for your help.










share|improve this question




























    up vote
    0
    down vote

    favorite












    How can I change or rename visibility states for a dynamic block in AutoCAD using VBA, similar to clicking RENAME in the Visibility State dialog box which appears when issuing the BVSTATE command in the Block Editor?



    Thanks so much for your help.










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      How can I change or rename visibility states for a dynamic block in AutoCAD using VBA, similar to clicking RENAME in the Visibility State dialog box which appears when issuing the BVSTATE command in the Block Editor?



      Thanks so much for your help.










      share|improve this question















      How can I change or rename visibility states for a dynamic block in AutoCAD using VBA, similar to clicking RENAME in the Visibility State dialog box which appears when issuing the BVSTATE command in the Block Editor?



      Thanks so much for your help.







      vba autocad






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 9 at 23:19









      Lee Mac

      2,47121035




      2,47121035










      asked Nov 7 at 7:40









      Nghia Chau

      1




      1
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          In short, it is not possible to rename Dynamic Block Visibility States directly using the LISP or VBA API, without resorting to invoking standard AutoCAD commands, for example, using the AutoLISP command function, or sendcommand method.



          Dynamic Block Parameters contained within a block definition are not exposed to the ActiveX object model and therefore cannot be modified using Visual LISP or VBA.



          Such parameters are exposed to Vanilla AutoLISP by examining the DXF data stored within the Extension Dictionary of the BLOCK_RECORD entity, but such data cannot be modified using entmod, nor does it yield any relevant properties following conversion to an equivalent VLA-Object representation.





          For what it's worth, you can access the Dynamic Block Parameter DXF data using the following route through the AutoLISP API:



          First, obtain the BLOCK entity:



          (setq bl (tblobjname "block" "YourBlockName"))


          Then obtain the parent BLOCK_RECORD entity:



          (setq br (cdr (assoc 330 (entget bl))))


          Now obtain the Extension Dictionary from DXF group 360 (additional checks for the presence of "{ACAD_XDICTIONARY" against DXF group 102 should be used in production code):



          (setq d1 (cdr (assoc 360 (entget br))))


          Now search this dictionary for the ACAD_ENHANCEDBLOCK entry:



          (setq d2 (dictsearch d1 "acad_enhancedblock"))


          This will yield the DXF data for the ACAD_EVALUATION_GRAPH entity.



          You can then iterate over the DXF group 360 within the DXF data to obtain the DXF data for each Dynamic Block Parameter found within the block definition, e.g.:



          _$ (foreach dxf d2 (if (= 360 (car dxf)) (print (cdr (assoc 0 (entget (cdr dxf)))))))

          "BLOCKPOLARPARAMETER"
          "BLOCKPOLARGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKPOLARSTRETCHACTION"
          "BLOCKFLIPPARAMETER"
          "BLOCKFLIPGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKFLIPACTION"
          "BLOCKVISIBILITYPARAMETER"
          "BLOCKVISIBILITYGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"





          share|improve this answer





















          • Thanks for your reply. I'll try to do as your instruction.
            – Nghia Chau
            Nov 8 at 1:18











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185237%2frenaming-dynamic-block-visibility-states-using-vba%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          In short, it is not possible to rename Dynamic Block Visibility States directly using the LISP or VBA API, without resorting to invoking standard AutoCAD commands, for example, using the AutoLISP command function, or sendcommand method.



          Dynamic Block Parameters contained within a block definition are not exposed to the ActiveX object model and therefore cannot be modified using Visual LISP or VBA.



          Such parameters are exposed to Vanilla AutoLISP by examining the DXF data stored within the Extension Dictionary of the BLOCK_RECORD entity, but such data cannot be modified using entmod, nor does it yield any relevant properties following conversion to an equivalent VLA-Object representation.





          For what it's worth, you can access the Dynamic Block Parameter DXF data using the following route through the AutoLISP API:



          First, obtain the BLOCK entity:



          (setq bl (tblobjname "block" "YourBlockName"))


          Then obtain the parent BLOCK_RECORD entity:



          (setq br (cdr (assoc 330 (entget bl))))


          Now obtain the Extension Dictionary from DXF group 360 (additional checks for the presence of "{ACAD_XDICTIONARY" against DXF group 102 should be used in production code):



          (setq d1 (cdr (assoc 360 (entget br))))


          Now search this dictionary for the ACAD_ENHANCEDBLOCK entry:



          (setq d2 (dictsearch d1 "acad_enhancedblock"))


          This will yield the DXF data for the ACAD_EVALUATION_GRAPH entity.



          You can then iterate over the DXF group 360 within the DXF data to obtain the DXF data for each Dynamic Block Parameter found within the block definition, e.g.:



          _$ (foreach dxf d2 (if (= 360 (car dxf)) (print (cdr (assoc 0 (entget (cdr dxf)))))))

          "BLOCKPOLARPARAMETER"
          "BLOCKPOLARGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKPOLARSTRETCHACTION"
          "BLOCKFLIPPARAMETER"
          "BLOCKFLIPGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKFLIPACTION"
          "BLOCKVISIBILITYPARAMETER"
          "BLOCKVISIBILITYGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"





          share|improve this answer





















          • Thanks for your reply. I'll try to do as your instruction.
            – Nghia Chau
            Nov 8 at 1:18















          up vote
          0
          down vote













          In short, it is not possible to rename Dynamic Block Visibility States directly using the LISP or VBA API, without resorting to invoking standard AutoCAD commands, for example, using the AutoLISP command function, or sendcommand method.



          Dynamic Block Parameters contained within a block definition are not exposed to the ActiveX object model and therefore cannot be modified using Visual LISP or VBA.



          Such parameters are exposed to Vanilla AutoLISP by examining the DXF data stored within the Extension Dictionary of the BLOCK_RECORD entity, but such data cannot be modified using entmod, nor does it yield any relevant properties following conversion to an equivalent VLA-Object representation.





          For what it's worth, you can access the Dynamic Block Parameter DXF data using the following route through the AutoLISP API:



          First, obtain the BLOCK entity:



          (setq bl (tblobjname "block" "YourBlockName"))


          Then obtain the parent BLOCK_RECORD entity:



          (setq br (cdr (assoc 330 (entget bl))))


          Now obtain the Extension Dictionary from DXF group 360 (additional checks for the presence of "{ACAD_XDICTIONARY" against DXF group 102 should be used in production code):



          (setq d1 (cdr (assoc 360 (entget br))))


          Now search this dictionary for the ACAD_ENHANCEDBLOCK entry:



          (setq d2 (dictsearch d1 "acad_enhancedblock"))


          This will yield the DXF data for the ACAD_EVALUATION_GRAPH entity.



          You can then iterate over the DXF group 360 within the DXF data to obtain the DXF data for each Dynamic Block Parameter found within the block definition, e.g.:



          _$ (foreach dxf d2 (if (= 360 (car dxf)) (print (cdr (assoc 0 (entget (cdr dxf)))))))

          "BLOCKPOLARPARAMETER"
          "BLOCKPOLARGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKPOLARSTRETCHACTION"
          "BLOCKFLIPPARAMETER"
          "BLOCKFLIPGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKFLIPACTION"
          "BLOCKVISIBILITYPARAMETER"
          "BLOCKVISIBILITYGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"





          share|improve this answer





















          • Thanks for your reply. I'll try to do as your instruction.
            – Nghia Chau
            Nov 8 at 1:18













          up vote
          0
          down vote










          up vote
          0
          down vote









          In short, it is not possible to rename Dynamic Block Visibility States directly using the LISP or VBA API, without resorting to invoking standard AutoCAD commands, for example, using the AutoLISP command function, or sendcommand method.



          Dynamic Block Parameters contained within a block definition are not exposed to the ActiveX object model and therefore cannot be modified using Visual LISP or VBA.



          Such parameters are exposed to Vanilla AutoLISP by examining the DXF data stored within the Extension Dictionary of the BLOCK_RECORD entity, but such data cannot be modified using entmod, nor does it yield any relevant properties following conversion to an equivalent VLA-Object representation.





          For what it's worth, you can access the Dynamic Block Parameter DXF data using the following route through the AutoLISP API:



          First, obtain the BLOCK entity:



          (setq bl (tblobjname "block" "YourBlockName"))


          Then obtain the parent BLOCK_RECORD entity:



          (setq br (cdr (assoc 330 (entget bl))))


          Now obtain the Extension Dictionary from DXF group 360 (additional checks for the presence of "{ACAD_XDICTIONARY" against DXF group 102 should be used in production code):



          (setq d1 (cdr (assoc 360 (entget br))))


          Now search this dictionary for the ACAD_ENHANCEDBLOCK entry:



          (setq d2 (dictsearch d1 "acad_enhancedblock"))


          This will yield the DXF data for the ACAD_EVALUATION_GRAPH entity.



          You can then iterate over the DXF group 360 within the DXF data to obtain the DXF data for each Dynamic Block Parameter found within the block definition, e.g.:



          _$ (foreach dxf d2 (if (= 360 (car dxf)) (print (cdr (assoc 0 (entget (cdr dxf)))))))

          "BLOCKPOLARPARAMETER"
          "BLOCKPOLARGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKPOLARSTRETCHACTION"
          "BLOCKFLIPPARAMETER"
          "BLOCKFLIPGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKFLIPACTION"
          "BLOCKVISIBILITYPARAMETER"
          "BLOCKVISIBILITYGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"





          share|improve this answer












          In short, it is not possible to rename Dynamic Block Visibility States directly using the LISP or VBA API, without resorting to invoking standard AutoCAD commands, for example, using the AutoLISP command function, or sendcommand method.



          Dynamic Block Parameters contained within a block definition are not exposed to the ActiveX object model and therefore cannot be modified using Visual LISP or VBA.



          Such parameters are exposed to Vanilla AutoLISP by examining the DXF data stored within the Extension Dictionary of the BLOCK_RECORD entity, but such data cannot be modified using entmod, nor does it yield any relevant properties following conversion to an equivalent VLA-Object representation.





          For what it's worth, you can access the Dynamic Block Parameter DXF data using the following route through the AutoLISP API:



          First, obtain the BLOCK entity:



          (setq bl (tblobjname "block" "YourBlockName"))


          Then obtain the parent BLOCK_RECORD entity:



          (setq br (cdr (assoc 330 (entget bl))))


          Now obtain the Extension Dictionary from DXF group 360 (additional checks for the presence of "{ACAD_XDICTIONARY" against DXF group 102 should be used in production code):



          (setq d1 (cdr (assoc 360 (entget br))))


          Now search this dictionary for the ACAD_ENHANCEDBLOCK entry:



          (setq d2 (dictsearch d1 "acad_enhancedblock"))


          This will yield the DXF data for the ACAD_EVALUATION_GRAPH entity.



          You can then iterate over the DXF group 360 within the DXF data to obtain the DXF data for each Dynamic Block Parameter found within the block definition, e.g.:



          _$ (foreach dxf d2 (if (= 360 (car dxf)) (print (cdr (assoc 0 (entget (cdr dxf)))))))

          "BLOCKPOLARPARAMETER"
          "BLOCKPOLARGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKPOLARSTRETCHACTION"
          "BLOCKFLIPPARAMETER"
          "BLOCKFLIPGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKFLIPACTION"
          "BLOCKVISIBILITYPARAMETER"
          "BLOCKVISIBILITYGRIP"
          "BLOCKGRIPLOCATIONCOMPONENT"
          "BLOCKGRIPLOCATIONCOMPONENT"






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 7 at 18:32









          Lee Mac

          2,47121035




          2,47121035












          • Thanks for your reply. I'll try to do as your instruction.
            – Nghia Chau
            Nov 8 at 1:18


















          • Thanks for your reply. I'll try to do as your instruction.
            – Nghia Chau
            Nov 8 at 1:18
















          Thanks for your reply. I'll try to do as your instruction.
          – Nghia Chau
          Nov 8 at 1:18




          Thanks for your reply. I'll try to do as your instruction.
          – Nghia Chau
          Nov 8 at 1:18


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185237%2frenaming-dynamic-block-visibility-states-using-vba%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          這個網誌中的熱門文章

          Academy of Television Arts & Sciences

          L'Équipe

          FTSE 250 Index