Author Topic: Entmod error on Attributes in '09  (Read 2192 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Entmod error on Attributes in '09
« on: January 11, 2010, 04:47:26 PM »
I don't want this to get lost in another topic, so I'll start a new one.  This was brought to my attention by Joe B. when he was looking for help on an mtext situation, but I think it is a problem of attributes ( ref topic ).  The attribute will not show anything, even though it changes the string, and if you look at the dxf code you see it there.  Anyone know why this happens?  You can use the ActiveX properties to get it to work, but was wondering if anyone has heard anything about entmod and errors in '09?

Code: [Select]
(defun c:Test (/ data )
   
    (while t
        (entmod
            (subst
                (cons 1 "testing")
                (assoc 1 (setq data (entget (car (nentsel)))))
                data
            )
        )
    )
)
Code: [Select]
(defun c:Test2 (/ obj )
   
    (while t (vla-put-textstring (setq obj (vlax-ename->vla-object (car (nentsel)))) "testing 2"))
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Entmod error on Attributes in '09
« Reply #1 on: January 11, 2010, 05:11:11 PM »
strange...it work well for me..

attribute, Text, Mtext..
don't forget the "AcDbAttributeDefinition"

tested on '09 and '10
Keep smile...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Entmod error on Attributes in '09
« Reply #2 on: January 11, 2010, 05:21:00 PM »
Man..... now I can't even duplicate it.  I even reopened the drawing it was erroring in, and it is working now.  When it happens again I'll see if I can see anything different.  Thanks for testing Andrea.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Joe Burke

  • Guest
Re: Entmod error on Attributes in '09
« Reply #3 on: January 12, 2010, 08:50:46 AM »
Hi Tim,

An atrribute reference may contain multiple DXF 1 codes. Apparently this happens when text is pasted into an attribute.

I hope this sheds some light on your question.

Crank

  • Water Moccasin
  • Posts: 1503
Re: Entmod error on Attributes in '09
« Reply #4 on: January 12, 2010, 01:33:57 PM »
[...]An atrribute reference may contain multiple DXF 1 codes. [...]
It's even more complicated:
If there are two groups 1, the real string is in the 2nd group. But if the text string
is greater than 250 characters, the string is divided into 250-character chunks, which appear
in one or more group 3 codes. If group 3 codes are used, the last group is a group 1 and has
fewer than 250 characters.
Vault Professional 2023     +     AEC Collection

Joe Burke

  • Guest
Re: Entmod error on Attributes in '09
« Reply #5 on: January 13, 2010, 06:49:55 AM »
I agree, but that's not hard thing to deal with.

Get all the DXF codes 1 and 3, likley using vl-remove-if-not source entget list. Then check for multiple 1 codes at the front end of the list. If found, (setq lst (cdr lst)).

Then strcat what remains.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Entmod error on Attributes in '09
« Reply #6 on: January 13, 2010, 10:30:59 AM »
I agree, but that's not hard thing to deal with.

Get all the DXF codes 1 and 3, likley using vl-remove-if-not source entget list. Then check for multiple 1 codes at the front end of the list. If found, (setq lst (cdr lst)).

Then strcat what remains.

As shown in our other thread  :wink:

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Entmod error on Attributes in '09
« Reply #7 on: January 14, 2010, 05:35:17 PM »
Well it is happening again right now.  I can't see anything that is causing it, and it only is happening in the one drawing, and not every time.  There is only one dxf code 1, so that isn't the issue.  I edit it with code, and the new string doesn't show up when using ' entmod ' once.  I even tried to ' entupd ' it, but that didn't make it show, as it is still in the drawing just not being shown.  If I did another ' entmod ' to it, then it will show up.  I'm kind of stumped, but will leave the drawing open to test other ideas.  My other code that I changed to use ActiveX calls works though.  I tried to see if it would show with a plot preview, but that didn't show the attribute info either.  Here is the dxf code, I don't think it is any help though.
Code: [Select]
(-1 . <Entity name: 7ddf6518>)
(0 . "ATTRIB")
(330 . <Entity name: 7ddf6500>)
(5 . "6373")
(100 . "AcDbEntity")
(67 . 1)
(410 . "Layout1")
(8 . "E-ARTAG-NAM")
(100 . "AcDbText")
(10 29.0567 13.8875 0.0)
(40 . 0.09375)
(1 . "STORAGE")
(50 . 0.0)
(41 . 1.0)
(51 . 0.0)
(100 . "AcDbAttribute")
(2 . "%%URNAM")
(70 . 0)
(73 . 0)
(74 . 0)
(280 . 0)

Edit:  After writing this, everything is working fine now.  :realmad: :lol:  I'm totally lost on this one.
« Last Edit: January 14, 2010, 05:39:34 PM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Entmod error on Attributes in '09
« Reply #8 on: January 14, 2010, 05:55:28 PM »
Tim,

I find that entupd does not work for Attribs and that a vla-regen is necessary  :wink:

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Entmod error on Attributes in '09
« Reply #9 on: January 15, 2010, 02:02:44 AM »
Hi

Excuse me if I misunderstand the issue.
entupd have to be called on the parent entity i.e. the block reference rather than the attribute.

Code: [Select]
(defun c:Test (/ data )
    (while t
        (entmod
            (subst
                (cons 1 "testing")
                (assoc 1 (setq data (entget (car (nentsel)))))
                data
            )
        )
      (entupd (cdr (assoc 330 data)))
    )
)
Speaking English as a French Frog

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Entmod error on Attributes in '09
« Reply #10 on: January 15, 2010, 08:47:22 AM »
Good point Gile.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Entmod error on Attributes in '09
« Reply #11 on: January 15, 2010, 11:04:24 AM »
I'll try both options, Lee's and Gile's, when it happens again.  Thanks guys.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.