John E Green Posted April 27, 2010 Posted April 27, 2010 Hi, I hope someone can help me!!! I have been searching high and low for an Autolisp routine to convert a polyline to a block, I found some that work but what I want to do is use the boundry command to create a ployline round a room, then convert the polyline to a block. I can create the polyline fine via Autolisp and I can convert an existing polyline to a block, but when I try and put the two together it goes all wrong. Any help or pointer would be very helpful. John Quote
Lee Mac Posted April 27, 2010 Posted April 27, 2010 This should convert selected objects to blocks: (defun c:obj2blk (/ BNME ENT I PT SS SUB) ;; Lee Mac ~ 11.02.10 (cond ( (not (setq ss (ssget '((0 . "~VIEWPORT")))))) ( (while (progn (setq bNme (getstring t "\nSpecify Block Name: ")) (cond ( (not (snvalid bNme)) (princ "\n** Invalid Block Name **")) ( (tblsearch "BLOCK" bNme) (princ "\n** Block Already Exists **")))))) ( (not (setq i -1 pt (getpoint "\nSpecify Base Point: ")))) (t (entmake (list (cons 0 "BLOCK") (cons 10 pt) (cons 2 bNme) (cons 70 0))) (while (setq ent (ssname ss (setq i (1+ i)))) (entmake (entget ent)) (and (= 1 (cdr (assoc 66 (entget (setq sub ent))))) (while (not (eq "SEQEND" (cdr (assoc 0 (entget (setq sub (entnext sub))))))) (entmake (entget sub))) (entmake (entget sub))) (entdel ent)) (entmake (list (cons 0 "ENDBLK") (cons 8 "0"))) (entmake (list (cons 0 "INSERT") (cons 2 bNme) (cons 10 pt))))) (princ)) Quote
John E Green Posted April 27, 2010 Author Posted April 27, 2010 Hi Lee, Thanks for such a prompt reply, I think I can see where I was going wrong now. I'll try you routine later. Many thanks 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.