Author Topic: Isometric Text Request  (Read 21092 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Isometric Text Request
« Reply #15 on: March 11, 2011, 09:46:39 AM »
Very clever  8-)

bayoubuoy

  • Guest
Re: Isometric Text Request
« Reply #16 on: March 11, 2011, 12:50:05 PM »
@CAB,
Thanks for the offerings.

You're welcome, glad Lee came up with a cool routine. 8-)

You should try the one with the DCL though, you'll like it too.

CAB,
I did not test the one with the dcl before my last post. I have since tested it and it would take me some getting used to to get the desired results.
My original goal was to have a toolbar similar to the one Joseph E. Willis has in his ISODIM program (I have a DEMO version http://www.theswamp.org/index.php?topic=36831.0) that only requires three mouse clicks. Pick the toolbar icon, pick the text, right click for enter.

Perhaps this wouldn't be too much. :evil:
Code: [Select]
     (or (eq (vla-get-Objectname (setq e (vlax-ename->vla-object e))) "AcDbText")
          (prompt "\n**  ERROR - Must be plain text  **"))
CAB,
Where does this go?
@Lee Mac,
You never cease to amaze me how you can use so few lines of code to do so much.
Your isotext.lsp certainly is fun and would be perfect if it cycled through the standard
and two vertical options too.
Thanks much.

Thanks Bayoubuoy  8-)

I could incorporate the vertical views, but this would unfortunately disrupt the concision of the code  :|

Lee Mac,
I understand.
Lee, too much disruptions in this?

Code: [Select]
(defun c:isotext ( / e i j k)
  (vl-load-com)
 ;(setq i (/ pi 6.) j -1.)
  (setq i 0 k (/ pi 6.) j -1.)
  ;; © Lee Mac 2011
  (if
    (and
      (setq e (car (entsel "\nSelect Text: ")))
      (eq (vla-get-Objectname (setq e (vlax-ename->vla-object e))) "AcDbText")
      (princ "\nPress [Tab] to Change Projection <Accept>")
    )      
    (while (= 9 (cadr (grread nil 14 0)))
     ;(vla-put-rotation     e i)
      (vla-put-rotation     e (* k (1- (* 2 (setq i (rem (+ i (max 0 (setq j (- j)))) 3))))))
     ;(vla-put-obliqueangle e (setq i (* i (setq j (- j)))))
      (vla-put-obliqueangle e (* j k))
    )
  )
  (princ)
)

phanaem,
Very nice.
Your contribution is greatly appreciated.
« Last Edit: March 13, 2011, 12:21:31 AM by bayoubuoy »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Isometric Text Request
« Reply #17 on: March 11, 2011, 06:20:20 PM »
I think this will work with your buttons.
Just call it with the angle & oblique angle.
^C^C(isotext 30 330)


Code: [Select]
(defun isotext (ang obl / ent obj)
  (vl-load-com)
  (defun dtr (D) (/ (* D pi) 180.0)) ; Degrees to Radians
  (if (> ang 10)(setq ang (dtr ang)))
  (if (> obl 10)(setq obl (dtr obl)))
 
  (while
    (cond
      ((not (setq ent (car (entsel "\nSelect Plain Text: "))))
       (princ "\nMissed Try again,")
      )
      ((/= (vla-get-Objectname (setq obj (vlax-ename->vla-object ent))) "AcDbText")
       (princ "\n**  ERROR - Must be plain text  **")
      )
      ((vl-catch-all-error-p
         (vl-catch-all-apply
           '(lambda ()
              (vla-put-rotation obj ang)
              (vla-put-obliqueangle obj obl)
            )
         )
       )
       (princ "\n**  ERROR - Text can not be changed  **")
      )
    )
  )
  (princ)
)
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.

bayoubuoy

  • Guest
Re: Isometric Text Request
« Reply #18 on: March 13, 2011, 12:34:15 AM »
I think this will work with your buttons.
Just call it with the angle & oblique angle.
^C^C(isotext 30 330)

