Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/25/2022 in all areas

  1. Welcome to Cadtutor Maybe this will help you, but if it's a polyline with more elements or it's a line this just won't work ;;; c2mpt Line from Midpoint of chord to Midpoint of an arc ;;; 20221225 Isaac A. ;;; https://www.cadtutor.net/forum/topic/76534-mid-line-from-center-arc-to-center-chord/ (vl-load-com) (defun c:c2mpt (/ a b c d e oe oo ve) (setq oe (getvar 'cmdecho) oo (getvar 'osmode) ) (setvar 'cmdecho 0) (vl-cmdf "_.undo" "_begin") (setvar 'osmode 37) (princ "\nProgram to create a line from midpoint of chord to midpoint of an arc ") (setq e (car (entsel "\nSelect the element: ")) ve (vlax-ename->vla-object e) a (vlax-curve-getStartPoint ve) b (vlax-curve-getEndPoint ve) c (ia:midp a b) d (if (= (cdr (assoc 0 (entget e))) "ARC") (vlax-curve-getPointAtDist ve (* 0.5 (vla-get-ArcLength ve))) (vlax-curve-getPointAtDist ve (* 0.5 (vla-get-length ve))) ) ) (vl-cmdf "line" "_non" c "_non" d "") (setvar 'osmode oo) (setvar 'cmdecho oe) (vl-cmdf "_.undo" "_end") (princ "\n") (princ) ) ;;; ia:midp ;;; Returns the midpoint of 2 given points (defun ia:midp (a b) (mapcar '* (mapcar '+ a b) '(0.5 0.5 0.5)) )
    1 point
×
×
  • Create New...