Author Topic: Combind lisps  (Read 2333 times)

0 Members and 1 Guest are viewing this topic.

mohan

  • Newt
  • Posts: 98
Combind lisps
« on: September 25, 2018, 05:14:11 AM »
Help to Combind 2 lisps

Code: [Select]
(defun c:AlignView (/ p1 p2 ang)
  (and
    (setq p1 (getpoint "\nFirst alignment point: "))
    (setq p2 (getpoint p1 "\nSecond alignment point: "))
    (setq ang (- (angle (trans p1 1 0) (trans p2 1 0))))
    (command "_.dview" "" "_twist" (angtos ang (getvar 'aunits) 16) "")
  )
  (princ)
)

Code: [Select]
(defun c:zo()(command "._zoom" "_end" pause "_end"))
thanks

"Save Energy"

kpblc

  • Bull Frog
  • Posts: 396
Re: Combind lisps
« Reply #1 on: September 25, 2018, 05:25:06 AM »
(defun c:combo()
  (c:alignview)
  (c:zoo)
  )

(defun c:reverse-combo()
  (c:zoo)
  (c:alignview)
  )
Sorry for my English.

mohan

  • Newt
  • Posts: 98
Re: Combind lisps
« Reply #2 on: September 26, 2018, 01:37:02 AM »
ok please help to Combine below two lisps as one
Code: [Select]
(defun c:AlignView (/ p1 p2 ang)
  (and
    (setq p1 (getpoint "\nFirst alignment point: "))
    (setq p2 (getpoint p1 "\nSecond alignment point: "))
    (setq ang (- (angle (trans p1 1 0) (trans p2 1 0))))
    (command "_.dview" "" "_twist" (angtos ang (getvar 'aunits) 16) "")
  )
  (princ)
)

Code: [Select]
(defun c:zw (/ pt1 pt2)
(if
  (and
   (setq pt1 (getpoint "\nSelect First Window Point: "))
   (setq pt1 (osnap pt1 "_end"))
   (setq pt2 (getpoint "\nSelect Second Window Point: "))
   (setq pt2 (osnap pt2 "_end"))
  )
   (command "._zoom" "_w" "_non" pt1 "_non" pt2) ; end zoom
)
(princ)
) ; end program

look forward to here from you soon as possible
"Save Energy"

ChrisCarlson

  • Guest
Re: Combind lisps
« Reply #3 on: September 26, 2018, 08:38:12 AM »
ok please help to Combine below two lisps as one
Code: [Select]
(defun c:AlignView (/ p1 p2 ang)
  (and
    (setq p1 (getpoint "\nFirst alignment point: "))
    (setq p2 (getpoint p1 "\nSecond alignment point: "))
    (setq ang (- (angle (trans p1 1 0) (trans p2 1 0))))
    (command "_.dview" "" "_twist" (angtos ang (getvar 'aunits) 16) "")
  )
  (princ)
)



Code: [Select]
(defun c:zw (/ pt1 pt2)
(if
  (and
   (setq pt1 (getpoint "\nSelect First Window Point: "))
   (setq pt1 (osnap pt1 "_end"))
   (setq pt2 (getpoint "\nSelect Second Window Point: "))
   (setq pt2 (osnap pt2 "_end"))
  )
   (command "._zoom" "_w" "_non" pt1 "_non" pt2) ; end zoom
)
(princ)
) ; end program

look forward to here from you soon as possible

Follow the advice from kpblc in the post above. It's nearly identical

mohan

  • Newt
  • Posts: 98
Re: Combind lisps
« Reply #4 on: September 26, 2018, 12:13:33 PM »
with one command
"Save Energy"

ChrisCarlson

  • Guest
Re: Combind lisps
« Reply #5 on: September 26, 2018, 02:50:20 PM »
Did you look how kpblc's function operated? With his "combo" and "reverse-combo" he is executing one lisp function and then immediately following with a second.

ScottMC

  • Newt
  • Posts: 191
Re: Combind lisps
« Reply #6 on: September 27, 2018, 04:47:42 PM »
Not Lisp but worth it!  This Macro will help some. It ops 3 commands, turn boundary to region and back, gets a boundary, then issues move of it [last] works well for me! Try it..

(setvar "hpbound" 0) Bo \ (setvar "hpbound" 1) ^C^Cmove;p;l;;
« Last Edit: July 10, 2021, 08:07:20 PM by ScottMC »