CAB,
Thanks for writing the routine. It doesn't quite do all the isoplane postions and
gives an odd result on some.
I have attached a crude drawing with a chart showing my test results along with
a detail showing how I numbered the isoplanes and the text of my toolbar menu.
If you can't see an easy fix, please don't go to any more trouble.
I can use the Lee Mac/phanaem program even though it doesn't fit into my plan
for a toolbar button for each change.
Continuing with the thread subject, I now want to make a toolbar to create iso text in the
desired isoplane. I found the following code at:
http://www.davetyner.com/forum/archive/index.php/t-51.html
Code: [Select]
(defun ISOTEXT1 ()
(setvar "filedia" 0)
(command "-style" "Simplexi" "simplex" "0.125" "0.75" "330" "" "" "")
(princ "Pick The Point where you want the text ")
(setq aa (getpoint))
(setvar "filedia" 1)
(command "text" aa "330"))
I omitted ISOTEXT2 thru 8.

I can't find information on for what all the quotes are for in the code for the style so
I can adapt it to my needs.
Can you point me to a source for that kind of information?

Thanks,
bayoubuoy
« Last Edit: March 13, 2011, 09:03:15 AM by bayoubuoy »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Isometric Text Request
« Reply #19 on: March 13, 2011, 07:36:18 AM »
Try this:
Code: [Select]
**TOOLBARCHANGETEXTPLANE
**TB_CHANGE_TEXT_PLANE
TITLE [_Toolbar("Change Text Plane", _Floating, _Show, 50, 50, 2)]
ID_CHPL1 [_Button("Change Text Plane 1", "chpl1.bmp", "chpl1.bmp")]^C^C(isotext 30 330)
ID_CHPL2 [_Button("Change Text Plane 2", "chpl2.bmp", "chpl2.bmp")]^C^C(isotext 330 30)
ID_CHPL3 [_Button("Change Text Plane 3", "chpl3.bmp", "chpl3.bmp")]^C^C(isotext 330 330)
ID_CHPL4 [_Button("Change Text Plane 4", "chpl4.bmp", "chpl4.bmp")]^C^C(isotext 30 30)
ID_CHPL5 [_Button("Change Text Plane 5", "chpl5.bmp", "chpl5.bmp")]^C^C(isotext 90 30)
ID_CHPL6 [_Button("Change Text Plane 6", "chpl6.bmp", "chpl6.bmp")]^C^C(isotext 90 330)
ID_CHPL7 [_Button("Change Text Plane 7", "chpl7.bmp", "chpl7.bmp")]^C^C(isotext 0 0)
ID_CHPL8 [_Button("Change Text Plane 8", "chpl8.bmp", "chpl8.bmp")]^C^C(isotext 270 0)
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Isometric Text Request
« Reply #20 on: March 13, 2011, 07:43:11 AM »
I can't find information on for what all the quotes are for in the code for the style so
I can adapt it to my needs.
Can you point me to a source for that kind of information?

Thanks,
bayoubuoy

Just enter the command at the command line to see what each entry is for.
Quote
Command: -style
Enter name of text style or [?] <Standard>: MyStyle

New style.
Specify full font name or font filename (TTF or SHX) <txt>: Romans
Specify height of text <0'-0">: 2
Specify width factor <1.00000>:     <- Here you hit ENTER whis is "" in code

Specify obliquing angle <0.0000>: 30
Display text backwards? [Yes/No] <N>: ""
Display text upside-down? [Yes/No] <N>: ""
Vertical? <N> ""

"MyStyle" is now the current text style.
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Isometric Text Request
« Reply #21 on: March 13, 2011, 07:53:19 AM »
Code: [Select]
(defun ISOTEXT1 (/ pt)
  (command "-style"
           "Simplexi"  ; name of text style
           "simplex"   ; font name
           "2"         ; height of text
           "0.75"      ; width factor
           "330"       ; obliquing angle
           ""          ;text backwards
           ""          ;upside-down
           ""          ;Vertical
           )
  (setq pt (getpoint "Pick The Point where you want the text "))
  (command "text" pt "330") ; exit the LISP without finishing the command TEXT
)
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.

bayoubuoy

  • Guest
Re: Isometric Text Request
« Reply #22 on: March 13, 2011, 09:02:30 AM »
CAB,
I'll be a son of gun.
I wanted thank you first before I do anything with the information you so graciously provided. I have dial-up internet and a slow computer (and brain) so my turn around time is very slow.

Update:
Perfect!, Perfect!, Perfect!. You made my day and I learned something.

