+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Senior Member 3dwannab's Avatar
    Computer Details
    3dwannab's Computer Details
    Operating System:
    Windows 7 Ultimate x64
    Computer:
    Self-Built
    Motherboard:
    Rampage II Extreme
    CPU:
    Intel(R) Core(TM) i7 CPU 965 @ 3.20GHz
    RAM:
    Corsair 12GB DDR3 XMS3 PC3-12800C9 1600MHz
    Graphics:
    ATI Radeon HD 4870 X2
    Primary Storage:
    512GB SSD
    Secondary Storage:
    2 x WD VelociRaptor 1000 GB Hard Drives @ 7,200RPM
    Monitor:
    32" HP LP3065 Wide LCD Moniter + 24" Dell
    Discipline
    Architectural
    3dwannab's Discipline Details
    Occupation
    arch technician and arch viz
    Discipline
    Architectural
    Details
    Office Tea Maker
    Using
    AutoCAD 2017
    Join Date
    Jun 2012
    Location
    Ireland
    Posts
    184

    Default Copy on X axis only and Y axis only

    Registered forum members do not see this ad.

    Hi all, good day.

    I have this script below which copies along the x and y axis with two separate commands. CX and CY.

    2 issues.

    1. I need it to regen every time I copy (There's a bug when I copy leaders at the moment) (command ".regen") has no effect.
    2. Copy multiple, After first copy the restraint no longer take effect.

    Thanks for any help.

    Code:
    ;;----------------------------------------------------------------------;;
    
    (defun c:CX ()
        (setq ss (ssget))
        (command "._copy" ss "" "M" pause ".yz" "@" pause)
        (command ".regen")
        (setq ss nil);; add this line to clean the selection
        (princ)
    
    )
    
    (defun c:CY ()
        (setq ss (ssget))
        (command "._copy" ss "" "M" pause ".xz" "@" pause)
        (command ".regen")
        (setq ss nil);; add this line to clean the selection
        (princ)
    )
    
    ;;----------------------------------------------------------------------;;
    
    (vl-load-com)
    (princ
        (strcat
            "\n:: Lock_Copy_X&Y.lsp loaded ::"
            "\n:: Invoke by typing 'CX' (Copy on X-axis) or 'CY' (Copy on Y-axis) ::"
        )
    )
    (princ)
    
    ;;----------------------------------------------------------------------;;
    ;;                             End of File                              ;;
    ;;----------------------------------------------------------------------;;
    GOT IT ANSWERED HERE (POST NO.4) by Roy_043:
    http://www.cadtutor.net/forum/showth...l=1#post699099
    Last edited by 3dwannab; 14th Mar 2018 at 04:47 pm.

  2. #2
    Senior Member 3dwannab's Avatar
    Computer Details
    3dwannab's Computer Details
    Operating System:
    Windows 7 Ultimate x64
    Computer:
    Self-Built
    Motherboard:
    Rampage II Extreme
    CPU:
    Intel(R) Core(TM) i7 CPU 965 @ 3.20GHz
    RAM:
    Corsair 12GB DDR3 XMS3 PC3-12800C9 1600MHz
    Graphics:
    ATI Radeon HD 4870 X2
    Primary Storage:
    512GB SSD
    Secondary Storage:
    2 x WD VelociRaptor 1000 GB Hard Drives @ 7,200RPM
    Monitor:
    32" HP LP3065 Wide LCD Moniter + 24" Dell
    Discipline
    Architectural
    3dwannab's Discipline Details
    Occupation
    arch technician and arch viz
    Discipline
    Architectural
    Details
    Office Tea Maker
    Using
    AutoCAD 2017
    Join Date
    Jun 2012
    Location
    Ireland
    Posts
    184

    Default

    Just giving this a little bump Thanks.

  3. #3
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,702

    Default

    Hit you in the face message

    Code:
    (Alert  ":: Lock_Copy_X&Y.lsp loaded ::\n\n\n:: Invoke by typing 'CX' (Copy on X-axis) or 'CY' (Copy on Y-axis) ::" )
    2nd suggestion
    Code:
    (defun c:CX ( / ss) this localises ss so no need for set nil
    If this is something your doing a lot you could use a smart reactor I would just type x100 it would then ask for objects and move accordingly type any number after the X x234 x45-6 there is a reason for 45-6 as the period causes an error in the routine.

    Code:
    ; Enter the filet radius as part of a command line entry f100 offset O234 circle c123-45 
    ; note - is used for decimal point
    ; original code and methology by Alan H
    ; assistance and code that worked by Lee-Mac
    ; OCT 2015
     
    ( (lambda nil
    (vl-load-com)
    (foreach obj (cdar (vlr-reactors :vlr-command-reactor))
    (if (= "fillet-reactor" (vlr-data obj))
    (vlr-remove obj)
    )
    )
    (vlr-command-reactor "fillet-reactor" '((:vlr-unknowncommand . fillet-reactor-callback)))
    )
    )
    (defun filletrad ( / rad)
    (setq rad (distof (substr com 2) 2))
    (if (<= 0.0 rad)
    (progn 
    (setvar 'filletrad rad)
    (vla-sendcommand fillet-reactor-acdoc "_.fillet ")
    )
    ) 
    )
    (defun makecirc ( / rad radd)
    (setq rad (distof (substr com 2) 2))
    (if (<= 0.0 rad)
    (progn 
    (setvar 'circlerad rad)
    (setq pt (getpoint "Pick centre pt")) 
    (vla-sendcommand fillet-reactor-acdoc "_.Circle !pt ") 
    )
    )
    )
    (defun offdist ( / dist)
    (setq dist (distof (substr com 2) 2))
    (if (<= 0.0 dist)
    (progn 
    (setvar 'offsetdist dist)
    (vla-sendcommand fillet-reactor-acdoc "_.Offset ")
    )
    )
    )
    (defun pipeoff ( / dist)
    (setq dist (distof (substr com 2) 2))
    (if (<= 0.0 dist)
    (progn
    (setq poff (strcat "P" (rtos dist 2 0)))
    (if (not poff)(load "Pipe offsets"))
    (vla-sendcommand fillet-reactor-acdoc poff)
    )
    )
    )
    (defun projopen ( / Proj year)
    (setq year (atoi (substr com 2 4)))
    (if (< year 2014) 
    (setq projno (strcat "EXPLORER \\\\cogg.local\\fs\\LCFC3\\DESIGN\\DATA\\" (substr com 2 4) " Projects\\" (substr com 2) "\\Design\\"))
    (setq projno (strcat "EXPLORER P:\\" (rtos year 2 0) " Projects\\" (substr com 2) "\\Design\\")) 
    )
    (vla-sendcommand fillet-reactor-acdoc (STARTAPP projno)) 
    )
     
    (defun fillet-reactor-callback ( obj com )
    (setq com (vl-string-translate "-" "." (strcase (car com))))
    (cond 
    ( (and
    (wcmatch com "~*[~F.0-9]*")
    (wcmatch com "F*")
    (wcmatch com "~F*F*")
    (wcmatch com "~*.*.*")
    ) ; and
    (filletrad) 
    ) 
    ( (and
    (wcmatch com "~*[~C.0-9]*")
    (wcmatch com "C*")
    (wcmatch com "~C*C*")
    (wcmatch com "~*.*.*")
    ) ;and
    (makecirc) 
    )
    ( (and
    (wcmatch com "~*[~O.0-9]*")
    (wcmatch com "O*")
    (wcmatch com "~O*O*")
    (wcmatch com "~*.*.*")
    ) ; and
    (offdist) 
    )
    ( (and
    (wcmatch com "~*[~D.0-9]*")
    (wcmatch com "D*")
    (wcmatch com "~D*D*")
    (wcmatch com "~*.*.*")
    ) ; and
    (projopen) 
    )
    ( (and
    (wcmatch com "~*[~P.0-9]*")
    (wcmatch com "P*")
    (wcmatch com "~P*P*")
    (wcmatch com "~*.*.*")
    ) ; and
    (pipeoff) 
    )
    ) ; master cond
    ) ; defun
    (or fillet-reactor-acdoc
    (setq fillet-reactor-acdoc (vla-get-activedocument (vlax-get-acad-object)))
    )
    A man who never made mistakes never made anything

  4. #4
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    685

    Default

    When using the _Multiple option of the _Copy command you obviously cannot rely on a fixed number of arguments for the command function.
    Code:
    (defun c:test ( / ss)
      (setq ss (ssget))
      (command "._copy" ss "" "_multiple" pause)
      (while (/= 0 (getvar 'cmdactive))
        (command ".yz" "@" pause)
      )
      (princ)
    )
    BricsCAD 18

  5. #5
    Full Member
    Using
    AutoCAD 2015
    Join Date
    Jun 2017
    Posts
    27

    Default

    why not use the copy command normally with ortho mode on?

  6. #6
    Senior Member 3dwannab's Avatar
    Computer Details
    3dwannab's Computer Details
    Operating System:
    Windows 7 Ultimate x64
    Computer:
    Self-Built
    Motherboard:
    Rampage II Extreme
    CPU:
    Intel(R) Core(TM) i7 CPU 965 @ 3.20GHz
    RAM:
    Corsair 12GB DDR3 XMS3 PC3-12800C9 1600MHz
    Graphics:
    ATI Radeon HD 4870 X2
    Primary Storage:
    512GB SSD
    Secondary Storage:
    2 x WD VelociRaptor 1000 GB Hard Drives @ 7,200RPM
    Monitor:
    32" HP LP3065 Wide LCD Moniter + 24" Dell
    Discipline
    Architectural
    3dwannab's Discipline Details
    Occupation
    arch technician and arch viz
    Discipline
    Architectural
    Details
    Office Tea Maker
    Using
    AutoCAD 2017
    Join Date
    Jun 2012
    Location
    Ireland
    Posts
    184

    Default

    Quote Originally Posted by FranknBeans View Post
    why not use the copy command normally with ortho mode on?
    Because see this. I have so many uses for it. Try snapping perpendicular to a point in x or y.

    Why did AD add-in a point filters for x, y & z if they didn't want us to use it?

    This is why.gif

    Quote Originally Posted by Roy_043 View Post
    When using the _Multiple option of the _Copy command you obviously cannot rely on a fixed number of arguments for the command function.
    Code:
    (defun c:test ( / ss)
      (setq ss (ssget))
      (command "._copy" ss "" "_multiple" pause)
      (while (/= 0 (getvar 'cmdactive))
        (command ".yz" "@" pause)
      )
      (princ)
    )
    This worked absolutly perfect. Thank you. Neat trick with the while. I'll keep this in mind.

    Quote Originally Posted by BIGAL View Post
    Hit you in the face message

    Code:
    (Alert  ":: Lock_Copy_X&Y.lsp loaded ::\n\n\n:: Invoke by typing 'CX' (Copy on X-axis) or 'CY' (Copy on Y-axis) ::" )
    2nd suggestion
    Code:
    (defun c:CX ( / ss) this localises ss so no need for set nil
    If this is something your doing a lot you could use a smart reactor I would just type x100 it would then ask for objects and move accordingly type any number after the X x234 x45-6 there is a reason for 45-6 as the period causes an error in the routine.

    Code:
    ; Enter the filet radius as part of a command line entry f100 offset O234 circle c123-45 
    ; note - is used for decimal point
    ; original code and methology by Alan H
    ; assistance and code that worked by Lee-Mac
    ; OCT 2015
     
    ( (lambda nil
    (vl-load-com)
    (foreach obj (cdar (vlr-reactors :vlr-command-reactor))
    (if (= "fillet-reactor" (vlr-data obj))
    (vlr-remove obj)
    )
    )
    (vlr-command-reactor "fillet-reactor" '((:vlr-unknowncommand . fillet-reactor-callback)))
    )
    )
    (defun filletrad ( / rad)
    (setq rad (distof (substr com 2) 2))
    (if (<= 0.0 rad)
    (progn 
    (setvar 'filletrad rad)
    (vla-sendcommand fillet-reactor-acdoc "_.fillet ")
    )
    ) 
    )
    (defun makecirc ( / rad radd)
    (setq rad (distof (substr com 2) 2))
    (if (<= 0.0 rad)
    (progn 
    (setvar 'circlerad rad)
    (setq pt (getpoint "Pick centre pt")) 
    (vla-sendcommand fillet-reactor-acdoc "_.Circle !pt ") 
    )
    )
    )
    (defun offdist ( / dist)
    (setq dist (distof (substr com 2) 2))
    (if (<= 0.0 dist)
    (progn 
    (setvar 'offsetdist dist)
    (vla-sendcommand fillet-reactor-acdoc "_.Offset ")
    )
    )
    )
    (defun pipeoff ( / dist)
    (setq dist (distof (substr com 2) 2))
    (if (<= 0.0 dist)
    (progn
    (setq poff (strcat "P" (rtos dist 2 0)))
    (if (not poff)(load "Pipe offsets"))
    (vla-sendcommand fillet-reactor-acdoc poff)
    )
    )
    )
    (defun projopen ( / Proj year)
    (setq year (atoi (substr com 2 4)))
    (if (< year 2014) 
    (setq projno (strcat "EXPLORER \\\\cogg.local\\fs\\LCFC3\\DESIGN\\DATA\\" (substr com 2 4) " Projects\\" (substr com 2) "\\Design\\"))
    (setq projno (strcat "EXPLORER P:\\" (rtos year 2 0) " Projects\\" (substr com 2) "\\Design\\")) 
    )
    (vla-sendcommand fillet-reactor-acdoc (STARTAPP projno)) 
    )
     
    (defun fillet-reactor-callback ( obj com )
    (setq com (vl-string-translate "-" "." (strcase (car com))))
    (cond 
    ( (and
    (wcmatch com "~*[~F.0-9]*")
    (wcmatch com "F*")
    (wcmatch com "~F*F*")
    (wcmatch com "~*.*.*")
    ) ; and
    (filletrad) 
    ) 
    ( (and
    (wcmatch com "~*[~C.0-9]*")
    (wcmatch com "C*")
    (wcmatch com "~C*C*")
    (wcmatch com "~*.*.*")
    ) ;and
    (makecirc) 
    )
    ( (and
    (wcmatch com "~*[~O.0-9]*")
    (wcmatch com "O*")
    (wcmatch com "~O*O*")
    (wcmatch com "~*.*.*")
    ) ; and
    (offdist) 
    )
    ( (and
    (wcmatch com "~*[~D.0-9]*")
    (wcmatch com "D*")
    (wcmatch com "~D*D*")
    (wcmatch com "~*.*.*")
    ) ; and
    (projopen) 
    )
    ( (and
    (wcmatch com "~*[~P.0-9]*")
    (wcmatch com "P*")
    (wcmatch com "~P*P*")
    (wcmatch com "~*.*.*")
    ) ; and
    (pipeoff) 
    )
    ) ; master cond
    ) ; defun
    (or fillet-reactor-acdoc
    (setq fillet-reactor-acdoc (vla-get-activedocument (vlax-get-acad-object)))
    )
    Thanks. I didn't look into reactor as Roy_043 anwswered. Thanks

    Here's my CX and CY command. Thanks again Roy_043.
    Code:
    ;;----------------------------------------------------------------------;;
    
    ; Answer on how to fix multiple copy by Roy_043 14.03.2018: http://www.cadtutor.net/forum/showthread.php?94798-Copy-on-X-axis-only-and-Y-axis-only&p=699099&viewfull=1#post699099
    ; Credit to Roy_043
    
    (defun c:CX ( / ss)
      (setq ss (ssget))
      (command "._copy" ss "" "_multiple" pause)
      (while (/= 0 (getvar 'cmdactive))
        (command ".yz" "@" pause)
      )
      (princ)
    )
    
    (defun c:CY ( / ss)
      (setq ss (ssget))
      (command "._copy" ss "" "_multiple" pause)
      (while (/= 0 (getvar 'cmdactive))
        (command ".xz" "@" pause)
      )
      (princ)
    )
    
    ;;----------------------------------------------------------------------;;
    
    (vl-load-com)
    (princ
        (strcat
            "\n:: Lock_Copy_X&Y.lsp loaded ::"
            "\n:: Invoke by typing 'CX' (Copy on X-axis) or 'CY' (Copy on Y-axis) ::"
        )
    )
    (princ)
    
    ;;----------------------------------------------------------------------;;
    ;;                             End of File                              ;;
    ;;----------------------------------------------------------------------;;

  7. #7
    Forum Newbie
    Discipline
    Construction
    Using
    AutoCAD 2018
    Join Date
    Apr 2018
    Posts
    1

    Default

    Great Lisp!

    I just started to started studying autolisp programming, I'll try to modify including "CZ" function and "CXY", "CXZ", "CYZ".
    Do you think that it'll work also for the move just replacing the _copy with _move?

    Thanks a lot!

  8. #8
    Senior Member 3dwannab's Avatar
    Computer Details
    3dwannab's Computer Details
    Operating System:
    Windows 7 Ultimate x64
    Computer:
    Self-Built
    Motherboard:
    Rampage II Extreme
    CPU:
    Intel(R) Core(TM) i7 CPU 965 @ 3.20GHz
    RAM:
    Corsair 12GB DDR3 XMS3 PC3-12800C9 1600MHz
    Graphics:
    ATI Radeon HD 4870 X2
    Primary Storage:
    512GB SSD
    Secondary Storage:
    2 x WD VelociRaptor 1000 GB Hard Drives @ 7,200RPM
    Monitor:
    32" HP LP3065 Wide LCD Moniter + 24" Dell
    Discipline
    Architectural
    3dwannab's Discipline Details
    Occupation
    arch technician and arch viz
    Discipline
    Architectural
    Details
    Office Tea Maker
    Using
    AutoCAD 2017
    Join Date
    Jun 2012
    Location
    Ireland
    Posts
    184

    Default

    Here's my move LISP.

    Code:
    ;;----------------------------------------------------------------------;;
    
    (defun c:MX ( / ss)
    
    	(setq *error* SS:error)
    	(SS:startundo)
    
    	(setq cmde (getvar "cmdecho"))
    	(setq os (getvar "osmode"))
    	(setq orthom (getvar "orthomode"))
    	(setvar 'cmdecho 0)
    	(setvar 'osmode 83)
    	(setvar 'orthomode 1)
    
    	(setq ss (ssget))
    	(command "._move" ss "" pause ".yz" "@" pause)
    	(setq ss nil)
    
    	(*error* nil)
    	(princ)
    	)
    (defun c:MY ( / ss)
    
    	(setq *error* SS:error)
    	(SS:startundo)
    
    	(setq cmde (getvar "cmdecho"))
    	(setq os (getvar "osmode"))
    	(setq orthom (getvar "orthomode"))
    	(setvar 'cmdecho 0)
    	(setvar 'osmode 83)
    	(setvar 'orthomode 1)
    
    	(setq ss (ssget))
    	(command "._move" ss "" pause ".xz" "@" pause)
    	(setq ss nil)
    
    	(*error* nil)
    	(princ)
    	)
    
    (defun SS:error (errmsg)
    	(and acDoc (vla-EndUndoMark acDoc))
    	(and errmsg
    		(not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*"))
    		(princ (strcat "\n<< Error: " errmsg " >>"))
    		)
    	(setvar 'cmdecho cmde)
    	(setvar 'osmode os)
    	(setvar 'orthomode orthom)
    	)
    
    (defun SS:startundo ()
    	(setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
    	(or (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc))
    	)
    
    (vl-load-com)
    
    (princ
    	(strcat
    		"\nLock_Move_X&Y.lsp loaded"
    		"\nInvoke by typing 'MX' (Move on X-axis) or 'MY' (Move on Y-axis)"
    		)
    	)
    (princ)
    
    ;;----------------------------------------------------------------------;;
    ;;                             End of File                              ;;
    ;;----------------------------------------------------------------------;;

  9. #9
    Senior Member 3dwannab's Avatar
    Computer Details
    3dwannab's Computer Details
    Operating System:
    Windows 7 Ultimate x64
    Computer:
    Self-Built
    Motherboard:
    Rampage II Extreme
    CPU:
    Intel(R) Core(TM) i7 CPU 965 @ 3.20GHz
    RAM:
    Corsair 12GB DDR3 XMS3 PC3-12800C9 1600MHz
    Graphics:
    ATI Radeon HD 4870 X2
    Primary Storage:
    512GB SSD
    Secondary Storage:
    2 x WD VelociRaptor 1000 GB Hard Drives @ 7,200RPM
    Monitor:
    32" HP LP3065 Wide LCD Moniter + 24" Dell
    Discipline
    Architectural
    3dwannab's Discipline Details
    Occupation
    arch technician and arch viz
    Discipline
    Architectural
    Details
    Office Tea Maker
    Using
    AutoCAD 2017
    Join Date
    Jun 2012
    Location
    Ireland
    Posts
    184

    Default

    Registered forum members do not see this ad.

    Here's my stretch one with other goodies in there.
    Code:
    ; Stretch All X
    (defun c:SX ( / ss)
    
    	(setq *error* SS:error)
    	(SS:startundo)
    
    	(setq cmde (getvar "cmdecho"))
    	(setq os (getvar "osmode"))
    	(setq orthom (getvar "orthomode"))
    	(setvar 'cmdecho 0)
    	(setvar 'osmode 83)
    	(setvar 'orthomode 1)
    
    	(progn
    		(setq ss (last (ssgetfirst)))
    		(if (not ss)
    			(setq ss (ssget))
    			)
    		(if ss
    			(progn
    				(command "._stretch" ss "" PAUSE ".yz" "@")
    				(setq ss nil)
    				)
    			(princ "\nUser Cancelled Command")
    			)
    		)
    
    	(*error* nil)
    	(princ)
    	)
    
    ; Stretch All Y
    (defun c:SY ( / ss)
    
    	(setq *error* SS:error)
    	(SS:startundo)
    
    	(setq cmde (getvar "cmdecho"))
    	(setq os (getvar "osmode"))
    	(setq orthom (getvar "orthomode"))
    	(setvar 'cmdecho 0)
    	(setvar 'osmode 83)
    	(setvar 'orthomode 1)
    
    	(progn
    		(setq ss (last (ssgetfirst)))
    		(if (not ss)
    			(setq ss (ssget))
    			)
    		(if ss
    			(progn
    				(command "._stretch" ss "" PAUSE ".xz" "@")
    				(setq ss nil)
    				)
    			(princ "\nUser Cancelled Command")
    			)
    		)
    
    	(*error* nil)
    	(princ)
    
    	)
    
    ; Stretch All MLeaders
    (defun c:SL ( / ss)
    
    	(setq *error* SS:error)
    	(SS:startundo)
    
    	(setq cmde (getvar "cmdecho"))
    	(setq os (getvar "osmode"))
    	(setq orthom (getvar "orthomode"))
    	(setvar 'cmdecho 0)
    	(setvar 'osmode 0)
    	(setvar 'orthomode 1)
    
    	(progn
    		(setq ss (last (ssgetfirst)))
    		(if (not ss)
    			(setq ss (ssget '((0 . "MULTILEADER"))))
    			)
    		(if ss
    			(progn
    				(command "_.stretch" ss "" "_non" PAUSE "_non" PAUSE)
    				(setq ss nil)
    				)
    			(princ "\nUser Cancelled Command")
    			)
    		)
    
    	(*error* nil)
    	(princ)
    
    	)
    
    ; Stretch All Leaders X
    (defun c:SLX ( / ss)
    
    	(setq *error* SS:error)
    	(SS:startundo)
    
    	(setq cmde (getvar "cmdecho"))
    	(setq os (getvar "osmode"))
    	(setq orthom (getvar "orthomode"))
    	(setvar 'cmdecho 0)
    	(setvar 'osmode 83)
    	(setvar 'orthomode 1)
    
    	(progn
    		(setq ss (last (ssgetfirst)))
    		(if (not ss)
    			(setq ss (ssget '((0 . "MULTILEADER"))))
    			)
    		(if ss
    			(progn
    				(command "._stretch" ss "" PAUSE ".yz" "@")
    				(setq ss nil)
    				)
    			(princ "\nUser Cancelled Command")
    			)
    		)
    
    	(*error* nil)
    	(princ)
    
    	)
    
    ; Stretch All Leaders Y
    (defun c:SLY ( / ss)
    
    	(setq *error* SS:error)
    	(SS:startundo)
    
    	(setq cmde (getvar "cmdecho"))
    	(setq os (getvar "osmode"))
    	(setq orthom (getvar "orthomode"))
    	(setvar 'cmdecho 0)
    	(setvar 'osmode 83)
    	(setvar 'orthomode 1)
    
    	(progn
    		(setq ss (last (ssgetfirst)))
    		(if (not ss)
    			(setq ss (ssget '((0 . "MULTILEADER"))))
    			)
    		(if ss
    			(progn
    				(command "._stretch" ss "" PAUSE ".xz" "@")
    				(setq ss nil)
    				)
    			(princ "\nUser Cancelled Command")
    			)
    		)
    
    	(*error* nil)
    	(princ)
    
    	)
    
    ; Stretch Important
    (defun c:SIM ( / ss)
    
    	(setq *error* SS:error)
    	(SS:startundo)
    
    	(setq cmde (getvar "cmdecho"))
    	(setq os (getvar "osmode"))
    	(setq orthom (getvar "orthomode"))
    	(setvar 'cmdecho 0)
    	(setvar 'osmode 83)
    	(setvar 'orthomode 1)
    
    	(progn
    		(setq ss (last (ssgetfirst)))
    		(if (not ss)
    			(setq ss (ssget '((0 . "~HATCH") (0 . "~TEXT") (0 . "~MTEXT") (8 . "~*text") (8 . "~*note") (8 . "~*dim"))))
    			)
    		(if ss
    			(progn
    				(command "_.stretch" ss "" PAUSE PAUSE)
    				(setq ss nil)
    				)
    			(princ "\nUser Cancelled Command")
    			)
    		)
    
    	(*error* nil)
    	(princ)
    
    	)
    
    ; Stretch dims only
    (defun c:SD ( / ss)
    
    	(setq *error* SS:error)
    	(SS:startundo)
    
    	(setq cmde (getvar "cmdecho"))
    	(setq os (getvar "osmode"))
    	(setq orthom (getvar "orthomode"))
    	(setvar 'cmdecho 0)
    	(setvar 'osmode 83)
    	(setvar 'orthomode 1)
    
    	(progn
    		(setq ss (last (ssgetfirst)))
    		(if (not ss)
    			(setq ss (ssget '((0 . "DIMENSION"))))
    			)
    		(if ss
    			(progn
    				(command "_.stretch" ss "" PAUSE PAUSE)
    				(setq ss nil)
    				)
    			(princ "\nUser Cancelled Command")
    			)
    		)
    
    	(*error* nil)
    	(princ)
    
    	)
    
    (defun SS:error (errmsg)
    	(and acDoc (vla-EndUndoMark acDoc))
    	(and errmsg
    		(not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*"))
    		(princ (strcat "\n<< Error: " errmsg " >>"))
    		)
    	(setvar 'cmdecho cmde)
    	(setvar 'osmode os)
    	(setvar 'orthomode orthom)
    	)
    
    (defun SS:startundo ()
    	(setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
    	(or (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc))
    	)
    
    (vl-load-com)
    
    (princ
    	(strcat
    		"\n3dwannab_Stretch_Commands.lsp Loaded"
    		"\nInvoke by typing 'S*'"
    		)
    	)
    (princ)
    
    ;;----------------------------------------------------------------------;;
    ;;                             End of File                              ;;
    ;;----------------------------------------------------------------------;;
    Last edited by 3dwannab; 12th Apr 2018 at 11:03 am.

Similar Threads

  1. Z axis to zero
    By andy_lee in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 8th May 2014, 10:39 am
  2. Z-axis
    By rah32d in forum AutoCAD 3D Modelling & Rendering
    Replies: 14
    Last Post: 3rd Feb 2010, 12:55 am
  3. z AXIS
    By gortex in forum AutoCAD Beginners' Area
    Replies: 3
    Last Post: 20th May 2006, 01:39 am
  4. Error: The UCS X axis and Y axis must be perpendicular
    By Gerardus in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 24th Jan 2006, 01:02 am
  5. Z axis messed up!!
    By mata in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 10th Nov 2005, 02:44 pm

Tags for this Thread

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