vsnap lisp

(DEFUN C:VSNAP (/)

; Sept. 25,97. By V.Mendez
; This function centers an object between two parallel lines.

(SETVAR “CMDECHO” 0)
(SETQ SelObj (ENTSEL “\nSelect Object : “))
(SETQ BPoint (GETPOINT “\nBase Point : “))
(COMMAND “OSNAP” “NONE”)
(COMMAND “OSNAP” “NEA”)
(SETQ Point1 (GETPOINT “\nFirst Point [nearest] : “))
(COMMAND “OSNAP” “PER”)
(SETQ Point2 (GETPOINT Point1 “\nSecond Point [Perpendicular] : “))
(COMMAND “OSNAP” “NONE”)
(SETQ X1 (CAR Point1)
Y1 (CADR Point1)
Z1 (CADDR Point1)
)
(SETQ X2 (CAR Point2)
Y2 (CADR Point2)
Z2 (CADDR Point2)
)
(SETQ XMid (/ (+ X2 X1) 2)
YMid (/ (+ Y2 Y1) 2)
ZMid (/ (+ Z2 Z1) 2)
)
(SETQ XObj (CAR BPoint)
YObj (CADR BPoint)
ZObj (CADDR BPoint)
)
(COND
((AND (= X1 X2) (= Y1 Y2)) (SETQ MidPoint (LIST XObj YObj ZMid)))
((AND (= X1 X2) (= Z1 Z2)) (SETQ MidPoint (LIST XObj YMid ZObj)))
((AND (= Y1 Y2) (= Z1 Z2)) (SETQ MidPoint (LIST XMid YObj ZObj)))
)
(COMMAND “MOVE” SelObj “” BPoint MidPoint)
(SETVAR “CMDECHO” 1)
)

Similar Posts

  • FLC Simulation

    A computer simulation application that applies statistical mechanics to predict pre-synthesis of Liquid Crystal properties from chemical structure is needed. As well as the creation of calculation, videoand data manipulation tools and a user interface. read more …

  • mcrouti3 lisp

    ; If an error (such as CTRL-C) occurs ; while this command is active… (defun at_err (st) (if (and (/= st “Function cancelled”) (/= st “quit / exit abort”)) (princ (strcat “\nError: ” st)) );end if ;Restore modified modes (setvar “regenmode” 1) (setvar “cmdecho” 1) (if (= (type rtfile) ‘FILE) (close rtfile) );end if (setq…

  • Nine Algorithms That Changed the World

    Nine Algorithms That Changed the World In the realm of computer science, algorithms reign supreme. They are the step-by-step procedures that enable computers to solve problems and make decisions.1 Some algorithms have had such a profound impact on the field that they have become essential tools for programmers and researchers alike. In this article, we…

  • Block AutoLISP Shortcuts

    ;;; SHORCUTS BY V. MENDEZ ;SHOWS THE BLOCK NAME OF AN ENTITY (DEFUN C:BB(/ bb name) (SETQ bb(entget(car(entsel)))) (SETQ name (cdr(assoc 2 bb))) (SETQ name (strcat “Block Name… ” name)) (ALERT name) (princ) ) ;SHOWS THE LAYER NAME OF AN ENTITY (DEFUN C:CC(/ bb name) (SETQ bb(entget(car(entsel)))) (SETQ name (cdr(assoc 8 bb))) (SETQ name (strcat…

  • MS Access Developer

    Help with design, development or repair of your Microsoft Access database. Some things about me: – 15 years of experience as an independent consultant for Access development projects – Many references. – Masters degree in Biostatistics. – Have taught business development at the Boulder Small Business Development Center. I can wrap my mind around just…

  • Plocky Lisp

    (Defun FC (Func N Xo dx) ( (Setq LP ‘()) (Setq Int (/ dx N) (Setq x (-Xo Int)) (Repeat (+ N 1) (Setq x (+x Int)) (Setq y (FuncA x)) (Setq LPP (List x y)) (Setq LP (Cons LPP LP)) ) ) ) (Defun FuncA (V) (* V V) ) (Defun DrawF (ListP) (Setq…