| LITIGATION GRAPHICS - COMPUTER ANIMATION - TECHNICAL ILLUSTRATION - CAD DRAFTING - AUTOLISP PROGRAMMING 3423 Rivers Edge Trail Houston, Texas 77339 281.359.1187 Copyright 2008 - Pixel Graphics, Inc. All rights reserved. |
| ;------------------------------------------------------------------------ ;- Command: midpts_line () ;- ;- Draws a line between the midpoints of two lines. ;- ;- Copyright 2008 Jeff Winship. All rights reserved. ;----------------------------------------------------------------5/3/2008 (defun c:midpts_line ()
(setq line1 (car (entsel "\nSelect the first line: "))) (setq line2 (car (entsel "\nSelect the second line: "))) |
| HOME | 3D ANIMATION | DIGITAL IMAGES | AUTOCAD DRAFTING | AUTOLISP PROGRAMMING | CONTACT & OTHER INFO | F.A.Q. |
| ;------------------------------------------------------------------------ ;- Command: midpts_line () ;- ;- Draws a line between the midpoints of two lines. ;- ;- Copyright 2008 Jeff Winship. All rights reserved. ;----------------------------------------------------------------5/3/2008 (defun c:midpts_line ()
(setq line1 (car (entsel "\nSelect the first line: "))) (setq line2 (car (entsel "\nSelect the second line: ")))
(setq pt1 (cdr (assoc 10 (entget line1)))) (setq pt2 (cdr (assoc 11 (entget line1)))) ;-- Get the endpoints of the second selected line (setq pt3 (cdr (assoc 10 (entget line2)))) (setq pt4 (cdr (assoc 11 (entget line2)))) |
| ;------------------------------------------------------------------------ ;- Function: midpt ( p1 p2 ) ;- Arguments: p1 is the starting point of the line ;- p2 is the ending point of the line ;- ;- Returns the midpoint of a line given two points. ;- ;- Copyright 2008 Jeff Winship. All rights reserved. ;----------------------------------------------------------------5/3/2008 (defun midpt (p1 p2 / Xavg Yavg Zavg)
(setq Xavg (/
2.0
(setq Yavg (/
2.0
(setq Zavg (/
2.0
(list Xavg Yavg Zavg) |
| ;------------------------------------------------------------------------ ;- Command: midpts_line () ;- ;- Draws a line between the midpoints of two lines. ;- ;- Copyright 2008 Jeff Winship. All rights reserved. ;----------------------------------------------------------------5/3/2008 (defun c:midpts_line ()
(setq line1 (car (entsel "\nSelect the first line: "))) (setq line2 (car (entsel "\nSelect the second line: ")))
(setq pt1 (cdr (assoc 10 (entget line1)))) (setq pt2 (cdr (assoc 11 (entget line1)))) ;-- Get the endpoints of the second selected line (setq pt3 (cdr (assoc 10 (entget line2)))) (setq pt4 (cdr (assoc 11 (entget line2)))) ;-- Find the midpoints of the lines (setq mid1 (midpt pt1 pt2)) (setq mid2 (midpt pt3 pt4)) ;-- Draw the line (command "line" mid1 mid2 "") |