Jump to content

How we can connect selected blocked with pline by lisp


hosyn

Recommended Posts

measure will do it. or divide
I 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.
Link to comment
Share on other sites

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 ..):unsure:

Link to comment
Share on other sites

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 ..):unsure:

Region Capture.jpg

Link to comment
Share on other sites

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 "")

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!:rofl: But, then, I started out using edlin.:shock:
Link to comment
Share on other sites

I didn't have any problem using it with my version!:rofl: But, then, I started out using edlin.:shock:

 

I'm VLIDE, all the way.

Link to comment
Share on other sites

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) .:)

Link to comment
Share on other sites

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)
)

Link to comment
Share on other sites

  • 1 year later...

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:( :(

Link to comment
Share on other sites

bigal i wanna select two block together with drag mouse ,i dont want select them one by one for that code.

Link to comment
Share on other sites

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???:cry:

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...