Results 1 to 5 of 5

Thread: Include information on an entity of a drawing in autocad

  1. #1
    Member
    Join Date
    2012-05
    Location
    Brasil
    Posts
    6

    Default Include information on an entity of a drawing in autocad

    Hi Guys,


    I'm having trouble include information on an entity of a drawing in AutoCAD.




    I have a dictionary of an entity ...

    ((-1 . <Entity name: 7ffffa49c40>) (0 . "LWPOLYLINE") (330 . <Entity name: 7ffffa3b9f0>) (5 . "110CC") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbPolyline") (90 . 4) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 -112.829 648.874) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 25.6359 648.874) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 197.659 497.202) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 1395.96 497.202) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0))

    I would like to include some information, (88. "LAND")




    I was reading over some functions such as "DICTADD" but i did not ...


    Has anyone done this??

    thank you!!!

    Edmar Cristiano dos Santos
    http://www.augi.com/profile/ed_cristian/
    edamicus@gmail.com

  2. #2
    I could stop if I wanted to pbejse's Avatar
    Join Date
    2010-10
    Posts
    398

    Default Re: Include information on an entity of a drawing in autocad

    Are you wanting to add "information" on individual entities? I suggest you use Extended Entity Data (XData) rather than dictionaries.

    Read about it at
    http://www.afralisp.net/autolisp/tut...ata-part-1.php
    http://www.afralisp.net/autolisp/tut...d-xrecords.php

    For the meantime here's an example for you:

    Code:
    (defun c:OXDSample (/ Add_XData Read_XData obj OData ofd)
    ;;;	Xdata Function by  ASMI		;;;
    (defun  Add_XData (Ent                  ; - Entity Ename 
                    App                     ; - Application name
                    dList                   ; - XData list (list(cons group data)...)
                    )
        (regapp App)
        (entmod
          (append
            (entget Ent)
            (list (list -3 (append (list App) dList)))
            )
          )
        )
      (defun  Read_XData (Ent               ; - Entity Ename 
                     apName                 ; - Application name
                     /
                     xEnt
                     )
        (setq  xEnt (entget Ent (list apName))
          xEnt (vl-remove
                 apName
                 (cadar
                   (vl-remove-if
                     (function (lambda (a) (/= -3 (car a))))
                     xEnt
                     )
                   )
                 )
          )                                 ; end setq
        )
      (while (setq obj (car (entsel "\nSelect object :")))
        (if (setq OData (Read_XData obj "Edmar Cristiano Data"))
          (print (Read_XData obj "Edmar Cristiano Data"))
          (progn
            (setq dat (getstring "\nEnter Data: "))
            (Add_XData
              obj
              "Edmar Cristiano Data"
              (list (cons 1000 dat))
              )
            )
          )
        )
      (princ)
      )
    HTH

  3. #3
    Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    2,401

    Default Re: Include information on an entity of a drawing in autocad

    Couple of things, if I may....

    First, including your personal email address in your signature block is a great way of making spammer friends.

    Second, to your question, if XData does not offer you the desired outcome, and you use either Map 3D, or Civil 3D, you may want to consider adding Object Data (OD) instead.

    If you go the LISP route, look into the ADE_* functions found under Data Extension Functions, Function Catalog here:

    Code:
    (vl-load-com)
    
    (defun c:MapLisp (/ file)
      (if (setq file
                 (findfile
                   (strcat
                     (vl-registry-read
                       (strcat "HKEY_LOCAL_MACHINE\\"
                               (if vlax-user-product-key                    ; If 2013
                                 (vlax-user-product-key)                    ; Use 2013 function
                                 (vlax-product-key)                         ; Use legacy function
                               )
                       )
                       "ACADLOCATION"
                     )
                     "\\Help\\acmaplisp.chm"
                   )
                 )
          )
        (help file)
        (prompt "\n** File not found ** ")
      )
      (princ)
    )
    If you decide to go the .NET API route instead, you may find this thread to be helpful; specifically posts #14, and #16.

    HTH
    "Potential has a shelf life." - Margaret Atwood

  4. #4
    Member
    Join Date
    2012-05
    Location
    Brasil
    Posts
    6

    Default Re: Include information on an entity of a drawing in autocad

    Very good!!

    I Will give a try.

    Thanks

  5. #5
    Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    2,401

    Default Re: Include information on an entity of a drawing in autocad

    Quote Originally Posted by Edmar Cristiano View Post
    Very good!!

    I Will give a try.

    Thanks
    You're welcome; I'm happy to help.
    "Potential has a shelf life." - Margaret Atwood

Similar Threads

  1. Google Earth Export - Include timeliner information
    By jobwallis724305 in forum NavisWorks - Wish List
    Replies: 1
    Last Post: 2011-08-01, 09:58 AM
  2. Replies: 2
    Last Post: 2006-05-03, 02:01 PM
  3. Extract entity information from within an xref
    By marc.primaroh in forum AutoLISP
    Replies: 2
    Last Post: 2006-04-10, 11:34 AM
  4. Site information- include in building model or import/link?
    By tboyle in forum Revit Architecture - General
    Replies: 9
    Last Post: 2004-06-29, 03:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •