Author Topic: Dynamic Align Text to Curve { with Reactors }  (Read 58334 times)

0 Members and 2 Guests are viewing this topic.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #45 on: November 18, 2009, 06:19:59 PM »
Ok, that worked great, thank you; however, when the text gets created it is not annotative, I am able to use the CHPROP command to change it; however, I would like to avoid that, if I can, so any suggestions would be greatly appreciated, I have attached the latest code here.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #46 on: November 18, 2009, 06:56:06 PM »
A quick test with:

Code: [Select]
(vla-AddMText
  (vla-get-ModelSpace
    (vla-get-ActiveDocument
      (vlax-get-acad-object)))
  (vlax-3D-point (getpoint)) 0 "Lee Mac")


After using PutAnno, seems to work fine for me  :?

*assuming that the annotative textstyle that was used in "putAnno" is current.
« Last Edit: November 18, 2009, 07:14:46 PM by Lee Mac »

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #47 on: November 18, 2009, 07:14:16 PM »
I see the problem, only if the style is current when the text gets created, so I suppose I could set it current, then set it back as soon as the text is created.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #48 on: November 18, 2009, 07:28:51 PM »
I see the problem, only if the style is current when the text gets created, so I suppose I could set it current, then set it back as soon as the text is created.

Or after it's created, just assign it to any style you want.  That is the problem with ActiveX calls.  You create the entity, then change the properties that are not set by the creation of it.  Unlike ' entmake ' ing.... where you can tell it what properties you want it to posses when creating the entity.
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: 12913
  • London, England
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #49 on: November 18, 2009, 07:31:34 PM »
True, but it will correctly assign the style, however will not make the text annotative  :|

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #50 on: November 18, 2009, 07:33:11 PM »
I have been trying this:

Code: [Select]
(defun putAnnoObj (obj flag / xtype xval)
  ;; By Lee McDonnell

  (setq xtype
    (vlax-make-variant
      (vlax-safearray-fill
        (vlax-make-safearray
          vlax-vbInteger '(0 . 5))
        '(1001 1000 1002 1070 1070 1002))))

  (setq xval
    (vlax-make-variant
      (vlax-safearray-fill
        (vlax-make-safearray
          vlax-vbVariant '(0 . 5))
        (list "AcadAnnotative" "AnnotativeData" "{" flag 1 "}"))))

  (vla-setXData obj xtype xval))

(defun c:test (/ obj)

   (vla-put-StyleName
    (setq obj
      (vla-AddMText
        (vla-get-ModelSpace *doc)
          (vlax-3D-point (getpoint)) 0 "Lee Mac")) <Valid Style Name>)

  (putAnnoObj obj 1) ;; 1 for Annotative
  )

Using a valid Annotative Style Name which is not set to current.

The Text is created, however it is not visible, but the properties seem to be correct  :?

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #51 on: November 18, 2009, 07:43:42 PM »
Here is my solution, I simply change the test style right before the text gets created and change it right back after it has been created, it works well and gets rid of the need for the chprop command.

Thank you all for all of your help in getting this working right, my users will appreciate it, we had an older version that did something similar, but there was no preview of where it was going to insert and it definitely didn't have the reactors, it also didn't work anywhere near as well as this does with xrefs.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #52 on: November 18, 2009, 07:46:07 PM »
I'm glad you got it working Chris - well done. I hadn't tested the code with xRefs, but I'm very glad that you report it works!

But I am still curious as to how one would make the text annotative without setting the textstyle as current - I realise that it is easier to just set the Textstyle, but my curiosity gets the better of me...  :evil:

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #53 on: November 18, 2009, 07:56:02 PM »
oops, I spoke too soon, the text comes out really small for some reason, I have to figure out how to set the paper height, any suggestions?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #54 on: November 18, 2009, 07:58:13 PM »
Maybe this will help.  I don't remember much, but I do remember doing something, and this looks like what I did, even though I didn't check it ( I know it's my thread ).

[ http://www.theswamp.org/index.php?topic=29287.0 ]
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: 12913
  • London, England
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #55 on: November 19, 2009, 11:21:11 AM »
Was thinking of moving this thread to the "Show your Stuff" forum, what you reckon CAB (or other Mods)?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #56 on: November 19, 2009, 12:13:28 PM »
Just re post your first post in the Show Your Stuff and link back to this thread for those who might want to read all the
verbal traffic that lead to the development  of the final routine. And link this thread back to the Show Your Stuff .

Or is better to have it all in one place?
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.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #57 on: November 19, 2009, 12:17:26 PM »
Ok, I actually found the problem, the dimscale needs to be set the same as 1/cannoscale due to how I am handling things, so I added some code to ensure that the Dimscale is set to 1/cannoscale when using annotative scaling and scaling by dimscale.

Thank you both for helping me get this routine running properly, you have helped me a lot.

I had to make a minor revision - the previous one errored out if the dimscale was already the same as 1/cannoscale, the code attached to this message has been updated.
« Last Edit: November 19, 2009, 12:50:41 PM by cmwade77 »

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #58 on: November 19, 2009, 12:41:03 PM »
Just re post your first post in the Show Your Stuff and link back to this thread for those who might want to read all the
verbal traffic that lead to the development  of the final routine. And link this thread back to the Show Your Stuff .

Or is better to have it all in one place?


No, I think your idea is best, with the links - thanks  :-)

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Dynamic Align Text to Curve { with Reactors }
« Reply #59 on: November 19, 2009, 12:42:24 PM »
Ok, I actually found the problem, the dimscale needs to be set the same as 1/cannoscale due to how I am handling things, so I added some code to ensure that the Dimscale is set to 1/cannoscale when using annotative scaling and scaling by dimscale.

Thank you both for helping me get this routine running properly, you have helped me a lot.

I'm glad you finally got it working properly Chris, thanks for fully testing my routine also - I wouldn't have picked up a few of the bugs otherwise  ;-)