drdownload18 Posted June 10, 2018 Posted June 10, 2018 Hi, is it possible to make lisp routine which will move multiple selected texts to polyline vertexes. At first vertex i want text with smallest x coordinate and so on Sorry for my english. If its too complicated can you guys make routine which will do this: I pick polyline than text and that text moves to 1st vertex than i select another text and that text go to secound vertex and so on? Quote
Tharwat Posted June 10, 2018 Posted June 10, 2018 Hi, Welcome to CADTutor. This must be fun to write, so can you upload a sample drawing showing before and after running the program on objects? Quote
drdownload18 Posted June 10, 2018 Author Posted June 10, 2018 Hi,Welcome to CADTutor. This must be fun to write, so can you upload a sample drawing showing before and after running the program on objects? Hi, tnx I uploaded sample file here --> https://ufile.io/mx3ha Quote
Tharwat Posted June 10, 2018 Posted June 10, 2018 Its recommended to upload your files via this website for more secured issues. Hit on the button 'Go Advanced' on the right side hand below to be able to attach your drawing. Time to go to bed now, its too late here so would take a look tomorrow. Quote
drdownload18 Posted June 10, 2018 Author Posted June 10, 2018 File sample is in attachment. Thank you for fast reply and good night. Need lisp.dwg Quote
Grrr Posted June 10, 2018 Posted June 10, 2018 I haven't lisping for a while, heres something (will work on horizontal lwpolyline, as it sorts the points by X coordinate) : (defun C:test ( / vr SS GetCen i o pL ) (and (setq vr ( (lambda (f) (setvar 'errno 0) (f nil nil)) (lambda ( e enx ) (cond (enx (apply (function append) (mapcar (function (lambda (x) (if (= 10 (car x)) (list (append (cdr x) '(0.)))))) enx)) ) (e (f nil (member '(0 . "LWPOLYLINE") (entget e))) ) ( (= 52 (getvar 'errno)) nil) ( (= 7 (getvar 'errno)) (setvar 'errno 0) (f e nil)) ( (f (car (entsel "\nPick the polyline <exit>: ")) nil) ) ) ) ) ) (setq SS (ssget "_:L-I" '((0 . "TEXT")))) (progn ; (entmakex (list '(0 . "POINT")(cons 10 (GetCen (vlax-ename->vla-object (car (entsel))))))) (defun GetCen ( o / ll ur ) (vla-GetBoundingBox o 'll 'ur) (apply 'mapcar (cons '(lambda (a b) (* 0.5 (+ a b))) (mapcar 'vlax-safearray->list (list ll ur)))) ) (repeat (setq i (sslength SS)) (setq pL (cons (list (GetCen (setq o (vlax-ename->vla-object (ssname SS (setq i (1- i)))))) o) pL)) ) (foreach x (mapcar 'cons (vl-sort vr (function (lambda (a b) (< (car a) (car b))))) (vl-sort pL (function (lambda (a b) (< (caar a) (caar b))))) ) (princ (apply (function (lambda (a b c) (vlax-invoke a 'Move b c))) (reverse x))) ) ) ) (princ) ) (vl-load-com) (princ) Quote
hanhphuc Posted June 14, 2018 Posted June 14, 2018 I haven't lisping for a while, heres something (will work on horizontal lwpolyline, as it sorts the points by X coordinate) : (defun C:test ( / vr SS GetCen i o pL ) [b][color="red"](f nil nil)[/color][/b] @grrr nice recursive instead of ssget filter nomutt=1 in while loop Quote
ketxu Posted June 14, 2018 Posted June 14, 2018 @grrr nice recursive instead of ssget filter nomutt=1 in while loop Ohh... i'm feeling more difficult to understand ^^ Quote
hanhphuc Posted June 14, 2018 Posted June 14, 2018 Ohh... i'm feeling more difficult to understand ^^ hjj i came across undocumented var 'nomutt from Lee's function. credits to Lee. ((lambda (/ s ov) (setq ov (getvar 'nomutt)) (setvar 'nomutt 1) (while (not s) (princ[color="purple"] "\rPick the polyline <exit>: "[/color]) (setq s (ssget ":E:S+." '((0 . "LWPOLYLINE")))) ) (setvar 'nomutt ov) ((lambda (f) (f (entget (ssname s 0)))) '(( l) (if (setq l (member (assoc [color="red"]10[/color] l) l)) (cons (append (cdar l)[color="red"]'(0.00)[/color]) (f (cdr l))) ) ) ) ) ) To suppress unwanted command ecdo, using ssget filter ":S" which emulating entget function only single entity selected so i don't need : "Select objects : " 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.