Author Topic: Isometric Text Request  (Read 21265 times)

0 Members and 1 Guest are viewing this topic.

bayoubuoy

  • Guest
Isometric Text Request
« on: March 10, 2011, 01:13:06 PM »
Hi Y'all,
Does anyone have a routine(s) from which I can set up a toolbar (vanilla 2005)
to change the plane (rotation and slant) of a previously created text string
in any one of the 8 options to any other of the options?
The text is created by three text styles, standard, iso30 and iso330.
The preferred operation would be to select the desired form from a toolbar button
that executes the appropiate function, then to select the text string to change?
I have used a commercial product that does this.

« Last Edit: March 10, 2011, 09:30:38 PM by bayoubuoy »

barc

  • Guest
Re: Isometric Text Request
« Reply #1 on: March 10, 2011, 01:17:49 PM »
Rather than a lisp,why not just define three text styles with different obliquing angles; vertical, +30 and -30.  Then you just need to modify the style of the appropriate text entities.

M-dub

  • Guest
Re: Isometric Text Request
« Reply #2 on: March 10, 2011, 01:26:21 PM »
For what it's worth...

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Isometric Text Request
« Reply #3 on: March 10, 2011, 03:00:50 PM »
I have collected, not tried, a few but they are old routines.

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 #4 on: March 10, 2011, 03:51:22 PM »
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]
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;}
}
« Last Edit: March 10, 2011, 03:55:13 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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Isometric Text Request
« Reply #5 on: March 10, 2011, 03:58:09 PM »
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: 12913
  • London, England
Re: Isometric Text Request
« Reply #6 on: March 10, 2011, 07:42:36 PM »
A fun one:

Code: [Select]
(defun c:isotext ( / e i j ) (vl-load-com) (setq i (/ 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-obliqueangle e (setq i (* i (setq j (- j)))))
    )
  )
  (princ)
)



Or, for a general object, one can use the appropriate transformation matrix to rotate the object about two axes:

Code: [Select]
;;-----------------=={ Isometric Projection }==---------------;;
;;                                                            ;;
;;  Isometrically Projects a VLA-Object or Point List using a ;;
;;  Transformation Matrix to the specified view.              ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  target - VLA-Object or Point List to transform            ;;
;;  p1     - Base Point for Transformation                    ;;
;;  view   - String specifying view: NE,NW,SE,SW              ;;
;;------------------------------------------------------------;;

