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

  • 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…

  • AutoCAD/MS Access Frontends with SQL Backend Integration

    AutoCAD/MS Access Frontends with SQL Backend Integration Problem: Each Sub-Department at the Utilities Department of the University of Colorado at Boulder have specific requirements for spatial and spatial data and often, there is an overlap of information crucial to these sub-departments; operations, maintenance, management, etc. Equipment data is stored and maintained in an SQL database…

  • Legend AutoLisp

    (defun C:LEGEND () (prompt “\nBuilding legend list…\n”) ;Set variable to get the first element of table. (setq Frst T) (setq Counter 0) (setq CountBlk 0) ;Get all block names. (while (setq Tbdata (tblnext “BLOCK” Frst)) (setq Bname (dxf 2 Tbdata)) ;print all block names. (if (/= Bname nil) ;Discard dimension blocks. (if (/= “*” (substr…

  • TrainingTracking101

    The Importance of Training Tracking in Modern Organizations In today’s fast-paced business environment, continuous learning and development are crucial for maintaining a competitive edge. Training tracking systems have become an essential tool for organizations aiming to ensure their workforce remains skilled and compliant with industry standards. This article explores the significance of training tracking and…

  • Tblin AutoLisp Modes

    (defun c:tblin (/) ;Initialize counters. (setq Row 0) (setq Col 0) ;Change these variables to adjust row and columns. (setq OffCol 2) (setq OffRow 0.2) (setq ColMax 9) (setq eof 0) (setq Filename (FileToRead)) (setq FileHandler (open Filename “r”)) (while (= eof 0) (progn (while (< Col (* OffCol ColMax)) (progn (setq TextIn (read-line FileHandler))…