maahee Posted 3 hours ago Posted 3 hours ago (defun c:ctf (/ bm num i obj db p1 p2 midpt point_list table pt) (setvar "osmode" 0) ; Select all lines (setq bm (ssget '((0 . "LINE")))) (if bm (progn ; Get number of lines (setq num (sslength bm)) (setq i 0) (setq point_list '()) ; Initialize list to store points ; Loop through each line (repeat num (setq obj (ssname bm i)) ; Get entity name (setq db (entget obj)) ; Get entity data (setq p1 (cdr (assoc 10 db))) ; Start point (setq p2 (cdr (assoc 11 db))) ; End point ; Calculate midpoint (setq midpt (mapcar '/ (mapcar '+ p1 p2) '(2 2 2))) ; Store points in list (setq point_list (cons (list p1 p2 midpt) point_list)) (setq i (1+ i)) ) (setq pt (getpoint "\nSpecify table insertion point: ")) (if pt (progn ; Create table (command "._TABLE" 4 3 pt) ; Set header (command "._TABLEdit" "A1" "TEXT" "sr.no") (command "._TABLEdit" "B1" "TEXT" "Start Point") (command "._TABLEdit" "c1" "TEXT" "endPoint") (command "._TABLEdit" "D1" "TEXT" "mid Point") ; extract data of the lines and filling in cells of table ; point_list data stored ;autocad ver 2025 ) (princ "\nNo insertion point specified.") ) ) (princ "\nNo lines selected.") ) (setvar "osmode" 511) (princ) ) I need to help data automatically fill in the cells of the table table.dwg Quote
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.