land Posted December 25, 2022 Share Posted December 25, 2022 i need a lisp to draw line from mid ofr an arc to mid of chord automaticly image url example https://drive.google.com/file/d/13VR3l6ge5zm0jsHdiA_FkHkAhBN0RNch/view?usp=sharing Quote Link to comment Share on other sites More sharing options...
Isaac26a Posted December 25, 2022 Share Posted December 25, 2022 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)) ) 2 Quote Link to comment Share on other sites More sharing options...
land Posted January 10, 2023 Author Share Posted January 10, 2023 Quote Link to comment Share on other sites More sharing options...
Isaac26a Posted January 10, 2023 Share Posted January 10, 2023 (edited) Maybe this will help you. Run lisp program You have to copy the program and paste it into a text file and then change the extension from .txt to .lsp Edited January 10, 2023 by Isaac26a Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.