(defun LM:IsometricProjection ( target p1 view )
  (
    (lambda ( m )
      (LM:ApplyMatrixTransformation target m (mapcar '- p1 (mxv m p1)))
    )
    (mxs
      (cadr
        (assoc view
          (list
            (list "SE"
              (list
                (list    (sqrt 3.)     (sqrt 3.)         0.    )
                (list       -1.            1.            2.    )
                (list    (sqrt 2.)  (- (sqrt 2.))    (sqrt 2.) )
              )
            )
            (list "SW"
              (list
                (list    (sqrt 3.)  (- (sqrt 3.))        0.    )
                (list        1.            1.            2.    )
                (list (- (sqrt 2.)) (- (sqrt 2.))    (sqrt 2.) )
              )
            )
            (list "NE"
              (list
                (list    (sqrt 3.)        0.      (- (sqrt 3.)))
                (list        1.           2.             1.    )
                (list    (sqrt 2.)  (- (sqrt 2.))    (sqrt 2.) )
              )
            )
            (list "NW"
              (list
                (list    (sqrt 3.)        0.         (sqrt 3.) )
                (list       -1.           2.             1.    )
                (list (- (sqrt 2.)) (- (sqrt 2.))    (sqrt 2.) )
              )
            )
          )
        )
      )
      (/ (sqrt 6.) 6.)
    )
  )
)

;;-----------=={ Apply Matrix Transformation }==--------------;;
;;                                                            ;;
;;  Transforms a VLA-Object or Point List using a             ;;
;;  Transformation Matrix                                     ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2010 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  target - VLA-Object or Point List to Transform            ;;
;;  matrix - 3x3 Matrix by which to Transform object          ;;
;;  vector - 3D translation vector                            ;;
;;------------------------------------------------------------;;

(defun LM:ApplyMatrixTransformation ( target matrix vector ) (vl-load-com)
  ;; © Lee Mac 2010
  (cond
    ( (eq 'VLA-OBJECT (type target))
     
      (vla-TransformBy target
        (vlax-tMatrix
          (append (mapcar '(lambda ( x v ) (append x (list v))) matrix vector)
           '((0. 0. 0. 1.))
          )
        )
      )
    )
    ( (listp target)

      (mapcar
        (function
          (lambda ( point ) (mapcar '+ (mxv matrix point) vector))
        )
        target
      )
    )       
  )
)

;; Matrix x Vector  -  Vladimir Nesterovsky
;; Args: m - nxn matrix, v - vector in R^n

(defun mxv ( m v )
  (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m)
)

;; Matrix x Scalar - Lee Mac 2010
;; Args: m - nxn matrix, n - real scalar

(defun mxs ( m s )
  (mapcar '(lambda ( r ) (mapcar '(lambda ( n ) (* n s)) r)) m)
)

Test Function:

Code: [Select]
(defun c:projectobject ( / e p v )
  (if
    (and
      (setq e (car (entsel)))
      (setq p (getpoint "\nBase Point: "))
      (progn
        (initget 1 "NE NW SE SW")
        (setq v (getkword "\nSelect View [NE/NW/SE/SW]: "))
      )
    )
    (LM:IsometricProjection (vlax-ename->vla-object e) (trans p 1 0) v)
  )
  (princ)
)

(Note: the above result will be 3D, remove Z-Coord to project to the XY-Plane)
« Last Edit: January 06, 2012, 07:46:50 AM by Lee Mac »

bayoubuoy

  • Guest
Re: Isometric Text Request
« Reply #7 on: March 10, 2011, 08:06:53 PM »
@CAB,
Thanks for the offerings. The following is my results:
Iso Text.lsp works, but is limited to three options. Also requires command line entry.
ISOCAD.LSP errored.
ISOMK.LSP works, but is limited to two options. Also requires command line entry.
ISO Text.lsp is for creating iso text.

@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.
« Last Edit: March 13, 2011, 12:20:41 AM by bayoubuoy »

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Isometric Text Request
« Reply #8 on: March 11, 2011, 07:24:48 AM »
@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  :|

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Isometric Text Request
« Reply #9 on: March 11, 2011, 07:29:04 AM »
@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  :|
I'm hesitant to implement it however as (now this is going to sound a bit OCD'ish) I feel it would spoil the logical cleanliness of the program - currently the code and interface is clean-cut: a list of collections and a list of items for each collection - introducing the metric/imperial filter would, I believe, only apply to a few collections hence making the code uglier... is it wrong to value the flow of the source code over the limited functionality of the program?

^-^
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Isometric Text Request
« Reply #10 on: March 11, 2011, 07:31:36 AM »
 :evil:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Isometric Text Request
« Reply #11 on: March 11, 2011, 08:30:07 AM »
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  **"))
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: 12913
  • London, England
Re: Isometric Text Request
« Reply #12 on: March 11, 2011, 08:31:36 AM »
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  **"))

I think that would be acceptable  :lol:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Isometric Text Request
« Reply #13 on: March 11, 2011, 08:38:56 AM »
@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.
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.

Stefan

  • Bull Frog
  • Posts: 319
  • The most I miss IRL is the Undo button
Re: Isometric Text Request
« Reply #14 on: March 11, 2011, 09:43:51 AM »
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)
)

Lee Mac

  • Seagull
  • Posts: 12913
  • 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 »

reltro

  • Guest
Re: Isometric Text Request
« Reply #30 on: May 30, 2014, 05:19:37 AM »
This may help to place an entitiy wich looks like to be isometric...

In this special case it is a block wich will be placed in 3D-space, but should be easy to modifiy for any kind of object...

Code - Auto/Visual Lisp: [Select]
  1. ;;;===============================================================================================
  2. ;;;                            ___...:::{INSERT BlockReference 3P}:::...___
  3. ;;;
  4. ;;;    Creates a BlockReference from three 3D-Points
  5. ;;;
  6. ;;;
  7. ;;;    ****
  8. ;;;    Author:    Reltro
  9. ;;;    Version:    1.0
  10. ;;;    Released:    29.06.2013
  11. ;;;    ****
  12. ;;;
  13. ;;;    Input:
  14. ;;;        - BlockName [STR]    ... Name of the BlockDefinition
  15. ;;;        - InsPt        [LST]     ... 3D-Point (WCS)
  16. ;;;        - xDir        [LST]     ... 3D-Point (WCS) - matches the positiv xDir of the BlockDefinition
  17. ;;;        - xyPlane    [LST]     ... 3D-Point (WCS) - matches the positiv-positiv xyPlane of the BlockDefinition
  18. ;;;
  19. ;;;        - xScale    [REAL]     ... ScaleFactor in xDirection
  20. ;;;        - yScale    [REAL]     ... ScaleFactor in yDirection
  21. ;;;        - zScale    [REAL]     ... ScaleFactor in zDirection
  22. ;;;        - zRot        [REAL]    ... Rotation around the zAxis (radians)
  23. ;;;
  24. ;;;    Return:
  25. ;;;        - BlockReference [VLA-Object]
  26. ;;;        
  27. ;;;===============================================================================================
  28. (defun InsBlockRef3P (BlockName InsPt xDir xyPlane xScale yScale zScale zRot / TransformationMatrix)
  29.  
  30.     (setq TransformationMatrix
  31.         (lambda (P1 P2 P3 / AAA tMatrix Rotation mxm)
  32.             ;;;-------------------------------------------------------------------------------------------
  33.             ;;;                    ___...:::{Abritrary Axis Algorithm}:::...___
  34.             ;;;
  35.             ;;; http://www.autodesk.com/techpubs/autocad/acadr14/dxf/arbitrary_axis_algorithm_al_u05_c.htm
  36.             (setq AAA
  37.                 (lambda (P1 P2 P3 / cross Ax Ay Az)
  38.                     (setq cross
  39.                         (lambda (V1 V2 / )
  40.                             (    (lambda (nV / o len)
  41.                                     (setq len (sqrt (apply '+ (foreach k nV (setq o (cons (expt k 2) o))))))
  42.                                     (mapcar '(lambda (a / ) (/ a len)) nV)
  43.                                 )
  44.                                 (mapcar
  45.                                     '(lambda (n / ) (- (* (nth (car n) V1) (nth (cadr n) V2)) (* (nth (cadr n) V1) (nth (car n) V2))))
  46.                                     '((1 2) (2 0) (0 1))
  47.                                 )
  48.                             )
  49.                         )
  50.                     )
  51.                     (setq    Az    (cross (mapcar '- P1 P2) (mapcar '- P1 P3))
  52.                             Ax    (if (and (< (abs (car Az)) (/ 1 64.0)) (< (abs (cadr Az)) (/ 1 64.0)))
  53.                                     (cross '(0 1 0) Az)
  54.                                     (cross '(0 0 1) Az)
  55.                                 )
  56.                             Ay    (cross Az Ax)
  57.                     )
  58.                     (list Ax Ay Az)
  59.                 )
  60.             )
  61.             ;;;-------------------------------------------------------------------------------------------
  62.  
  63.  
  64.             ;;;-------------------------------------------------------------------------------------------
  65.             (setq   mxm         (lambda (m v) (mapcar '(lambda (r) (apply '+ (mapcar '* r v))) m))
  66.                     Rotation    (lambda (V ang / m+m mxs vxs)
  67.                                     ;;; >>>>>>>>>
  68.                                     ;;; Lee Mac
  69.                                     (setq m+m   (lambda (m n) (mapcar '(lambda (r s) (mapcar '+ r s)) m n))
  70.                                              mxs    (lambda (m s) (mapcar '(lambda (r) (mapcar '(lambda (n) (* n s)) r)) m))
  71.                                              vxs     (lambda (v s) (mapcar '(lambda (n) (* n s)) v))
  72.                                     )
  73.  
  74.                                     (m+m
  75.                                         (list
  76.                                             (list (cos ang) 0. 0.)
  77.                                             (list 0. (cos ang) 0.)
  78.                                             (list 0. 0. (cos ang))
  79.                                         )
  80.                                         (m+m
  81.                                             (mxs
  82.                                                 (list
  83.                                                     (list 0. (- (nth 2 V)) (nth 1 V))
  84.                                                     (list (nth 2 V) 0. (- (nth 0 V)))
  85.                                                     (list (- (nth 1 V)) (nth 0 V) 0.)
  86.                                                 )
  87.                                                 (sin ang)
  88.                                             )
  89.                                             (mxs (mapcar '(lambda (e) (vxs V e)) V) (- 1. (cos ang)))
  90.                                         )
  91.                                     )
  92.                                     ;;; <<<<<<<<<
  93.                                 )
  94.             )
  95.             ;;;-------------------------------------------------------------------------------------------
  96.             (setq tMatrix (AAA P1 P2 P3))
  97.  
  98.             (append
  99.                 (mapcar
  100.                     '(lambda (v o / ) (append (mxm tMatrix v) (list o)))
  101.                     (Rotation
  102.                         (nth 2 tMatrix)
  103.                         (angle (mxm tMatrix P1) (mxm tMatrix P2))
  104.                     )
  105.                     P1
  106.                 )
  107.                 (list '(0 0 0 1))
  108.             )
  109.         )
  110.     )
  111.  
  112.         (vla-insertblock
  113.             (vlax-3d-point '(0 0 0))
  114.             BlockName
  115.             XScale
  116.             YScale
  117.             ZScale
  118.             zRot
  119.         )
  120.         (vlax-tMatrix (TransformationMatrix InsPt xDir xyPlane))
  121.     )
  122. )
  123.  



Edit : code=cadlisp-7
« Last Edit: August 10, 2014, 05:49:15 PM by Kerry »