Dayananda Posted 1 hour ago Posted 1 hour ago I can get the Association list of a line with entget . Please help me feed to new values to this list. Quote
mhupp Posted 22 minutes ago Posted 22 minutes ago (edited) entget returns what are known as dxf codes. lines, arc, circles, and other all follow a pattern. these lisp will output to command prompt. ;;----------------------------------------------------------------------------;; ;; Dump all DXF Group Data (defun C:DumpIt (/ ent) (while (setq ent (car (entsel "\nSelect Entity to Dump"))) (mapcar 'print (entget ent '( "*"))) ) (princ) ) ;;----------------------------------------------------------------------------;; ;; Dump All Visual Lisp Methods and Properties for Selected Entity (defun C:VDumpIt (/ ent) (while (setq ent (car (entsel "\nSelect Entity to Dump"))) (vlax-Dump-Object (vlax-Ename->Vla-Object ent) t) ) (princ) ) Using entsel returns a point and an entity name. from that you can run entget and check if its a line. pick the endpoint closest to the selection point. then use entmod and entupd to update the line. or you could delete the line and remake it with entmakex with the newpoint. ;;----------------------------------------------------------------------------;; ;; Extend line to new point. ;; https://www.cadtutor.net/forum/topic/98936-change-a-length-of-line-by-feeding-a-new-end-point-to-the-association-list/ (defun c:EXTLINE ( / sel ent pick line sp ep newpt) (if (setq sel (entsel "\nSelect line near the end to extend: ")) (progn (setq ent (car sel) pt (cadr sel) ;point from entsel line (entget ent) ) (if (= (cdr (assoc 0 line)) "LINE") (progn (setq sp (cdr (assoc 10 line))) ;start point (setq ep (cdr (assoc 11 line))) ;end point of line (if (< (distance pt sp) (distance pt ep)) ;which point is closer to the entsel point (setq newpt (getpoint ep "\nSpecify new endpoint: ") line (subst (cons 10 newpt) (assoc 10 line) line) ) (setq newpt (getpoint sp "\nSpecify new endpoint: ") elist (subst (cons 11 newpt) (assoc 11 line) line) ) ) (entmod line) (entupd ent) ) (prompt "\nSelected entity is not a LINE.") ) ) ) (princ) ) Edited 10 minutes ago by mhupp Added notes to lisp 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.