+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Forum Newbie
    Using
    AutoCAD 2011
    Join Date
    Jun 2010
    Posts
    4

    Default ONE-CLICK commands

    Registered forum members do not see this ad.

    Please post here scripts that can be described as one-click commands.
    I hope these commands will be useful, mostly (but not only) while working in XYplane.

    For example I'll post first one: 'Rotate90degrees'.
    It is made by fixo and posted here as RS:
    http://www.cadtutor.net/forum/showth...t=24888&page=2 post #19
    I made slight modification to eliminate manual entering the rotation value.

    ;;rs.lsp
    ;;rotate selection set around its center 90 degrees
    (vl-load-com)

    )
    (defun C:RS90 (/ a axss lp maxp minp midp points rot ss up)
    (setq ss (ssget)
    axss (vla-get-activeselectionset
    (vla-get-activedocument
    (vlax-get-acad-object))))
    (vlax-for a axss
    (if (not (vl-catch-all-error-p
    (vl-catch-all-apply
    (function (lambda ()
    (vla-getboundingbox a 'minp 'maxp))))))
    (setq points (append (list (vlax-safearray->list minp)
    (vlax-safearray->list maxp))
    points)
    )
    )
    )
    (setq lp (car (vl-sort points
    (function (lambda (a b)
    (and (< (car a) (car b))
    (< (cadr a) (cadr b)))))))
    up (car (vl-sort points
    (function (lambda (a b)
    (and (> (car a) (car b))
    (> (cadr a) (cadr b)))))))
    )


    ; (vla-zoomwindow
    ; (vlax-get-acad-object)
    ; (vlax-3d-point lp)
    ; (vlax-3d-point up)
    ; )

    (setq midp (mapcar (function (lambda(a b)(/ (+ a b) 2.))) lp up))

    (initget 3)
    ;;;;;;;;;;;;;;;;;;;;;;;;;(setq rot (getreal "\nEnter a rotation angle in degrees: "))

    (vlax-for a axss
    (vl-catch-all-apply
    (function (lambda ()
    (vla-rotate a (vlax-3d-point midp) (* 90 (/ PI 180))))))

    )

    (princ)
    )
    (prompt "\n >>> Type RS90 to execute...")
    (prin1)
    It needs little tuning to work correctly with undo/redo but I don't know how and what to modify.
    Now I'll ask again fixo to modify above and post here MIRROR-X(about X axis) and MIRROR-Y(about Y axis) using same start point (middle of selection set).
    Last edited by tboy; 11th Jun 2010 at 01:56 pm.

  2. #2
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,687

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by tboy View Post
    Please post here scripts that can be described as one-click commands.
    I hope these commands will be useful, mostly (but not only) while working in XYplane.

    For example I'll post first one: 'Rotate90degrees'.
    It is made by fixo and posted here as RS:
    http://www.cadtutor.net/forum/showth...t=24888&page=2 post #19
    I made slight modification to eliminate manual entering the rotation value.

    It needs little tuning to work correctly with undo/redo but I don't know how and what to modify.
    Now I'll ask again fixo to modify above and post here MIRROR-X(about X axis) and MIRROR-Y(about Y axis) using same start point (middle of selection set).
    Instead of this code line to rotate 90 degrees
    Code:
    (vla-rotate a (vlax-3d-point midp) (* 90 (/ PI 180))))))
    use the following one
    Code:
    (vla-rotate a (vlax-3d-point midp) (/ PI 2.0))
    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

Similar Threads

  1. Adding Commands to Right click menu
    By Bowl.Spliffson in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 29th Apr 2010, 02:40 am
  2. Weird Problem: Have to click commands twice??
    By tzframpton in forum AutoCAD General
    Replies: 11
    Last Post: 14th Jan 2010, 07:55 pm
  3. Right Click
    By Ells in forum AutoCAD General
    Replies: 1
    Last Post: 11th Nov 2009, 05:29 pm
  4. how can i make 2 commands happen with one click of a toolbar button??
    By MikeP in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 5th Jan 2009, 08:32 pm
  5. right-click
    By fuccaro in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 18th Dec 2006, 01:27 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts