hosyn Posted May 17, 2013 Share Posted May 17, 2013 (edited) How we can connect selected blocked with pline by lisp.......... Edited June 9, 2014 by hosyn Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 18, 2013 Share Posted May 18, 2013 measure will do it. or divide Quote Link to comment Share on other sites More sharing options...
neophoible Posted May 19, 2013 Share Posted May 19, 2013 measure will do it. or divideI hope this answered your question. I, for one, could not understand the question at all. If the problem is not yet solved, please post a DWG of precisely what you are trying to achieve. Quote Link to comment Share on other sites More sharing options...
hosyn Posted May 19, 2013 Author Share Posted May 19, 2013 thnx to bigal and neophibl My question about when we located some block in drawing now need to command that when we selected that block after the run this command the block join together (.the base of this command Can be lisp or macro ..) Quote Link to comment Share on other sites More sharing options...
hosyn Posted May 19, 2013 Author Share Posted May 19, 2013 thnx to bigal and neophibl My question about when we located some block in drawing now need to command that when we selected that block after the run this command the block join together (.the base of this command Can be lisp or macro ..) Quote Link to comment Share on other sites More sharing options...
neophoible Posted May 20, 2013 Share Posted May 20, 2013 So, it looks like you want to simply draw a pline with a single straight section whose endpoints are the insertion points of two selected blocks. Is that right? If so, a simple macro would do the trick. In AutoLISP you could have: (command "pline" "ins" pause "ins" pause "") For international applicability, I should have written it (command "_.pline" "_ins" pause "_ins" pause "") Quote Link to comment Share on other sites More sharing options...
SLW210 Posted May 20, 2013 Share Posted May 20, 2013 I moved your thread to the AutoLISP, Visual LISP & DCL forum. Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 20, 2013 Share Posted May 20, 2013 If I understand correctly (untested): (defun c:l2b (/ lst) (if (and (AT:GetSel entsel "\nSelect first block: " (lambda (x / d) (if (eq (cdr (assoc 0 (setq d (entget (car x))))) "INSERT") (setq lst (list (assoc 10 d) (assoc 210 d))) ) ) ) (AT:GetSel entsel "\nSelect second block: " (lambda (x / d) (if (eq (cdr (assoc 0 (setq d (entget (car x))))) "INSERT") (setq lst (cons (assoc 10 d) lst)) ) ) ) ) (entmakex (append '((0 . "LWPOLYLINE") (100 . "AcDbEntity") (100 . "AcDbPolyline") (90 . 2)) lst)) ) (princ) ) (defun AT:GetSel (meth msg fnc / ent) ;; meth - selection method (entsel, nentsel, nentselp) ;; msg - message to display (nil for default) ;; fnc - optional function to apply to selected object ;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC"))) ;; Alan J. Thompson, 05.25.10 (while (progn (setvar 'ERRNO 0) (setq ent (meth (cond (msg) ("\nSelect object: ") ) ) ) (cond ((eq (getvar 'ERRNO) 7) (princ "\nMissed, try again.")) ((eq (type (car ent)) 'ENAME) (if (and fnc (not (fnc ent))) (princ "\nInvalid object!") ) ) ) ) ) ent ) Man, coding in Notepad, without formatting sucks. I can't believe I learned to code this way. Quote Link to comment Share on other sites More sharing options...
neophoible Posted May 20, 2013 Share Posted May 20, 2013 Man, coding in Notepad, without formatting sucks. I can't believe I learned to code this way.I didn't have any problem using it with my version! But, then, I started out using edlin. Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 20, 2013 Share Posted May 20, 2013 I didn't have any problem using it with my version! But, then, I started out using edlin. I'm VLIDE, all the way. Quote Link to comment Share on other sites More sharing options...
hosyn Posted May 20, 2013 Author Share Posted May 20, 2013 so thnx to all specially alanjet this lisp is next to my idea.are there a way for selecting the blocks for 2 more with drag mouse on them (no one by one choosing) . Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 21, 2013 Share Posted May 21, 2013 so thnx to all specially alanjet this lisp is next to my idea.are there a way for selecting the blocks for 2 more with drag mouse on them (no one by one choosing) . (defun c:l2b (/ ss) (if (and (setq ss (ssget '((0 . "INSERT")))) (eq (sslength ss) 2)) (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 2) (assoc 10 (entget (ssname ss 0))) (assoc 10 (entget (ssname ss 1))) (assoc 210 (entget (ssname ss 1))) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
hosyn Posted June 4, 2014 Author Share Posted June 4, 2014 Thanx to alanjt Your code work great . Is there a way for selecting blocks with "ssget" .?? I change "entget" with "ssget" but don,t act well:( Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 5, 2014 Share Posted June 5, 2014 hosyn you questions are to short you need to explain more, Alan Jt code is correct for selecting blocks they are known as "INSERT" Quote Link to comment Share on other sites More sharing options...
hosyn Posted June 5, 2014 Author Share Posted June 5, 2014 bigal i wanna select two block together with drag mouse ,i dont want select them one by one for that code. Quote Link to comment Share on other sites More sharing options...
hosyn Posted June 6, 2014 Author Share Posted June 6, 2014 Indead there are a lot of block in each drawing and i have to join them with ( pline or arc ) it's very easier than select them with drag mouse them instead select one by one . are there any suggestion for modify above code??? 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.