Author Topic: Help Using ENTNEXT to Update Block Attribute  (Read 3973 times)

0 Members and 1 Guest are viewing this topic.

tcdan

  • Guest
Help Using ENTNEXT to Update Block Attribute
« on: July 29, 2005, 07:26:03 PM »
OK - so I didn't search this time to see if this question has been covered.

1. insert block
2. (setq en (entget (entlast)))
3. use ENTNEXT to cycle through attributes which I thought followed the main entity: (setq en (entget (entnext en)))

But when I try to use ENTNEXT, I get an error followed by the contents of the elist previously returned by entget:

Code: [Select]
; error: bad argument type: lentityp ((-1 . <Entity name: 7ecbe9e0>) (0 .
"INSERT") (330 . <Entity name: 7ef8bcb8>) (5 . "24214") (100 . "AcDbEntity")
(67 . 0) (410 . "Model") (8 . "EASMENTS") (6 . "Continuous") (100 .
"AcDbBlockReference") (66 . 1) (2 . "NORTHA") (10 6204.67 24007.3 0.0) (41 .
25.0) (42 . 25.0) (43 . 25.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 .
0.0) (210 0.0 0.0 1.0))


 :?:  :?:

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Help Using ENTNEXT to Update Block Attribute
« Reply #1 on: July 29, 2005, 07:35:24 PM »
You must supply the ENAME for entnext:
Code: [Select]

(setq ent (entlast))
(setq entlist (entget ent))
(setq ent (entnext ent))
(setq entlist (entget ent))
(setq ent (entnext ent))
(setq entlist (entget ent))
;...etc. usually wrapped in a (while) loop

tcdan

  • Guest
Help Using ENTNEXT to Update Block Attribute
« Reply #2 on: July 29, 2005, 07:49:29 PM »
Oh yeah, that makes sense.

I don't really understand the way entget uses ENAME's and what an ename really is and why you then you have to convert them to use them with VLA- functions and all that. . .

I'm guessing the ENAME is the unique identifier of the object in ACAD's database - kind of like a pointer - that is saved in the drawing and accessible from session to session of CAD.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Help Using ENTNEXT to Update Block Attribute
« Reply #3 on: July 29, 2005, 08:09:50 PM »
Quote from: tcdan

I'm guessing the ENAME is the unique identifier of the object in ACAD's database - kind of like a pointer - that is saved in the drawing and accessible from session to session of CAD.
The pointer part is correct, however the ename value changes from session to session. The only thing that stays the same is the entity's handle. The ename and vla-objectid are both recreated, AFAIK, every time the drawing is opened. (Although I have never run tests to verify this, I'm just repeating what I've read)

BTW, you CAN use (entnext) with the list returned by (entget)....you just need to do the entnext on the ename......
Code: [Select]
(setq ent (entnext (cdr (assoc -1 ent)))) should do it.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Help Using ENTNEXT to Update Block Attribute
« Reply #4 on: July 29, 2005, 08:19:41 PM »
ObjectID's do change session to session.

Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

tcdan

  • Guest
Help Using ENTNEXT to Update Block Attribute
« Reply #5 on: July 29, 2005, 08:22:16 PM »
Quote
BTW, you CAN use (entnext) with the list returned by (entget)....you just need to do the entnext on the ename......
Code: [Select]

(setq ent (entnext (cdr (assoc -1 ent))))

should do it.

That's pretty nifty. . . yeah - I like that.  Thanks jeff!

tcdan

  • Guest
Help Using ENTNEXT to Update Block Attribute
« Reply #6 on: July 29, 2005, 08:24:57 PM »
Whoa man - nice emoticon.  Makes you look like a know it all :)

Did you insert that or attach it as an image or what
(or is it a secret)?

tcdan

  • Guest

tcdan

  • Guest
Help Using ENTNEXT to Update Block Attribute
« Reply #8 on: July 29, 2005, 08:27:17 PM »
Quote
The only thing that stays the same is the entity's handle.

Could you clarify what that is?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Help Using ENTNEXT to Update Block Attribute
« Reply #9 on: July 29, 2005, 08:41:11 PM »
The handle is a guarenteed unique, sequentially assigned hexidecimal number.

PS: Not a know it all, just a knurd havin' fun.

:cheesy:
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

tcdan

  • Guest
Help Using ENTNEXT to Update Block Attribute
« Reply #10 on: July 29, 2005, 09:04:53 PM »
I can definitely appreciate that

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Help Using ENTNEXT to Update Block Attribute
« Reply #11 on: July 30, 2005, 01:36:11 PM »
And to further clarify the handle, it is stored as DXF code 5. So every time you (entget) an object you can extract it's handle from (assoc 5 ent) and be certain that it is the same from session to session. It even gets saved when exporting to a DXF file.

daron

  • Guest
Help Using ENTNEXT to Update Block Attribute
« Reply #12 on: August 01, 2005, 07:36:32 AM »
Of course, it gets changed if you happen to wblock it out.