Author Topic: Matching Another Mleader Attribute Values  (Read 6743 times)

0 Members and 1 Guest are viewing this topic.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Matching Another Mleader Attribute Values
« Reply #15 on: January 28, 2016, 01:06:29 PM »
The problem is related to the alignment of the attribute.
Change (2x):
Code: [Select]
(setq TestPt1
  (polar
    (vlax-safearray->list
      (vlax-variant-value (vla-get-insertionpoint Att))
    )
    (angle '(0 0 0) InsPt1)
    (distance '(0 0 0) InsPt1)
  )
)
To:
Code: [Select]
(setq TestPt1
  (mapcar
    '+
    (vlax-get Att (if (zerop (vla-get-alignment Att)) 'insertionpoint 'textalignmentpoint))
    InsPt1
  )
)

Note: Your Mleader is annotative. I expect there will be additional issues with certain anno scales.
The other issue with your method is accounting for the scale of the block when inserted into Modelspace and scaled up with DIMSCALE or manually scaled.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Matching Another Mleader Attribute Values
« Reply #16 on: January 28, 2016, 01:10:53 PM »
lol. Thank you for the share! Yeah.. I am still trying to fit your code into the script. Still no luck with that, keeps erroring out. But, the annotation scale is the problem. But it should work in paperspace? 
Civil3D 2020

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Matching Another Mleader Attribute Values
« Reply #17 on: January 28, 2016, 01:45:24 PM »
lol. Thank you for the share! Yeah.. I am still trying to fit your code into the script. Still no luck with that, keeps erroring out. But, the annotation scale is the problem. But it should work in paperspace?
I have not tested it with annotative styles, but it definitely should work on any nonanotative style and should work in paperspace or modelspace, so long as dimscale is set properly.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Matching Another Mleader Attribute Values
« Reply #18 on: January 28, 2016, 02:30:43 PM »
I was playing around with the drawing I have uploaded, and I drew a few MLeaders in Paperspace and set the Annotation scale to None. I am hoping I did something wrong not to get it to work. lol.
Civil3D 2020

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Matching Another Mleader Attribute Values
« Reply #19 on: January 28, 2016, 04:19:25 PM »
The other issue with your method...
My code is a minor improvement of *your* method. And yes, as I have mentioned before, there is an issue with block scaling and also with the textsize. Of course if there is only one attribute the solution can be much simpler.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Matching Another Mleader Attribute Values
« Reply #20 on: January 28, 2016, 07:37:12 PM »
The other issue with your method...
My code is a minor improvement of *your* method. And yes, as I have mentioned before, there is an issue with block scaling and also with the textsize. Of course if there is only one attribute the solution can be much simpler.
I see, I am still learning with the mapcar stuff and yes when there is only one attribute, it is much easier. It would be even easier if AutoCAD would return the actual locations of the insertion points of the text somehow, then I could use the same as any of the other attribute stuff.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Matching Another Mleader Attribute Values
« Reply #21 on: March 20, 2016, 09:29:18 AM »
FWIW, I have now updated my Copy or Swap Text program to enable compatibility with Dimensions & MLeader Block Attributes.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Matching Another Mleader Attribute Values
« Reply #22 on: March 20, 2016, 04:02:42 PM »
Thank you so just lee for doing that!!!! Hopefully it wasn't too hard to add! Can't wait to try it tomorrow.
Civil3D 2020

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Matching Another Mleader Attribute Values
« Reply #23 on: March 20, 2016, 04:05:42 PM »
You're welcome - I hope it works well in your testing.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Matching Another Mleader Attribute Values
« Reply #24 on: March 21, 2016, 07:51:29 AM »
Alight, I had some time to test it out. I am getting a Selected MLeader has no editable content.

Code: [Select]
Command: ctx
Formatting retained: Yes
Select source text [Settings/Exit]:
Selected MLeader has no editable content.
Formatting retained: Yes
Select source text [Settings/Exit]:
Selected MLeader has no editable content.
Formatting retained: Yes
Select source text [Settings/Exit]: *Cancel*
Command:


By the way here is a same dwg. Maybe the sway the Mleader block setup is wrong?
Civil3D 2020

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Matching Another Mleader Attribute Values
« Reply #25 on: March 21, 2016, 03:41:07 PM »
Alight, I had some time to test it out. I am getting a Selected MLeader has no editable content.

Code: [Select]
Command: ctx
Formatting retained: Yes
Select source text [Settings/Exit]:
Selected MLeader has no editable content.
Formatting retained: Yes
Select source text [Settings/Exit]:
Selected MLeader has no editable content.
Formatting retained: Yes
Select source text [Settings/Exit]: *Cancel*
Command:


By the way here is a same dwg. Maybe the sway the Mleader block setup is wrong?

Many thanks - I've found the bug: it was the result of a single missing character, and dependent on the order of the components within the block definition of the MLeader Attributed Block!

I will update the program shortly.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Matching Another Mleader Attribute Values
« Reply #26 on: March 21, 2016, 03:43:01 PM »
Woohoo. I helped lee out! Im glad you found it!
Civil3D 2020

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Matching Another Mleader Attribute Values
« Reply #27 on: March 21, 2016, 06:35:53 PM »
Updated here (V1.6).

Thank you once again for your time testing the program - let me know how you get on with the new version  :-)

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Matching Another Mleader Attribute Values
« Reply #28 on: March 22, 2016, 07:11:25 AM »
BOOM! Works! This is gonna change everything. lol! THank you again!
Civil3D 2020

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Matching Another Mleader Attribute Values
« Reply #29 on: March 22, 2016, 07:38:48 AM »
BOOM! Works! This is gonna change everything. lol! THank you again!

Fantastic! I'm delighted that you can make use of the program  :-)