Thanks again,
bayoubuoy
« Last Edit: March 13, 2011, 09:51:15 AM by bayoubuoy »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Isometric Text Request
« Reply #23 on: March 13, 2011, 12:08:58 PM »
Glad to help. :-)
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Isometric Text Request
« Reply #24 on: March 13, 2011, 07:21:42 PM »
Just created this version for my use. It may be of interest to you.
Note that if you press ENTER when asked to select the text you will be
in "Add Text Mode" and can add plain text using the ISO text style.

So use your normal buttons but before selecting the text press ENTER to add the text
to match the angle and oblique angle your button set up. To modify the ISO30 & ISO-30
style you can modify the lisp.
Code: [Select]
;;  CAB 03/13/2011
;;  (isotext TextAngle ObliqueAngle)
;;  Note that if you press ENTER when asked to select the text you will be
;;  in "Add Text Mode" and can add plain text using the ISO text style

(defun isotext (ang obl / *error* ent obj p dang styleName usrStyle)
  (vl-load-com)
  (defun dtr (D) (/ (* D pi) 180.0))  ; Degrees to Radians
  (defun rtd (R) (/ (* R 180.0) pi))  ; Radians to Degrees
  (defun *error* (msg)
    (if (not
          (member msg  '("console break" "Function cancelled" "quit / exit abort" "" nil)))
       (princ (strcat "\nError: " msg))
    )
    (and usrStyle (setvar "TEXTSTYLE" usrStyle))
    (princ)
  ) ; end error function

 
  (if (> ang 10)(setq dang ang ang (dtr ang))(setq dang (rtd ang)))
  (if (> obl 10)(setq obl (dtr obl)))
  (setvar "ErrNo" 0) ; reset variable
  (while
    (cond
      ((not (setq ent (car (entsel "\nSelect Plain Text: "))))
       (if (= 52 (getvar "ErrNo")) ; <Enter> was hit so add text
         (if (vl-consp (setq p (getpoint "\nPick point for text.")))
           (progn ; got a point, create the text styles if needed
             (or(tblsearch "style" "ISO30")(command "-style" "ISO30" "romans" "0" "0.75" "30" "" "" ""))
             (or(tblsearch "style" "ISO-30")(command "-style" "ISO-30" "romans" "0" "0.75" "330" "" "" ""))
             (setq usrStyle (getvar "TEXTSTYLE"))
             (setq styleName
               (cond
               ((equal obl 0.5236 0.0005) "ISO30")
               ((equal obl 5.7596 0.0005) "ISO-30")
               (usrStyle)
             ))
             (setvar "TEXTSTYLE" styleName)
             ;; If text height is undefined (signified by 0 in the table)
             (if (zerop (cdr(assoc 40(tblsearch "style" styleName))))
                (command ".text" "_non" p "" dAng "\\acedpause") ; current text height (textsize)
                (command ".text"  "_non" p dAng "\\acedpause")    ; use the defined text height
             ) ; endif
             (setvar "TEXTSTYLE" usrStyle)
             nil
           )
         )
         (princ "\nMissed Try again,")
       )
      )
      ((/= (vla-get-Objectname (setq obj (vlax-ename->vla-object ent))) "AcDbText")
       (princ "\n**  ERROR - Must be plain text  **")
      )
      ((vl-catch-all-error-p
         (vl-catch-all-apply
           '(lambda ()
              (vla-put-rotation obj ang)
              (vla-put-obliqueangle obj obl)
            )
         )
       )
       (princ "\n**  ERROR - Text can not be changed  **")
      )
    )
  )
  (princ)
)

<edit: revised code>
« Last Edit: March 13, 2011, 08:12: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.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Isometric Text Request
« Reply #25 on: March 15, 2011, 07:50:28 AM »
Here is one that I use every now and then.




ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

bayoubuoy

  • Guest
Re: Isometric Text Request
« Reply #26 on: March 15, 2011, 03:45:54 PM »
CAB,
Very cool, a twofer. One toolbar instead of two.
I'll add a help string about hitting enter to create isotext.

Have you tried your hand at an Isometric Dimensioning Program?
I have three, two old ones (Ed Lacoste and Bill DeShawn) and a 2006 model by Jeffery Sanders.
Mr. Sanders version is the most comprehensive but it does not allow for all the isometric planes
as in your isotext program and does not have the offset of extension line from origin (DIMEXO).
Everything else about it is right on.

Thanks for sharing.

TimSpangler,
Thanks for the offering, I've added it to my mtext collection.
« Last Edit: March 15, 2011, 07:49:01 PM by bayoubuoy »

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Isometric Text Request
« Reply #27 on: March 16, 2011, 12:01:16 AM »
OK here is one that I have used and works well except for dimensions.
http://cadtips.cadalyst.com/solids/iso-view-drafting-tool

Code: [Select]
;;; CADALYST 08/05 Tip 2052: Iso_Views.lsp ISO View Drafting Tool (c) Lloyd Beachy

;***********************************************************
;Iso_Views.lsp                        (c) 2005 Lloyd Beachy
;A routine to redraw objects into an isometric view        
;Works with lines, circles, arcs, text, lwplines, & splines
;***********************************************************

PS the DCL may have some spelling error so here is a working version
Code: [Select]
[color=green](write-line[/color]
iso : dialog {label="Isometric Views";
  : row {
    : boxed_column {label="Include:";
      : toggle {key="line";label="Lines";}
      : toggle {key="circle";label="Circles";}
      : toggle {key="arc";label="Arcs";}
      : toggle {key="text";label="Text";}
      : toggle {key="lwpolyline";label="LWPlines";}
      : toggle {key="spline";label="Splines";}
    }
    : boxed_column {label="Select drawing plane:";
      : row {
        spacer_0;
        : image_button {key="left";width=10;aspect_ratio=1;fixed_width=true;color=254;}
        : image_button {key="right";width=10;aspect_ratio=1;fixed_width=true;color=254;}
        spacer_0;
      }
      : row {
        spacer_0;
        : image_button {key="top_left";width=10;aspect_ratio=1;fixed_width=true;color=254;}
        : image_button {key="top_right";width=10;aspect_ratio=1;fixed_width=true;color=254;}
        spacer_0;
      }
      spacer;
    }
  }
  spacer;
  : row {:spacer{width=17;}cancel_button;help_button;spacer_1;}
}
[color=green])[/color]

CAB, do you mean that replace all these in red below with your working version above including the "write-line" brackets in green?
Code: [Select]
(setq file(open(strcat support "\\Iso_Views.dcl")"w"))
[color=red](write-line "iso : dialog {label=\"Isometric Views\";\n  : row {\n    : boxed_column {label=\"Include:\";" file)
(write-line "      : toggle {key=\"line\";label=\"Lines\";}\n      : toggle {key=\"circle\";label=\"Circles\";}" file)
(write-line "      : toggle {key=\"arc\";label=\"Arcs\";}\n      : toggle {key=\"text\";label=\"Text\";}" file)
(write-line "      : toggle {key=\"lwpolyline\";label=\"LWPlines\";}\n      : toggle {key=\"spline\";label=\"Splines\";}\n    }" file)
(write-line "    : boxed_column {label=\"Select drawing plane:\";\n      : row {\n        spacer_0;" file)
(write-line "        : image_button {key=\"left\";width=10;aspect_ratio=1;fixed_width=true;color=254;}" file)
(write-line "        : image_button {key=\"right\";width=10;aspect_ratio=1;fixed_width=true;color=254;}" file)
(write-line "        spacer_0;\n      }\n      : row {\n        spacer_0;" file)
(write-line "        : image_button {key=\"top_left\";width=10;aspect_ratio=1;fixed_width=true;color=254;}" file)
(write-line "        : image_button {key=\"top_right\";width=10;aspect_ratio=1;fixed_width=true;color=254;}" file)
(write-line "        spacer_0;\n      }\n      spacer;\n    }\n  }\n  spacer;" file)
(write-line "  : row {:spacer{width=17;}cancel_button;help_button;spacer_1;}\n}" file)[/color]
(close file)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Isometric Text Request
« Reply #28 on: March 16, 2011, 12:33:08 AM »
I'll look tomorrow but no not a replacement.
You can use one or the other.


More tomorrow..

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.

Biscuits

  • Swamp Rat
  • Posts: 502
Re: Isometric Text Request
« Reply #29 on: May 29, 2014, 02:03:11 PM »