Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Working with non-graphical data (dictionaries)

Hi there,
I wonder if anyone has some experience working with dictionaries and storing non-graphical data in drawings.
I am curious what sort of information can be stored? Is there limitations?
I'm looking at storing the perimeter of parcels of land, non-graphically in the drawings, (ie: Lot number, bearings, distances, curve data, etc).
Any help or tutorials would be greatly appreciated.
Thank you in advance for your help.
--
Phillip 

Comments

  • Short introduction:
    Dictionaries and Xrecords provide a very flexible way to store non-graphical information. The main alternative Xdata (extended entity data) is more limited in that fewer groupcodes are available. Although Xdata does have some specific advantages (ssget filtering for example). There is a third option called Ldata which most AutoCAD users avoid as it creates custom entities and there were some issues with it when AutoCAD 2000 was introduced.
    I have already used the word 'groupcodes'. From this you may conclude that dictionary data is stored in a format that resembles the entity lists that you are no doubt familiar with. You can use over 300 groupcodes in your Xrecords, but each groupcode can only be used for a specific type of data.
    Every drawing has a main dictionary that can be accessed with (namedobjdict) and every entity can have its own extension dictionary. A dictionary can contain Xrecords as well as other dictionaries. So very complex structures are possible.
    When working with dictionaries and Xrecords using 'classic' Lisp, as opposed to Visual Lisp, is more convenient.

    Further reading:
    Lisp Developer Support Package (there are some vle-* functions for dictionaries)
    DXF documentation (use Google).
    http://www.afralisp.net/autolisp/tutorials/dictionaries-and-xrecords.php
    http://www.theswamp.org/index.php?topic=39929.msg452311#msg452311
    http://www.theswamp.org/index.php?topic=5003.0
  • What am I missing? I've got an object and am not able to set xdata?

    Command>  !myMText
    #

       (if (not (tblsearch "APPID" "HASD_AnnotTable"))
            (regapp "HASD_AnnotTable")
        )

        (setq lCodes (list 1000 1000 1000))
        (setq lValues (list "A=" "L=" "R="))

        (vla-SetXData myMText lCodes lValues)
  • got stripped after the # from the message?

    What am I missing? I've got an object and am not able to set xdata?

    Command>  !myMText
    #

       (if (not (tblsearch "APPID" "HASD_AnnotTable"))
            (regapp "HASD_AnnotTable")
        )

        (setq lCodes (list 1000 1000 1000))
        (setq lValues (list "A=" "L=" "R="))

        (vla-SetXData myMText lCodes lValues)
  • VLA-OBJECT IAcadMText 0000000080D37200 ... are the angle brackets causing the text to be stripped?


    What am I missing? I've got an object and am not able to set xdata?

    Command>  !myMText
    #

       (if (not (tblsearch "APPID" "HASD_AnnotTable"))
            (regapp "HASD_AnnotTable")
        )

        (setq lCodes (list 1000 1000 1000))
        (setq lValues (list "A=" "L=" "R="))

        (vla-SetXData myMText lCodes lValues)
  • The Forum software has a problem with pointy brackets. They can be interpreted as belonging to HTML tags.
    I have posted a solution of sorts in the past:
    http://forum.bricsys.com/discussion/19080
    Look for post #8.

    Regarding your Xdata issue. It is easier to use 'Classic' Lisp for Xdata.
    But if you want to go the Visual Lisp route then have a look at this:
    [code](defun _Conv_List_To_Array (lst typ)
      (if lst
        (vlax-safearray-fill
          (vlax-make-safearray typ (cons 0 (1- (length lst))))
          lst
        )
      )
    )

    (setq myMText (vlax-ename->vla-object (car (entsel))))
    (regapp "HASD_AnnotTable") ; No need to check if app is already registered.
    (setq lCodes  (_Conv_List_To_Array (list 1001 1000 1000 1000) vlax-vbinteger))
    (setq lValues (_Conv_List_To_Array (list "HASD_AnnotTable" "A=" "L=" "R=") vlax-vbvariant))
    (vla-setxdata myMText lCodes lValues)[/code]
  • Thanks ...

    I have almost no idea what I'm doing ... dictionaries or xdata? classic or visual lisp? and that's just for these few lines of code ...

    but this works great! Thanks again.

    The Forum software has a problem with pointy brackets. They can be interpreted as belonging to HTML tags.
    I have posted a solution of sorts in the past:
    http://forum.bricsys.com/discussion/19080
    Look for post #8.

    Regarding your Xdata issue. It is easier to use 'Classic' Lisp for Xdata.
    But if you want to go the Visual Lisp route then have a look at this:
    (defun _Conv_List_To_Array (lst typ)  (if lst    (vlax-safearray-fill      (vlax-make-safearray typ (cons 0 (1- (length lst))))      lst    )  ))(setq myMText (vlax-ename->vla-object (car (entsel))))(regapp "HASD_AnnotTable") ; No need to check if app is already registered.(setq lCodes  (_Conv_List_To_Array (list 1001 1000 1000 1000) vlax-vbinteger))(setq lValues (_Conv_List_To_Array (list "HASD_AnnotTable" "A=" "L=" "R=") vlax-vbvariant))(vla-setxdata myMText lCodes lValues)  

Sign In or Register to comment.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam