Lee Mac Posted March 12, 2017 Share Posted March 12, 2017 I think you mean here is the solution. ........ Quote Link to comment Share on other sites More sharing options...
grouch19 Posted March 12, 2017 Author Share Posted March 12, 2017 Thanks Lee Works perfectly! Thanks BIGAL for all your help too. Appreciate the help guys! Quote Link to comment Share on other sites More sharing options...
Ajmal Posted July 1, 2021 Share Posted July 1, 2021 Dear Lee when i run the code its showing ; error: extra cdrs in dotted pair on input (defun c:insblk ( / blk cmd dwg ent enx idx lst scl sel ) (setq blk "Manhole") ;; Block Name (cond ( (not (or (tblsearch "block" blk) (and (setq dwg (findfile (strcat blk ".dwg"))) (progn (setq cmd (getvar 'cmdecho)) (setvar 'cmdecho 0) (command "_.-insert" dwg nil) (setvar 'cmdecho cmd) (tblsearch "block" blk) ) ) ) ) (princ (strcat "\nBlock \"" blk "\" not found or could not be defined.")) ) ( (setq sel (ssget "_:L" '((0 . "POLYLINE") (-4. "&=")(70 . (-4 . "<NOT")(-4 . "&=")(70 . 1)(-4 . "NOT>")))) (repeat (setq idx (sslength sel)) (setq ent (entnext (ssname sel (setq idx (1- idx)))) enx (entget ent) lst nil ) (while (= "VERTEX" (cdr (assoc 0 enx))) (setq lst (cons (cdr (assoc 10 enx)) lst) ent (entnext ent) enx (entget ent) ) ) (if (= 3 (length lst)) (progn (if (apply '< (setq scl (mapcar 'distance lst (cdr lst)))) (setq lst (reverse lst) scl (reverse scl) ) ) (if (minusp (sin (- (angle (car lst) (caddr lst)) (angle (car lst) (cadr lst))))) (setq lst (vl-list* (cadr lst) (car lst) (cddr lst))) ) (if (entmake (list '(000 . "INSERT") (cons 002 blk) (cons 010 (car lst)) (cons 041 (car scl)) (cons 042 (cadr scl)) (cons 050 (angle (car lst) (cadr lst))) ) ) (entdel (ssname sel idx)) ) ) ) ) ) ) (princ) )) 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.