Author Topic: entmake extended data  (Read 2704 times)

0 Members and 1 Guest are viewing this topic.

curmudgeon

  • Newt
  • Posts: 194
entmake extended data
« on: August 13, 2009, 12:45:34 PM »
I have a routine that traces "contiguous" arcs representing electrical circuits. I want to gather data along that "path" and save it as extended data in the home run, the arrow head for a particular circuit.

Code: [Select]
  (setq store (list (cons 0 "INSERT")
    (assoc 8 ent)
    (cons 100 "AcDbBlockReference")
    (cons 2 "ar_head")
    (cons 10 head)
    (cons 50 ang)
   '((-3 ("rak"
  (1000 . "Kenny is handsome")
  (1000 . "And intelligent")
)
)
       )
      )
  )
  (entmake store)

without the extended data, it works as expected. you may recognize the source I am using, afralisp. but the examples I have found take an existing entity and add extended data to it. I was hoping to create, entmake, the original entity with the extended data in the first place.

is this possible?

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
I added this, and it works, but I would still like a more straightforward method.

Code: [Select]
(entmake store)
  (entmod (append (entget (entlast))
  '((-3
     ("rak"
      (1000 . "Kenny is handsome")
      (1000 . "And intelligent")
     )
    )
   )
  )
  )
« Last Edit: August 13, 2009, 01:01:20 PM by curmudgeon »
Never express yourself more clearly than you are able to think.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: entmake extended data
« Reply #1 on: August 13, 2009, 03:05:09 PM »
I always use the VL method when working with xdata, this may help you if you want to proceed in that way:

Code: [Select]
(defun putxdat (Obj App Data / ent type1 valeur)

  (setq xtype
    (vlax-make-variant
      (vlax-safearray-fill
        (vlax-make-safearray
          vlax-vbInteger '(0 . 1)) '(1001 1000))))

  (setq xval
    (vlax-make-variant
      (vlax-safearray-fill
        (vlax-make-safearray
          vlax-vbVariant '(0 . 1)) (list App Data))))

  (vla-setXData Obj xtype xval))

SomeCallMeDave

  • Guest
Re: entmake extended data
« Reply #2 on: August 13, 2009, 05:30:37 PM »
The way I have done it is to make an entity list, then make my xdata list and append the latter onto the former

Code: [Select]
  (setq x_dataList (list xData_app_name)
          x_dataList (append x_dataList (list
                                                         (cons 1000 "EXISTING")
                                                         (cons 1010 sect_cl_pt)
                                                         (cons 1011 sect_cl_pt_zag)
                                                         (cons 1012  (car sect_coords))
                                                         (cons 1040 curr_station)
                                                         (cons 1070 zag)
                                                         (cons 1071  controlling_coord_pos)
                                                      );list
                           );append
          pline_list_x (append pline_list (list (append '(-3) (list x_dataList)))) ;; pline_list is an 'entmake' list for a polyline
    ) ;setq     
    (entmake pline_list_x)

I can keep the 2 lists straight in my mind better if I keep them separate until the very last minute
« Last Edit: August 13, 2009, 05:34:16 PM by David Blackmon »

efernal

  • Bull Frog
  • Posts: 206
Re: entmake extended data
« Reply #3 on: August 13, 2009, 07:38:32 PM »
;; try above block...

(regapp "rak")
  (setq   store (list   (cons 0 "INSERT")
          (assoc 8 ent)
          (cons 100 "AcDbBlockReference")
          (cons 2 "ar_head")
          (cons 10 head)
          (cons 50 ang)
          '(-3 ("rak"
                            (1000 . "Kenny is handsome")
                            (1000 . "And intelligent")
                         )
                              )

         )
  )
  (entmake store)
e.fernal

David Bethel

  • Swamp Rat
  • Posts: 656
Re: entmake extended data
« Reply #4 on: August 14, 2009, 09:16:00 AM »
I use this for a simple string of xdata.  It could be modified for multiples.
Code: [Select]

;++++++++++++ Add XDATA String To An Entity ++++++++++++++++++++++
(defun add_xdata_str (e a v);;;EName APPID String_value
  (and (= (type a) 'STR)
       (not (tblsearch "APPID" a))
       (regapp a))
  (and (= (type e) 'ENAME)
       (= (type v) 'STR)
       (entmod
(append (entget e)
   (list
    (cons -3
     (list
      (cons a
       (list (cons 1000 v))))))))))



-David
R12 Dos - A2K

curmudgeon

  • Newt
  • Posts: 194
Re: entmake extended data
« Reply #5 on: August 14, 2009, 09:31:30 AM »
;; try above block...

(regapp "rak")
  (setq   store (list   (cons 0 "INSERT")
          (assoc 8 ent)
          (cons 100 "AcDbBlockReference")
          (cons 2 "ar_head")
          (cons 10 head)
          (cons 50 ang)
          '(-3 ("rak"
                            (1000 . "Kenny is handsome")
                            (1000 . "And intelligent")
                         )
                              )

         )
  )
  (entmake store)

excellent. extra parenthesis. my bad.
to use vl methods I will have to retool my entire brain.
which can begin as soon as I remember where I left it.

thanks guys. you're the best.
Never express yourself more clearly than you are able to think.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: entmake extended data
« Reply #6 on: August 14, 2009, 10:12:54 AM »
No problem - I think I would have to retool my brain to get back to working with DXF...