Author Topic: Text Tools by CAB  (Read 4399 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Text Tools by CAB
« on: July 08, 2011, 01:20:17 PM »
This is a "Not Ready for Prime-time" routine I've been working on over the years.
Just thought I would share what I have so far to get feed back.
Started the routine in 2001 when my skills were poor. I purchased a routine (arx)
to do the work so I quit my own LISP but the purchased routine quit working when I
moved to ACAD2006 and a new computer recently. So I returned to this old lisp to try & add
some functionality to it.

It has a help button but most of the functions are obvious (to me).

Code: [Select]
;;;           -=<   D i a l o g    O p t i o n s   >=-   
;;;    Text Styles - Select a new style to use
;;;    Previous Settings - Select previously used settings to update the dialog box
;;;    Text Insert Angle - Angle text is inserted at
;;;    [Pick Angle] - exist dialog to pick, enter or select object for new angle
;;;    [ ] Pick Angle when adding - User must pick angle after picking the insert point
;;;    [ ] Keep text upright - Will only change the angle from the [Pick Angle] button Object option
;;;    Style Size - Display of current Text Style Size
;;;    Text Size - User size choice : Only if style is zero can user change it
;;;    [Pick Size] - exist dialog to pick, enter or select object for new text size
;;;    Layer to use - Pick list of layers to use
;;;    [ ] Use Current layer - When checked ignores pick list for layer
;;;    [Pick Layer] - exit dialog box for user to select object for new layer
;;;    Text Type to Insert - Chose Plain Text, Mtext or Mtext when more than one row is entered
;;;    [Add text to Drawing] - exist dialog to add text
;;;    [Update Text] - exit dialog box to Change existing text to match present settings
;;;    [Combine Text] - exit dialog box to combine selected text to Mtext
;;;    [Underline Text] - exit dialog to Underline selected existing text
;;;    [Match Text Properties] - exit dialog box to select text to match properties
;;;    [Help] - See this screen


The nice thing about the TextAdd function is that you do not need the dialog if you want to create
your own short cut buttons. Here are some examples:
Code: [Select]
;; *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
;;     T e x t A d d   C o m m a n d   L i n e   C a l l s     
;; *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
(defun c:TextAddPickAngle ()
  (TextAdd (list (list "Layer" (GetLay2Use))'("Pick" t)))
)
(defun c:TextAddFixedAngle ()
  (TextAdd (list (list "Layer" (GetLay2Use)) '("Pick" nil)))
)
;;  allow user to pick text to match properties & the add text to DWG [No DCL]
(defun c:txtMatchAdd()
  (if (ttMatchProperty)
    (TextAdd nil)
  )
)
;|   --==<    TextAdd  optional arguments     >==--
      Options is nil or a list of optional settings, example [Case Sensitive]
      '(("Layer" "0") ("Size" 5.5))               
                "Layer"  must be a valid layer name
                "Style"  must be a valid style name
                "Size"   real or integer
                "Type" integer flag
                           0 = leave as plain text
                           1 = change to mtext is > 1 line of text
                           2 = change to mtext no matter what
                "Pick"   User to pick angle flag  t or nil or "O" = Object Pick
                "Angle" Forced Text angle in degrees and can be a string
|;
;; *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*



====================================================================
I also have a Leader Routine and intend to marry the two when both are more bug resistant.
So you may see some code I dropped in that is for future use, and there are a lot of
global variables floating around that will get localized soon.

Code: [Select]
;;;  DESCRIPTION:
;;;  This is a typical Leader creation tool to allow the user to pick leader points and adjust
;;;  the arrow head type and size as overrides. The leader routine is a lisp that is called
;;;  with arguments that control the leader type, arrowhead and points allowed. This is similar
;;;  to Qleader but with the added option to change the arrow head type & size.
;;;  Initial settings are hard coded in the LISP & saved to the current drawing unless the current
;;;  drawing has the values. If they exist they are loaded and defaults are ignored.
;;;  In a future release I will add the text engine to complete the tool.
;;;  ADD LEADER will allow user to place a leader using dialog settings.                       
;;;      During the leader add process after the first point:
;;;        + increment the arrow size by one
;;;        - deincrement the arrow size by one
;;;        TAB key for arrowhead DCL
;;;        6 key to change increment arrowhead type
;;;        4 key to change deincrement arrowhead type
;;;        F8 key to toggle Ortho override
;;;        F10 key to toggle Polar override
;;;        S key to run Dialog for Settings
;;;  SAVE will store dialog settings in current session in the current drawing.               
;;;  CANCEL will exit without saving any changes in settings.                                 
;;;  MATCH will allow user to select a leader & updates dialog settings.                       
;;;  UPDATE will allow user to select a leader & updates the leader settings.                 
;;;  [Leader Type] pick list overrides the Dim Style Leader                                   
;;;  [Arrow Head] pick list overrides the Dim Style Arrow                                     
;;;  [ ] Use Current Dim Style - when unchecked will use the Dim Style in the pick list.       
;;;  [ ] Use Dim Style Size - uses DimASZ times DimScale, Actual size is displayed.           
;;;  User Arrow Size Override - Enter actual size desired.                                     
;;;  [ ] Use Current Layer - when unchecked will use the Layer in the pick list.               
;;;  [ ] Layer Filter will filter the layer selection available to the user. 


« Last Edit: July 08, 2011, 02:28:54 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.

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Text Tools by CAB
« Reply #1 on: July 08, 2011, 01:27:07 PM »
Greater is spelled wrong.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

GDF

  • Water Moccasin
  • Posts: 2081
Re: Text Tools by CAB
« Reply #2 on: July 08, 2011, 02:09:50 PM »
Looking forward to playing with these routines...
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Text Tools by CAB
« Reply #3 on: July 08, 2011, 02:29:55 PM »
Thanks Matt, for those eagle eyes. 8-)

File & picture updated.
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.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Text Tools by CAB
« Reply #4 on: July 08, 2011, 03:00:27 PM »
Some impressive looking dialogs there Alan! Nice work  :-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Text Tools by CAB
« Reply #5 on: July 08, 2011, 03:27:07 PM »
Thanks Lee, still tweaking 8-)
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.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Text Tools by CAB
« Reply #6 on: July 08, 2011, 03:40:23 PM »
Your code that you consider crap is gold to most people.
Thanks Cab.

***Edit***
I hope that came across as a compliment maybe this would be better
The code you wrote while you considered your skills poor,
I wish I could write at a my best.
« Last Edit: July 08, 2011, 04:45:27 PM by Jeff H »

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2140
  • class keyThumper<T>:ILazy<T>
Re: Text Tools by CAB
« Reply #7 on: July 08, 2011, 05:20:16 PM »

Interesting that you use the 'greater than' and 'less than' symbols  for labels ...  ie  < label >
makes it quite distinctive.

I haven't played with DCL for ages but those look very effective Alan.

Regards
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

stevesfr

  • Newt
  • Posts: 54
Re: Text Tools by CAB
« Reply #8 on: July 09, 2011, 01:05:31 PM »
CAB.. he who does great code !!
is it possible to narrow the width of the dcl just a bit?
at the moment I have my screen set to 1152 x 864 pixels; with this the dcl doesn't fit, but with a little jacking around, its useable-tho not perfect.
If I change resolution to 1280 x 768 pixels, then dcl is happy, but circles in ACAD2008 are no longer true circles in appearance.
Just wondering if others are experiencing this and did they overcome it somehow?
(available for testing and breaking !)
regards for the nice programming !
Steve
Can't remember what I'm supposed to forget.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Text Tools by CAB
« Reply #9 on: July 09, 2011, 03:05:30 PM »
Thanks Kerry. 8-)

Steve, see attached, I was able to shrink the right column a bit.
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.

stevesfr

  • Newt
  • Posts: 54
Re: Text Tools by CAB
« Reply #10 on: July 09, 2011, 03:14:02 PM »
CAB.... beautiful new DCL...... thx   8-)
Steve
Can't remember what I'm supposed to forget.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Text Tools by CAB
« Reply #11 on: July 09, 2011, 03:25:32 PM »
I was able to shrink the left column with some staking.
See attached.
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.

stevesfr

  • Newt
  • Posts: 54
Re: Text Tools by CAB
« Reply #12 on: July 09, 2011, 03:49:05 PM »
Revision #1 dcl  and Revision #2 dcl are working just fine here.
Steve
Can't remember what I'm supposed to forget.

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: Text Tools by CAB
« Reply #13 on: July 10, 2011, 07:32:33 AM »
Thanks for sharing your nice work~, Alan
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Text Tools by CAB
« Reply #14 on: July 11, 2011, 10:58:00 AM »
Nice gooey CAB.

<sigh> "Imagine how useful that would be in a palette format . . ."

 :wink:
James Buzbee
Windows 8