Author Topic: Attribute alignment issue using ObjectDBX  (Read 10903 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Attribute alignment issue using ObjectDBX
« Reply #15 on: October 15, 2009, 02:54:53 PM »
Tim, it's good that you've finally believed the it can be done :)
If I'm wrong.... I'm wrong......  :oops:
Glad you found a way to do it.


as to 'Edit2' - it was the first thing i thought of when i tried to find 'InsertionPoint. but i didn't like the idea because i had to copy/update all textstyles from dbx-ed document into current drawing. and now, i suspect that it might be the only solution.
I was thinking of creating a new text object within the dbx doc, so that all the properties will be the same.  I mean you can't use text box, but you could use the boundingbox method.
Tim

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

Please think about donating if this post helped you.

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Attribute alignment issue using ObjectDBX
« Reply #16 on: October 15, 2009, 03:11:38 PM »
I was thinking of creating a new text object within the dbx doc, so that all the properties will be the same.  I mean you can't use text box, but you could use the boundingbox method.
i've already tried that with no success :(
if you create new text object within dbx doc you must supply a valid 'InsertionPoint and that brings us back to calculating it :)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Attribute alignment issue using ObjectDBX
« Reply #17 on: October 15, 2009, 03:13:36 PM »
Dang.  If I get a minute or so, I'll try and look into it more.  Could be very helpful to others who use lisp mostly.
Tim

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

Please think about donating if this post helped you.

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Attribute alignment issue using ObjectDBX
« Reply #18 on: October 15, 2009, 04:48:57 PM »
here's a dirty version
Code: [Select]
(defun CalcInsPoint (EntName NewStr StyleEntName / EntProps EntName TempStyleName p10)
;;;current layer must not be locked
  (while (tblsearch "STYLE"
    (setq TempStyleName (vl-filename-base (vl-filename-mktemp "")))
)
  )
  (entmakex (subst (cons 2 TempStyleName)
   (assoc 2 (setq EntProps (entget StyleEntName)))
   EntProps
    )
  )
  (setq EntProps (entget EntName))
  (setq EntName
(entmakex
   (append (list (cons 0 "TEXT")
(cons 1 NewStr)
(cons 7 TempStyleName)
(cons 73
       (cdr (assoc (if (= (cdr (assoc 0 EntProps)) "TEXT")
     73
     74
   )
   EntProps
    )
       )
)
   )
   (vl-remove-if-not
     (function (lambda (g) (vl-position (car g) '(10 11 40 50 41 51 71 72))))
     EntProps
   )
   )
)
  )
  (setq p10 (cdr (assoc 10 (entget EntName))))
  (entdel EntName)
  (vla-Delete (vlax-ename->vla-object (tblobjname "STYLE" TempStyleName)))
  p10
)
and called like
Code: [Select]
(CalcInsPoint (vlax-vla-object->ename Att)
     (cdr Tag)
     (vlax-vla-object->ename
(vla-Item (vla-get-TextStyles dbx) (vla-get-StyleName Att))
     )
)
« Last Edit: October 27, 2009, 03:59:07 AM by VovKa »

SteveK

  • Guest
Re: Attribute alignment issue using ObjectDBX
« Reply #19 on: October 15, 2009, 07:16:33 PM »
Thanks Vovka, post #11 works for most of my purposes.

Out of my depth, but continuing to watch thread with interest...

SteveK

  • Guest
Re: Attribute alignment issue using ObjectDBX
« Reply #20 on: October 26, 2009, 08:10:36 PM »
VovKa,

Seeing as this thread appears to be laid to rest do you suggest I use post #11 or post #19? Post #19 would be more accurate I'm guessing and I don't have to worry about a conditional statement to check for "aligned" or "fixed" text, however seeing as you say it's a dirty version could there possibly be errors I'd have to think about?

Thanks,

steve

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Attribute alignment issue using ObjectDBX
« Reply #21 on: October 27, 2009, 03:58:16 AM »
Steve,

post #11 will have problems with styles (i.e. fonts), and that what's Tim was talking about.
i called post #19 "dirty" because it writes temporary data to the current drawing. therefore the current layer must no be locked. also it's not right to create a unique text style for each text/attribute. it should be done on top level, but it's up to Lee to change his code :)
anyway i've made some changes... just in case.

SteveK

  • Guest
Re: Attribute alignment issue using ObjectDBX
« Reply #22 on: October 27, 2009, 05:59:19 PM »
Thanks VovKa, I'll be using Lee's program with post #19.
And yeah Lee's a bit busy lately.