Author Topic: getStyle Error in attribute  (Read 2972 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
getStyle Error in attribute
« on: February 11, 2013, 03:05:28 PM »
Hi all,..

I've routine who change all style for all text, mtext attribute etc....
but in some case, some drawing have an error.

Work dawing got attribute style,...
Code: [Select]
......
;   PlotStyleName = "Couleur_ 7"
;   Rotation = 0.0
;   ScaleFactor = 0.789109
;   StyleName = "ROMAIN"
;   TagString = "UR"
;   TextAlignmentPoint = (825.941 15.3204 0.0)
.....



but some attribute have no style..
Code: [Select]
.......
;   PlotStyleName = "Couleur_ 7"
;   Rotation = 0.0
;   ScaleFactor = 1.0
;   StyleName = AutoCAD.Application: Identificateur d’objet nul
;   TagString = "TYPE"
;   TextAlignmentPoint = (0.0 0.0 0.0)
......

Any idea how do I handle this ?..
Code: [Select]
vl-catch-all-error-p ...seem to not work..  :roll:

thank you. :)
Keep smile...

fixo

  • Guest
Re: getStyle Error in attribute
« Reply #1 on: February 11, 2013, 03:26:02 PM »
Perhaps
Code: [Select]
(if (not (vlax-property-available-p attobj 'StyleName))
;;rest you code here
Btw, you want to make changes then it will be better to use instead:

Code: [Select]
(if (not (vlax-property-available-p obj 'stylename);check if object has this property
(if (not (vlax-property-available-p obj 'stylename T);check if this property is write-enabled
  (progn
    ;; rest your code here ;;
    )))))
« Last Edit: February 11, 2013, 03:33:04 PM by fixo »

Andrea

  • Water Moccasin
  • Posts: 2372
Re: getStyle Error in attribute
« Reply #2 on: February 11, 2013, 03:46:04 PM »
Nice to hear you again "Fixo"  :)

unfortunatly,...
Code: [Select]
(vlax-property-available-p att 'stylename T)

and

Code: [Select]
(vlax-property-available-p att 'stylename )

return Me....TRUE
Keep smile...

fixo

  • Guest
Re: getStyle Error in attribute
« Reply #3 on: February 11, 2013, 04:02:21 PM »
Hi Andrea,
Nice to see you again,
what is sort of this attribute?
Constant, Multiline or with Field?

Lee Mac

  • Seagull
  • Posts: 12929
  • London, England
Re: getStyle Error in attribute
« Reply #4 on: February 11, 2013, 05:52:21 PM »
Does an AUDIT fix the problem?

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: getStyle Error in attribute
« Reply #5 on: February 12, 2013, 10:00:51 AM »
It does sound as if there's some corruption in that file. I've never found any form of text (even attributes) which aren't applied a style.

If an Audit still doesn't solve this, perhaps a "simple" vl-catch-all-apply might be used.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: getStyle Error in attribute
« Reply #6 on: February 12, 2013, 10:16:18 AM »
Does an AUDIT fix the problem?

Yes,..the Audit did the job..
thank you guys..

have a nice day.  :wink:
Keep smile...

Lee Mac

  • Seagull
  • Posts: 12929
  • London, England
Re: getStyle Error in attribute
« Reply #7 on: February 12, 2013, 10:29:15 AM »
You're very welcome Andrea, have a good day  :-)

Andrea

  • Water Moccasin
  • Posts: 2372
Re: getStyle Error in attribute
« Reply #8 on: February 12, 2013, 04:03:00 PM »
Thanks :)

Unfortynatly....
have another one...

attached the file containing the problematic bug.

code to test:

Code: [Select]
(defun c:capt (/ vlao attf att)
  (vl-load-com)
  (setq vlao (vlax-ename->vla-object (car (entsel))))
  (if (setq attf (vlax-invoke vlao 'getattributes))
    (progn (foreach att attf
             (princ (strcat "\n" (vla-get-stylename att)))
           )
           (vlax-release-object vlao)
    )
  )
)

I can't seem able to handle this one..
any help will be appreciated.

thank you.
Keep smile...

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: getStyle Error in attribute
« Reply #9 on: February 12, 2013, 04:38:56 PM »
The Attribute with tag "TYPE" has a null style name. (saved back to ACAD2004 so I could open it)
If you use Battman to edit that attribute it shows ROMAIN as the style.
Save from Battman edit fixes the attribute.
« Last Edit: February 12, 2013, 04:44:30 PM by CAB »
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.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: getStyle Error in attribute
« Reply #10 on: February 13, 2013, 08:30:18 AM »
Thank you,

The fact is,....that program is used by a department who have no choice to start when open a drawing..
this is a client obligation....even worst....their program tool do not work at all....I had not to modify it...but remake it from scratch.

so I just wonder if it is possible to handle this issue....or if you have any suggestion code on how to change textstyle for attribute....i'll take it.
thank you again for helping me.
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: getStyle Error in attribute
« Reply #11 on: February 13, 2013, 08:56:05 AM »
well....why not using the brutal force .... :evil:

Code: [Select]
(setq entdata (entget (setq ent (car (entsel)))))
(if (= (vla-get-hasattributes (vlax-ename->vla-object ent))
       :vlax-true
    )
  (progn
    (while (/= (cdr (assoc 0 entdata)) "SEQEND")
      (setq entdata (entget (entnext (cdr (assoc -1 entdata)))))
      (if (/= (cdr (assoc 7 entdata)) "ROMAIN")
        (entmod (subst (cons 7 "ROMAIN") (assoc 7 entdata) entdata))
      )
    )
  )
)

thank you very one.. :)
Keep smile...

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: getStyle Error in attribute
« Reply #12 on: February 13, 2013, 09:43:33 AM »
Looking at the block & Insert, the Insert was damaged.
((-1 . <Entity name: 7d2259e0>) (0 . "ATTRIB") (330 . <Entity name: 7d225998>) (5 . "77DCC") (100 . "AcDbEntity") (67 . 1) (410 . "PRESENTATION") (8 . "0") (62 . 7) (6 . "Continuous") (100 . "AcDbText") (10 847.133 -17.988 0.0)
 (40 . 4.5) (1 . "SA") (50 . 0.0) (41 . 0.789109) (51 . 0.0)
(7 . "ROMAIN")   <-----<<  Missing info
 (71 . 0)
 (72 . 5)
 (11 853.389 -17.988 0.0)
 (210 0.0 0.0 1.0)

 (100 . "AcDbAttribute")
 (2 . "UR")
 (70 . 0)
 (73 . 0)
 (74 . 0))
 
((-1 . <Entity name: 7d2259e8>) (0 . "ATTRIB") (330 . <Entity name: 7d225998>) (5 . "77DCD") (100 . "AcDbEntity") (67 . 1) (410 . "PRESENTATION") (8 . "0") (62 . 7) (6 . "Continuous") (100 . "AcDbText") (10 774.448 -22.8084 0.0)
 (40 . 2.0) (1 . "REGULIERj") (50 . 0.0) (41 . 1.0) (51 . 0.0)
(100 . "AcDbAttribute")
 (2 . "TYPE")
 (70 . 1)
 (73 . 0)
 (74 . 0))
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: getStyle Error in attribute
« Reply #13 on: February 13, 2013, 09:50:30 AM »
That worked for me too.
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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: getStyle Error in attribute
« Reply #14 on: February 13, 2013, 03:02:13 PM »
I thought initially :-
Spelling is a trap for international users :)

Quote
(if (/= (cdr (assoc 7 entdata)) "ROMAIN")

Then realised that DXF 7 is Text Style Name NOT Font Name   :wink:
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.