Author Topic: Converting Leaders to MLeaders  (Read 2121 times)

0 Members and 1 Guest are viewing this topic.

cmwade77

  • Swamp Rat
  • Posts: 1449
Converting Leaders to MLeaders
« on: October 20, 2010, 01:56:36 PM »
I am working on updating my routine that converts leaders to mleaders to also handle blocks. For some reason the attached code only modifies the first attribute in the block. I am wondering if anyone out there could help me out. As you can see from the comments, some of the code is reused from others on this board and other boards and I have tried to give all applicable credit, but if you know someone that I have missed in there, please let me know.

Any help that you can provide on figuring out why it is only modifying the first attribute would be greatly appreciated. It also seems to be doing it in reverse order, but I think I know how to fix that part.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Converting Leaders to MLeaders
« Reply #1 on: October 20, 2010, 02:02:27 PM »
Tim

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

Please think about donating if this post helped you.

cmwade77

  • Swamp Rat
  • Posts: 1449
Re: Converting Leaders to MLeaders
« Reply #2 on: October 21, 2010, 12:41:53 PM »
Thank you for that, now I just have to figure out how to get the attributes into a list like that.

Lee Mac

  • Seagull
  • Posts: 12929
  • London, England
Re: Converting Leaders to MLeaders
« Reply #3 on: October 21, 2010, 12:52:31 PM »
now I just have to figure out how to get the attributes into a list like that.

Perhaps?

Code: [Select]
(defun GetAttributes ( blockObject )
  (mapcar
    (function
      (lambda ( attrib ) (cons (vla-get-Tagstring attrib) (vla-get-TextString attrib)))
    )
    (vlax-invoke blockObject 'GetAttributes)
  )
)

cmwade77

  • Swamp Rat
  • Posts: 1449
Re: Converting Leaders to MLeaders
« Reply #4 on: October 21, 2010, 02:23:45 PM »
That will do, thank you very much, I was trying on my own and failing miserably.

cmwade77

  • Swamp Rat
  • Posts: 1449
Re: Converting Leaders to MLeaders
« Reply #5 on: October 21, 2010, 07:12:03 PM »
Ok, I think I have finally got the bugs worked out and got the command working with blocks, it will also now convert lines into plines before converting, in case you have exploded leaders. I have attached the code (there are remarks by the items that are to do with our standards, so that you know what they do and can change them.

Let me know what you think, I am sure the code could be optimized, especially given all of the outside code and such that has been plugged into it, but it does at least work.