rodi Posted June 15, 2017 Share Posted June 15, 2017 I need a lisp to convert lines or polylines to dimensions. Dim command actually does this by selecting object but i want to select multiple lines or plines at once and turn them into dimensions without leaving any lines behind. Can somebody help me with a lisp routine please? Quote Link to comment Share on other sites More sharing options...
rodi Posted June 16, 2017 Author Share Posted June 16, 2017 well i found this lsp. It works fine but it is for "polylines" only. How can i edit this to apply for "lines" also. Quote Link to comment Share on other sites More sharing options...
rodi Posted June 16, 2017 Author Share Posted June 16, 2017 (edited) (defun c:AD (/ *error* v l ss i) ;; Tharwat 06. August. 2014 ;; (defun *error* (u) (if v (mapcar 'setvar '(CMDECHO OSMODE) v) ) (if (wcmatch (strcase u) "*BREAK*,*CANCEL*,*EXIT*") (princ (strcat "\n ** Error : " msg " **")) ) ) (setq v (mapcar 'getvar '(CMDECHO OSMODE))) (princ "\n Select POLYLINES only ...") (if (setq ss (ssget '((0 . "LWPOLYLINE") (90 . 2)))) (progn (mapcar 'setvar '(CMDECHO OSMODE) '(0 0)) (repeat (setq i (sslength ss)) (setq l (mapcar 'cdr (vl-remove-if-not (function (lambda (p) (eq (car p) 10))) (entget (ssname ss (setq i (1- i)))) ) ) ) (command "._dimaligned" (car l) (cadr l) (polar (car l) (+ (* pi 0.5) (angle (car l) (cadr l))) 0.) ) ) ) ) (*error* nil) (princ) ) (vl-load-com) Edited June 22, 2017 by SLW210 Code Tags Quote Link to comment Share on other sites More sharing options...
rlx Posted June 16, 2017 Share Posted June 16, 2017 maybe (0 . "LWPOLYLINE") -> (0 . "LWPOLYLINE,LINE") or (0 . "*LINE") ? gr.Rlx Quote Link to comment Share on other sites More sharing options...
SLW210 Posted June 16, 2017 Share Posted June 16, 2017 Please read the Code Posting Guidelines and edit your Code to be included in Code Tags.[NOPARSE] Your Code Here[/NOPARSE] = Your Code Here Quote Link to comment Share on other sites More sharing options...
rodi Posted June 19, 2017 Author Share Posted June 19, 2017 (defun c:AD (/ *error* v l ss i) ;; Tharwat 06. August. 2014 ;; (defun *error* (u) (if v (mapcar 'setvar '(CMDECHO OSMODE) v) ) (if (wcmatch (strcase u) "*BREAK*,*CANCEL*,*EXIT*") (princ (strcat "\n ** Error : " msg " **")) ) ) (setq v (mapcar 'getvar '(CMDECHO OSMODE))) (princ "\nölçüsünü istediğin polyline ları seç") (if (setq ss (ssget '((0 . "LWPOLYLINE") (90 . 2)))) (progn (mapcar 'setvar '(CMDECHO OSMODE) '(0 0)) (repeat (setq i (sslength ss)) (setq l (mapcar 'cdr (vl-remove-if-not (function (lambda (p) (eq (car p) 10))) (entget (ssname ss (setq i (1- i)))) ) ) ) (command "._dimaligned" (car l) (cadr l) (polar (car l) (+ (* pi 0.5) (angle (car l) (cadr l))) 0.) ) ) ) ) (*error* nil) (princ) ) (vl-load-com) Quote Link to comment Share on other sites More sharing options...
rodi Posted June 19, 2017 Author Share Posted June 19, 2017 maybe (0 . "LWPOLYLINE") -> (0 . "LWPOLYLINE,LINE") or (0 . "*LINE") ? gr.Rlx nope that didnt work. Quote Link to comment Share on other sites More sharing options...
rlx Posted June 19, 2017 Share Posted June 19, 2017 nope that didnt work. probably you have to remove the (90 . 2) aswel so : (setq ss (ssget '((0 . "LWPOLYLINE,LINE")))) but I must admit that I have not tried Tharwats code , just looked at the ssget part (far to hot for coding pfff) gr. Rlx Quote Link to comment Share on other sites More sharing options...
rodi Posted June 20, 2017 Author Share Posted June 20, 2017 probably you have to remove the (90 . 2) aswel so : (setq ss (ssget '((0 . "LWPOLYLINE,LINE")))) but I must admit that I have not tried Tharwats code , just looked at the ssget part (far to hot for coding pfff) gr. Rlx thx but didn't work. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 20, 2017 Share Posted June 20, 2017 I need a lisp to convert lines or polylines to dimensions. Dim command actually does this by selecting object but i want to select multiple lines or plines at once and turn them into dimensions without leaving any lines behind. Can somebody help me with a lisp routine please? Here you go: (defun c:ad (/ *error* v l ss i) (vl-load-com) ;; Tharwat 06. August. 2014 ;; ;; RJP modified to include lines - 6.20.2017 (defun *error* (u) (and v (mapcar 'setvar '(cmdecho osmode) v)) (and u (wcmatch (strcase u) "*BREAK*,*CANCEL*,*EXIT*") (princ (strcat "\n ** Error : " msg " **")) ) ) (if (setq ss (ssget (list '(-4 . "<OR") '(-4 . "<AND") '(0 . "LWPOLYLINE") '(90 . 2) '(-4 . "AND>") '(0 . "LINE") '(-4 . "OR>") ) ) ) (progn (setq v (mapcar 'getvar '(cmdecho osmode))) (mapcar 'setvar '(cmdecho osmode) '(0 0)) (repeat (setq i (sslength ss)) (setq l (mapcar 'cdr (vl-remove-if-not (function (lambda (p) (member (car p) '(10 11)))) (entget (ssname ss (setq i (1- i)))) ) ) ) (command "._dimaligned" (car l) (cadr l) (polar (car l) (+ (* pi 0.5) (angle (car l) (cadr l))) 0.) ) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
rodi Posted June 21, 2017 Author Share Posted June 21, 2017 thank you ronjonp. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 21, 2017 Share Posted June 21, 2017 thank you ronjonp. You're welcome 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.