Custom viewcube’s command

Custom viewcube’s command

Anonymous
Not applicable
1,013 Views
9 Replies
Message 1 of 10

Custom viewcube’s command

Anonymous
Not applicable

Hi everyone,

 

Instead of click on viewcube or use command -view;top to change to the face which i wanted. I want create a command. ex ; i name its TOP1 then viewcube will change to TOP face. 

Thank you.

0 Likes
1,014 Views
9 Replies
Replies (9)
Message 2 of 10

CodeDing
Advisor
Advisor

@Anonymous ,

 

If you are familiar with the "-VIEW" command, which it sounds like you are, then the custom command would be very simple..

(command "_.-VIEW" "_o" "_t")

I'll let you handle the rest.

Best,

~DD

Message 3 of 10

marko_ribar
Advisor
Advisor

I couldn't find here on site topic where it's posted, so I pulled it from my library... It may be useful to you - it's something similar to navcube...

 

(defun C:VV ( / *error* vs? adoc cmde per vs d vc box osm 3dosm p x y z pp ); = ViewsNoZoom: Main function - global command function by Marko Ribar, d.i.a.

  (vl-load-com)

  (defun *error* ( m )
    (vla-sendcommand adoc "_.vscurrent\n!vscurrent\n(setq vscurrent nil)\nunisolateobjects\n")
    (if cmde
      (setvar 'cmdecho cmde)
    )
    (if per
      (setvar 'perspective per)
    )
    (if 3dosm
      (setvar '3dosmode 3dosm)
    )
    (if osm
      (setvar 'osmode osm)
    )
    (if (and box (not (vlax-erased-p box)))
      (entdel box)
    )
    (if (tblsearch "BLOCK" "DVIEWBLOCK")
      (if command-s
        (command-s "_.-PURGE" "_B" "DVIEWBLOCK" "_N")
        (vl-cmdf "_.-PURGE" "_B" "DVIEWBLOCK" "_N")
      )
    )
    (vla-endundomark adoc)
    (vla-regen adoc acactiveviewport)
    (if m
      (prompt m)
    )
    (princ)
  )

  (defun vs? ( / VpEnt VsLst vsname )

    (vl-load-com)

    (if (> (atoi (substr (getvar "ACADVER") 1 2)) 16)
      (progn
        (if (= (getvar "TILEMODE") 1)
          (setq VpEnt (vlax-vla-object->ename (vla-get-activeviewport (vla-get-activedocument (vlax-get-acad-object)))))
          (setq VpEnt (vlax-vla-object->ename (vla-get-activepviewport (vla-get-activedocument (vlax-get-acad-object)))))
        )
        (setq vsname (cdr (assoc 2 (entget (cdr (assoc 348 (entget VpEnt)))))))
      )
      (setq vsname "*")
    )
    (if (= vsname "*")
      (progn 
        (setq VsLst '("2D wireframe" "3D wireframe" "Hidden" "Flat" "Gouraud" "fLat+edges" "gOuraud+edges"))
        (setq vsname (nth (cdr (assoc 281 (entget VpEnt))) VsLst))
      )
    )
    vsname
  )

  (vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
  (vl-cmdf "_.REGEN")
  (setq cmde (getvar 'cmdecho))
  (setvar 'cmdecho 0)
  (setq per (getvar 'perspective))
  (setq vscurrent (strcase (vs?) t))
  (setq osm (getvar 'osmode))
  (setvar 'osmode 515)
  (setq pp (getpoint "\nPick or specify point to use it for center of view change  : "))
  (setvar 'osmode 0)
  (setq vs (getvar 'viewsize))
  (setq d (* vs 0.1))
  (vl-cmdf "_.box" "_c" (osnap (setq vc (if pp pp (getvar 'viewctr))) "none") "_c" (mapcar '+ vc (list d 0 0)))
  (setq box (entlast))
  (alert "Pick vertex or edge on cube to change view - to pick point on face of cube use \"m2p\" osnap")
  (if (getvar '3dosmode)
    (progn
      (setq 3dosm (getvar '3dosmode))
      (setvar '3dosmode 14)
    )
    (setvar 'osmode 3)
  )
  (vl-cmdf "_.isolateobjects" box "")
  (vl-cmdf "_.vscurrent" "_x")
  (setvar 'perspective 1)
  (setq p (getpoint "\nPick view point on CUBE..."))
  (cond
    ( (and (< (setq x (car (mapcar '- p vc))) 0) (< (setq y (cadr (mapcar '- p vc))) 0) (> (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VISWO)
    )
    ( (and (< (setq x (car (mapcar '- p vc))) 0) (> (setq y (cadr (mapcar '- p vc))) 0) (> (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VINWO)
    )
    ( (and (> (setq x (car (mapcar '- p vc))) 0) (> (setq y (cadr (mapcar '- p vc))) 0) (> (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VINEO)
    )
    ( (and (> (setq x (car (mapcar '- p vc))) 0) (< (setq y (cadr (mapcar '- p vc))) 0) (> (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VISEO)
    )
    ( (and (< (setq x (car (mapcar '- p vc))) 0) (< (setq y (cadr (mapcar '- p vc))) 0) (equal (setq z (caddr (mapcar '- p vc))) 0 1e-6) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)))
      (C:VISWZ)
    )
    ( (and (< (setq x (car (mapcar '- p vc))) 0) (> (setq y (cadr (mapcar '- p vc))) 0) (equal (setq z (caddr (mapcar '- p vc))) 0 1e-6) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)))
      (C:VINWZ)
    )
    ( (and (> (setq x (car (mapcar '- p vc))) 0) (> (setq y (cadr (mapcar '- p vc))) 0) (equal (setq z (caddr (mapcar '- p vc))) 0 1e-6) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)))
      (C:VINEZ)
    )
    ( (and (> (setq x (car (mapcar '- p vc))) 0) (< (setq y (cadr (mapcar '- p vc))) 0) (equal (setq z (caddr (mapcar '- p vc))) 0 1e-6) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)))
      (C:VISEZ)
    )
    ( (and (< (setq x (car (mapcar '- p vc))) 0) (< (setq y (cadr (mapcar '- p vc))) 0) (< (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VISWU)
    )
    ( (and (< (setq x (car (mapcar '- p vc))) 0) (> (setq y (cadr (mapcar '- p vc))) 0) (< (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VINWU)
    )
    ( (and (> (setq x (car (mapcar '- p vc))) 0) (> (setq y (cadr (mapcar '- p vc))) 0) (< (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VINEU)
    )
    ( (and (> (setq x (car (mapcar '- p vc))) 0) (< (setq y (cadr (mapcar '- p vc))) 0) (< (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VISEU)
    )
    ( (and (equal (setq x (car (mapcar '- p vc))) 0 1e-6) (< (setq y (cadr (mapcar '- p vc))) 0) (> (setq z (caddr (mapcar '- p vc))) 0) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VISO)
    )
    ( (and (equal (setq x (car (mapcar '- p vc))) 0 1e-6) (< (setq y (cadr (mapcar '- p vc))) 0) (< (setq z (caddr (mapcar '- p vc))) 0) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VISU)
    )
    ( (and (< (setq x (car (mapcar '- p vc))) 0) (equal (setq y (cadr (mapcar '- p vc))) 0 1e-6) (> (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VIWO)
    )
    ( (and (< (setq x (car (mapcar '- p vc))) 0) (equal (setq y (cadr (mapcar '- p vc))) 0 1e-6) (< (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VIWU)
    )
    ( (and (equal (setq x (car (mapcar '- p vc))) 0 1e-6) (> (setq y (cadr (mapcar '- p vc))) 0) (> (setq z (caddr (mapcar '- p vc))) 0) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VINO)
    )
    ( (and (equal (setq x (car (mapcar '- p vc))) 0 1e-6) (> (setq y (cadr (mapcar '- p vc))) 0) (< (setq z (caddr (mapcar '- p vc))) 0) (not (equal y 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VINU)
    )
    ( (and (> (setq x (car (mapcar '- p vc))) 0) (equal (setq y (cadr (mapcar '- p vc))) 0 1e-6) (> (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VIEO)
    )
    ( (and (> (setq x (car (mapcar '- p vc))) 0) (equal (setq y (cadr (mapcar '- p vc))) 0 1e-6) (< (setq z (caddr (mapcar '- p vc))) 0) (not (equal x 0 1e-6)) (not (equal z 0 1e-6)))
      (C:VIEU)
    )
    ( (and (equal (setq x (car (mapcar '- p vc))) 0 1e-6) (equal (setq y (cadr (mapcar '- p vc))) 0 1e-6) (> (setq z (caddr (mapcar '- p vc))) 0) (not (equal z 0 1e-6)))
      (C:VOO)
    )
    ( (and (equal (setq x (car (mapcar '- p vc))) 0 1e-6) (equal (setq y (cadr (mapcar '- p vc))) 0 1e-6) (< (setq z (caddr (mapcar '- p vc))) 0) (not (equal z 0 1e-6)))
      (C:VOU)
    )
    ( (and (> (setq x (car (mapcar '- p vc))) 0) (equal (setq y (cadr (mapcar '- p vc))) 0 1e-6) (equal (setq z (caddr (mapcar '- p vc))) 0 1e-6) (not (equal x 0 1e-6)))
      (C:VOE)
    )
    ( (and (equal (setq x (car (mapcar '- p vc))) 0 1e-6) (> (setq y (cadr (mapcar '- p vc))) 0) (equal (setq z (caddr (mapcar '- p vc))) 0 1e-6) (not (equal y 0 1e-6)))
      (C:VON)
    )
    ( (and (< (setq x (car (mapcar '- p vc))) 0) (equal (setq y (cadr (mapcar '- p vc))) 0 1e-6) (equal (setq z (caddr (mapcar '- p vc))) 0 1e-6) (not (equal x 0 1e-6)))
      (C:VOW)
    )
    ( (and (equal (setq x (car (mapcar '- p vc))) 0 1e-6) (< (setq y (cadr (mapcar '- p vc))) 0) (equal (setq z (caddr (mapcar '- p vc))) 0 1e-6) (not (equal y 0 1e-6)))
      (C:VOS)
    )
  )
  (*error* nil)
)
  
;;  ViewsNoZoom.lsp
;;  For changing to Predefined View directions (in World Coordinates), such as those in
;;  AutoCAD's "Views" Toolbar, BUT with the center of the view and the magnification
;;  remaining as they are, WITHOUT Zooming out to the drawing extents as AutoCAD's
;;  icons do.  Uses DVIEW and its Points option, not the AutoCAD icons' VIEW approach,
;;  or VPOINT.  Also includes Isometric Views from the BELOW-the-equator points of
;;  view (not available among AutoCAD's pre-defined icons).
;;  Uses abbreviations for compass directions for Orthogonal as well as Isometric views,
;;  and "Overhead" & "Underneath" in place of "Top" & "Bottom" or "Above" & "Below",
;;  to make it easier to remember for typing in, avoiding potential uncertainty for some
;;  directions, e.g. R could be for Right or Rear, B could be for Back, Below or Bottom.
;;
;;  Kent Cooper, June 2009

(defun ViewPredef ( dir pp / cmde vc )
  (setq cmde (getvar 'cmdecho))
  (setvar 'cmdecho 0)
  (if pp
    (setq pp (trans pp 1 0))
    (setq vc (trans (getvar 'viewctr) 1 0))
  )
  (vl-cmdf "_.ucs" "_w")
  (if pp
    (vl-cmdf "_.dview" "" "_points" "_none" pp "_none" dir "")
    (vl-cmdf "_.dview" "" "_points" "_none" vc "_none" dir "")
  )
  (vl-cmdf "_.ucs" "_p")
  (setvar 'cmdecho cmde)
  (princ)
); end defun

(defun C:VOO ( / dir ); = View: Orthogonal from Overhead
  (setq dir (trans (list 0 0 1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VOU ( / dir ); = View: Orthogonal from Underneath
  (setq dir (trans (list 0 0 -1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VOE ( / dir ); = View: Orthogonal from East
  (setq dir (trans (list 1 0 0) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VON ( / dir ); = View: Orthogonal from North
  (setq dir (trans (list 0 1 0) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VOW ( / dir ); = View: Orthogonal from West
  (setq dir (trans (list -1 0 0) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VOS ( / dir ); = View: Orthogonal from South
  (setq dir (trans (list 0 -1 0) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VINEO ( / dir ); = View: Isometric from NorthEast, Overhead
  (setq dir (trans (list 1 1 1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VINEZ ( / dir ); = View: Isometric from NorthEast, Zero elevation
  (setq dir (trans (list 1 1 0) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VINEU ( / dir ); = View: Isometric from NorthEast, Underneath
  (setq dir (trans (list 1 1 -1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VINWO ( / dir ); = View: Isometric from NorthWest, Overhead
  (setq dir (trans (list -1 1 1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VINWZ ( / dir ); = View: Isometric from NorthWest, Zero elevation
  (setq dir (trans (list -1 1 0) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VINWU ( / dir ); = View: Isometric from NorthWest, Underneath
  (setq dir (trans (list -1 1 -1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VISWO ( / dir ); = View: Isometric from SouthWest, Overhead
  (setq dir (trans (list -1 -1 1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VISWZ ( / dir ); = View: Isometric from SouthWest, Zero elevation
  (setq dir (trans (list -1 -1 0) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VISWU ( / dir ); = View: Isometric from SouthWest, Underneath
  (setq dir (trans (list -1 -1 -1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VISEO ( / dir ); = View: Isometric from SouthEast, Overhead
  (setq dir (trans (list 1 -1 1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VISEZ ( / dir ); = View: Isometric from SouthEast, Zero elevation
  (setq dir (trans (list 1 -1 0) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VISEU ( / dir ); = View: Isometric from SouthEast, Underneath
  (setq dir (trans (list 1 -1 -1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VISO ( / dir ); = View: Isometric from South, Overhead
  (setq dir (trans (list 0 -1 1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VISU ( / dir ); = View: Isometric from South, Underneath
  (setq dir (trans (list 0 -1 -1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VIWO ( / dir ); = View: Isometric from West, Overhead
  (setq dir (trans (list -1 0 1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VIWU ( / dir ); = View: Isometric from West, Underneath
  (setq dir (trans (list -1 0 -1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VINO ( / dir ); = View: Isometric from North, Overhead
  (setq dir (trans (list 0 1 1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VINU ( / dir ); = View: Isometric from North, Underneath
  (setq dir (trans (list 0 1 -1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VIEO ( / dir ); = View: Isometric from East, Overhead
  (setq dir (trans (list 1 0 1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(defun C:VIEU ( / dir ); = View: Isometric from East, Underneath
  (setq dir (trans (list 1 0 -1) 1 0 t))
  (ViewPredef (strcat "@" (rtos (car dir) 2 50) "," (rtos (cadr dir) 2 50) "," (rtos (caddr dir) 2 50)) pp)
); end defun

(princ)

 

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 4 of 10

pbejse
Mentor
Mentor

@Anonymous wrote:

Hi everyone,

 

Instead of click on viewcube or use command -view;top to change to the face which i wanted. I want create a command. ex ; i name its TOP1 then viewcube will change to TOP face. 

Thank you.


For me, i'm more curious is to why the need for a command when navcube is more convenient than typing a TOP1 for example?

 

0 Likes
Message 5 of 10

Anonymous
Not applicable

Hi @CodeDing thank you for pay attend to my post.

 

Could you explain more about it? 

0 Likes
Message 6 of 10

Anonymous
Not applicable

Thank you @marko_ribar. That's lot of thing to learn 😂

0 Likes
Message 7 of 10

CodeDing
Advisor
Advisor

@Anonymous ,

 

(defun c:TOP1 ( / )
  (command "_.-VIEW" "_o" "_t")
  (princ)
)
0 Likes
Message 8 of 10

Anonymous
Not applicable

Hi @pbejse,

 

For example, I name 4 = Left and 6 = right then when I want to translate from Left to right, I just need to click between 4 and 6 instead of click 2 times in the view cube.

 

 

0 Likes
Message 9 of 10

diagodose2009
Collaborator
Collaborator

I try convert allCommand/s to DCL dialog.

Why after I press "OK" then I got the error?

When I press double click on the List, then I  got very-good result.

;;;rem:Use this function only for DEBUG mode
(Defun ACRX_T(s183 / rr) (setq rr nil)
    (setq rr (if (=  (type s183) (quote STR))
          s183 (prompt "\nt183errorS**")))
rr)
(setq kHereAiciHeirIciAqui 0767004316 ;;rem: my-phone romanian
      errno 5100
      erprv nil)
;;;__ __ . __ __ . __ __ . __ __ . __ __ .__ __ . __ __ . __ __ . __ __ . __ __ .__ __ . __ __ . __ __ . __ __ . __ __ .
(defun dfn_var_isint0(a115 defvalue / rr) ;_ASSERT_OK
  (setq;|a534|;
	 rr (if (=  (type a115) (quote SYM)) (eval a115) a115)
	 rr (if (/= (type rr) (quote INT)) defvalue rr)) 
rr)
(defun asserte(a251 / rr) ;_ASSERT_OK
  (setq;|a1356|;
	 errno 0
	 acad__assertNo (if (/= (type acad__assertNo) (quote INT)) 0 (+ acad__assertNo 1))) (if (/= a251 nil) (setq;|a1402|;
	 erprv erlsp
	 erlsp (strcat "@" a251 "<" (itoa acad__assertNo) ">"))) (if (=  acad__assertNo kHereAiciHeirIciAqui) (alert (strcat "Hi! eBreakPoint kHereAiciHeirIciAqui=" (itoa kHereAiciHeirIciAqui)))) 
erlsp)
;;;__ __ . __ __ . __ __ . __ __ . __ __ .__ __ . __ __ . __ __ . __ __ . __ __ .__ __ . __ __ . __ __ . __ __ . __ __ .
;;Inf: Here is starting routine
(deFun C:q2() ;_ASSERT_OK
  (setq;|a1763|;
	 acad__assertNo 0) (if (and  (<  acad__assertNo (- 10)) (/= const_error nil)) (setq;|a1788|;
	 kHereAiciHeirIciAqui (- acad__assertNo))) 
  (autoexec_app)
)
(deFun C:autoexec_app()
     (autoexec_app )
)
(prompt "\nCommand.com=C:Q2[enter]\n")
(defun _pp_var1chk( ar1 ar2 ar3 / $rr)
  (terpri)
$rr)
(defun autoexec_app( / ) ;_ASSERT_OK
  (terpri) 
;------------------------Stdcall "nn_vmload "
  (setq _ax (nn_vmload ))
;------------------------

  (alert readme.txt) (princ "\nEnd") (dfn_cmd_canceld) 
)
 
(defun RenderCmds0h( / cpp);;
;;09sudo dpkg --add ;stdcall
;;13sudo fail --del "#endregion"
;;14sudo fail --del "≡¡║½½½½½½½½ε■ε■"
(setq RenderCmd.cpp 14));;



(defun nn_vmload(/ $rr rstr j_iaload j_bipush j_dload j_ret gap idx mcsCmd)
  (setq;|a4376|;
	 rstr (read "STR")
	 j_iaload (list "00.Voo= view: Orthogonal from Overhead" "01.Voe= view: Orthogonal from East" "02.Von= view: Orthogonal from North" "03.Vow= view: Orthogonal from West" "04.Vos= view: Orthogonal from South" "10.Vineo=Isometric.view from NorthEast, Overhead" "11.Vinez=Isometric.view from NorthEast, Zero elevation" "12.Vineu=Isometric from NorthEast, Underneath" "13.Vinwo=Isometric from NorthWest, Overhead" "14.Vinwz=Isometric from NorthWest, Zero elevation" "15.Vinwu=Isometric from NorthWest, Underneath" "16.Viswo=Isometric from SouthWest, Overhead" "17.Wiswz=Isometric from SouthWest, Zero elevation" "18.Wiswu=Isometric from SouthWest, Underneath")) (setq;|a4454|;
	 $rr (getvar "USERS1")) (setq;|a4467|;
	 $rr (if (>  $rr "") $rr "https://youtu.be/T6bZ9xa9d_U?list=RDT6bZ9xa9d_U")) (setq;|a4486|;
	 j_bipush (list $rr "-" "Custom viewcube~s command" "User=duyphatng92Views7replies" "H" "Necunoscut" "Alege3" "*" 30 30)) (setq;|a4535|;
	 $rr (dfn_dcl_onesel2 j_iaload j_bipush)) (setq;|a4556|;
	 j_ret ""
	 mcsCmd ""
	 j_dload "") (vl_load_com) (if (/= $rr nil) (progn  (setq;|a4603|;
	 j_dload (substr (car $rr) 1 3)
	 gap (atoi j_dload)
	 mcsCmd (if (>  gap 9) (substr (car $rr) 3 5) (if (<  gap 10) (substr (car $rr) 3 3) ""))))) (if (and (=  (type j_dload) rstr) (>  j_dload "")) (setvar "USERS1" j_dload)) (php_echo (list "\nmcscmd..=[" mcscmd "]" "\ngap.....=[" gap "]" "\nj_dload.=[" j_dload "]" "\n$rr.....=[" $rr "]")) 
j_dload)

(defun dfn_cmd_canceld( / $rr cx dx ch)  
  (setq;|a5616|;
	 ch (quote INT)
	 cx "CMDACTIVE"
	 dx (getvar cx)
	 dx (if (/= (type dx) ch) 0 (boole 1  dx 1))) (progn (while (>  dx 0) (setq;|a5688|;
	 dx (getvar cx)
	 dx (boole 1  dx 1)) (setq;|a5713|;
	 $rr (command "")))) (setq;|a5726|;
	 $rr (getvar "CMDNAMES")) (terpri) 
$rr)

;see lib/By:DragneAdrian
(Defun dfn_dcl_onesel2(ls0 f142 / rr dl tl kt dI m df ed i es eh eh2 el ws lst sc fc lh lw a mx)
  (asserte "F142") (setq;|a8289|;
	 fc "dfn_dcl_onesel2"
	 a f142
	 sc "1list") (if (=  2010 2011) (lm_unless (list ls0 sc a sc) fc)) (setq;|a8372|;
	 li (nth 0 a)
	 sc (nth 1 a)
	 dl (nth 2 a)
	 tl (nth 3 a)
	 kt (nth 4 a)
	 me (nth 5 a)
	 el (nth 6 a)
	 ws (nth 7 a)
	 lh (nth 8 a)
	 lw (nth 9 a)
	 ws (strcat "0NS" ws)
	 lst (dfn_list_wcmatch ls0 ws)) (setq;|a8576|;
	 mx (if (and (/= lst nil) (=  (type lst) (quote LIST))) (length lst) 0)) (setq;|a8616|;
	 li (dfn_int_minmax li 0 mx)) (if (=  me "") (setq;|a8645|;
	 me "Invalid element.")) (setq;|a8656|;
	 ed 0) (foreach i ls0 (setq;|a8677|;
	 ed (max ed (strlen i)))) (setq;|a8695|;
	 es (itoa ed)) (setq;|a8705|;
	 eh2 (+ (length lst) 1)) (setq;|a8721|;
	 eh (itoa (if (>  eh2 12) 12 20))) (setq;|a8743|;
	 eh2 (if lw (itoa lw) "50")
	 eh (if lh (itoa lh) eh)) 

 (sEtq t313 "" )
 (setq   t313 (strCat t313 "dfn_dcl_onesel2: dialog {\nsubassembly = 0;\nlabel = \"" 
	dl  "\";\ninitial_focus = \"1\";\n "));;
 (setq   t313 (strCat t313 " : text_part {label = \"" 
	tl  "\";}\n : column {\n key = \"controls\";\n : row {fixed_width = true;\n : edit_box {label = \"" 
	el  ":\";key = \"3\";edit_width = " 
	es  ";edit_limit = 100;}\n }\n : list_box {height = " 
	eh  ";width = " 
	eh2  ";key = \"1\";allow_accept = true;} \n }\n : text_part {key = \"" 
	kt  "\"; }\nok_cancel_err;\n}\n "))

  (setq;|a10097|;
	 dI (dfn_dcl_i_save t313 fc)
	 t313 "") (dfn_dcl_i_listupd "1" lst) (dfn_dcl_onesel2l li) (set_tile "3" (substr ws 4)) (setq;|a10157|;
	 eh (- 1)) (action_tile "1" "(dfn_dcl_onesel2L (atoi $value))") (action_tile "3" "(dfn_dcl_onesel2e $value)") (action_tile "accept" "(done_dialog 1)") (action_tile "cancel" "(setq lst ls0)(done_dialog 0)") (setq;|a10207|;
	 i (start_dialog)) (setq;|a10220|;
	 lst (if (and (=  i 1) (>= eh 0)) (list (nth eh lst)) (list ""))) (setq;|a10267|; sc nil me sc
	 li me) (unload_dialog dI) 
lst)
;Lib:free
(setq con_princeax "")
;;rem: you append one string each lines
(defun str_princ(a101 / rr ad gq)  (asserte "A101")
  (if (/= (type con_princeax) (quote STR)) (setq;|a11228|;
	 con_princeax "")) (if (=  (type a101) (quote STR)) (setq;|a11254|;
	 qq (list (princ a101) (princ con_princeax))) (progn  (if (=  (car a101) nil) (setq;|a11296|;
	 gq (textscr)
	 a101 (cdr a101))) (foreach ad a101 (princ ad) (princ con_princeax)))) 
nil)

(defun php_echo(a101 / rr) (str_princ a101))
;Lib:free
(defun vl_load_com(/ $rr)
 (if (null con_modspace)  (progn (vl-load-com) (prompt "\n\n")
 (setq vlax_true :Vlax-True
       vlax_false :Vlax-False
       kHomeRegistry "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD")
 (setq con_acadapp (vlax-get-acad-object))
 (setq con_acdoc (vla-get-activedocument con_acadapp))
 (setq con_acdocuments (vla-get-Documents (vlax-get-acad-object)))
 (setq con_acdocUtility (vla-get-utility con_acdoc))
 (setq con_modspace (vla-get-modelspace con_acdoc))
 (setq con_appwiz (vla-get-application con_acadapp))
 (setq con_chspace (vlax-get-property con_acdoc 
          (if (zerop (getvar "CVPORT")) (read "PaperSpace") (read "ModelSpace"))))
 ;; set a reference to the current model space
  ))
)
(defun dfn_int_minmax(nrdo mi17 mx90 / reti no1 no2 no3 tst)
  (setq;|a13304|;
	 tst (read "INT")
	 no1 (if (=  (type nrdo) tst) no1 (if (numberp nrdo) nrdo nil))
	 no2 (if (=  (type mi17) tst) mi17 (if (numberp mi17) mi17 nil))
	 no3 (if (=  (type mx90) tst) mx90 (if (numberp mx90) mx90 nil))
	 no1 (cond ( (and  (=  no1 nil) (/= no2 nil)) no2)( (and  (=  no1 nil) (/= no3 nil)) no3)( no1))) (if (=  no2 nil) (setq;|a13461|;
	 no2 no1)) (if (=  no3 nil) (setq;|a13478|;
	 no3 no1)) (if (>  no2 no3) (setq;|a13499|;
	 reti no2
	 no2 no3
	 no3 reti)) (setq;|a13528|;
	 reti (if (<  no1 no2) no2 no1)
	 reti (if (>  reti no3) no3 reti)) 
reti)

;;Inf:internal defun for dfn_dcl_onesel2
(Defun dfn_dcl_onesel2e(v164 / rr i v)
  (setq;|a14135|;
	 v v164) (set_tile "3" v) (setq;|a14156|;
	 v (strcat "0NS" v)
	 lst (dfn_list_wcmatch ls0 v)) (dfn_dcl_i_listupd "1" lst) (if (/= lst nil) (dfn_dcl_onesel2l 1)) (setq;|a14214|;
	 eh (- 1))) 

(Defun dfn_dcl_onesel2L(i164 / rr a i w)
  (set_tile "error" "") (if (=  (type i164) (quote INT)) (setq;|a14639|;
	 i i164
	 w (set_tile "1" (itoa i))
	 eh i)) 
)

(Defun dfn_list_wcmatch(a266 switch / ol rr os oi oa od of oc ob on og) (asserte "A266")
  (setq;|a17701|;
	 ol a266
	 on (length ol)
	 rr nil
	 os switch
	 oc (strcase (substr os 1 1))
	 ob (not (=  (strcase (substr os 2 1)) "Y"))
	 og (not (=  (strcase (substr os 3 1)) "S"))
	 os (substr os 4)
	 od (cond ( (=  oc ">") 1)( (=  oc "<") 2)( (=  oc "L") 3)( (=  oc "U") 4)( 0))) (if ob (setq;|a17901|;
	 os (strcase os))) (if og (setq;|a17918|;
	 ol (acad_strlsort ol))) (if (>  on 0) (progn (setq;|a17940|;
	 oi 0) (while (<  oi on) (progn  (setq;|a17959|;
	 oa (nth oi ol)) (if (=  (type oa) (quote STR)) (progn  (setq;|a17993|;
	 of (wcmatch (if ob (strcase oa) oa) os)
	 oa (cond ( (=  od 1) (strcat (strcase (substr oa 1 1) nil) (strcase (substr oa 2) T)))( (=  od 2) (strcat (strcase (substr oa 1 1) T) (strcase (substr oa 2) nil)))( (=  od 3) (strcase oa T))( (=  od 4) (strcase oa))( oa))) (setq;|a18174|;
	 rr (if of (append rr (list oa)) rr)))) (setq;|a18201|;
	 oi (+ oi 1)))))) 
rr)
(defun dfn_dcl_i_save(a110 fncn / rr dI qm nn fc) (asserte "A110")
  (setq;|a19360|;
	 qm nil
	 nn (vl-filename-mktemp "0user.dcl")
	 fc (open nn "w")) (if fc (progn  (write-line a110 fc) (close fc) (setq;|a19425|;
	 fc nil))) (setq;|a19434|;
	 dI (load_dialog nn)) (setq;|a19447|;
	 rr dI) (if (and  (>  dI (- 1)) (not (new_dialog fncn dI))) (setq;|a19483|;
	 qm "<a110error>Acad__eFileNotOpen\n <file>\n"
	 qm (strcat qm nn "</file>\n <defun>:" fncn "</defun>\n</a110error>")
	 rr (list (alert qm) (princ qm))
	 rr (- 3))) 
rr)
;Lib:free

(Defun dfn_dcl_i_listupd (b174 d174 / $rr) (asserte "B174")
  (setq;|a20185|;
	 $rr (if (and (/= d174 nil) (=  (type d174) (quote List))) (length d174) -5002)) (if (<  $rr 1) (setq;|a20233|;
	 d174 (list "" "d174errorA." "eInvalid ListStr"))) (start_list b174) (mapcar 'add_list d174) (end_list) 
$rr)
;Lib:free
 ;;{$R -cad_amain_eof T229@:020324run="devcinfo.exe   }
(prompt "\ncommand.com=q2[enter]\n")

(Setq readMe.txt "\n
Instead of click on viewcube or use comma-
nd -view;top to change to the face which 
i wanted. I want create a command. ex ; i-
 name its TOP1 then viewcube will change 
to TOP face 	«zlib=Instead of click on vi-
ewcube or use command -view;top to change-
 to the face which i wanted. I want creat-
e a command. ex ; i name its TOP1 then vi-
ewcube will change to TOP face»")


0 Likes
Message 10 of 10

Sea-Haven
Mentor
Mentor

Something like this need a defun for each line. P is top. Pulled out of other code that sets Look

 

(if (= look "R")(command-s "-vpoint" "1,0,0"))
(if (= look "L")(command-s "-vpoint" "-1,0,0"))
(if (= look "F")(command-s "-vpoint" "0,-1,0"))
(if (= look "B")(command-s "-vpoint" "0,1,0"))
(if (= look "P")(command-s "-vpoint" "0,0,1"))

 

 

0 Likes