;;; 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
;***********************************************************
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;}
}
(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)
)
;;-----------------=={ 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)
)
(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)
)
@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.
@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?^-^
(or (eq (vla-get-Objectname (setq e (vlax-ename->vla-object e))) "AcDbText")
(prompt "\n** ERROR - Must be plain text **"))
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,
Thanks for the offerings.
(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)
)
CAB,@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.
Perhaps this wouldn't be too much. :evil:CAB,Code: [Select](or (eq (vla-get-Objectname (setq e (vlax-ename->vla-object e))) "AcDbText")
(prompt "\n** ERROR - Must be plain 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.
Thanks Bayoubuoy 8-)
I could incorporate the vertical views, but this would unfortunately disrupt the concision of the code :|
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)
)
(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 think this will work with your buttons.CAB,
Just call it with the angle & oblique angle.
^C^C(isotext 30 330)
(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.**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 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
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.
(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
)
;; 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)
)
OK here is one that I have used and works well except for dimensions.
http://cadtips.cadalyst.com/solids/iso-view-drafting-toolCode: [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 versionCode: [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]
(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)
Here is one that I use every now and then.
(https://lh4.googleusercontent.com/_3z5WTth5NVI/TX9SP3OJZHI/AAAAAAAAA78/72Rs18OgvHY/s288/IsoText.png)