Jump to content

deleting a block and joining the 2 segments


ademontis

Recommended Posts

Ok folks, here is a cryout for help...

let's assume ytou have to erase blocks from some lines in a drawing, and join the 2 lines that were interrupted by the block...

 

I have this little Lisp but it doesn't seem to work.... and i cannot figure out why...

It should be loaded on AutoCAD2008.

 

Any ideas?

Thanks in advance

 

(defun C:DELSYM (/ setv01 setv02 setv03 tbver1 tbver2)

(setvar "CMDECHO" 0)

(setq setv01 (getvar "BLIPMODE")

setv02 (getvar "FLATLAND")

setv03 (getvar "CLAYER"))

(setvar "BLIPMODE" 0)

(setvar "FLATLAND" 0)

(SSBLC)

(DELBLC lstnbl)

(setq lstnbl nil)

(setvar "BLIPMODE" setv01)

(setvar "FLATLAND" setv02)

(prin1)

)

(defun SSBLC (/ sstot indice nbl1 ifblc)

(prompt "\nSELECT SYMBOL TO DELETE : ")

(setq sstot (ssget))

(setq indice 0)

(repeat (sslength sstot)

(setq nbl1 (ssname sstot indice)

ifblc (assoc 0 (entget nbl1))

ifblc (cdr ifblc))

(if (equal "INSERT" ifblc)

(setq lstnbl (cons nbl1 lstnbl))

)

(setq indice (1+ indice))

)

(if (not (equal (type lstnbl) 'LIST))

(progn

(prompt "nSYMBOL IS NOT A BLOCK")

(SSBLC)

)

)

)

(defun DELBLC (lstnbl / tblblo ptins ptmin ptmax lstdx scf angbl nbl noblo)

(while (not (equal (length lstnbl) 0))

(setq noblo (car lstnbl)

tblblo (entget noblo)

lstnbl (cdr lstnbl)

ptins (cdr (assoc 10 tblblo))

scf (cdr (assoc 41 tblblo))

scf (abs scf)

angbl (cdr (assoc 50 tblblo))

nbl (cdr (assoc 2 tblblo)))

(DETVT1 nbl)

(if (or (null lstdx) (equal (length lstdx) 1))

(prompt "\nIMPOSSIBLE TO JOIN PLINE")

(progn

(PTEXT lstdx scf ptins angbl)

(entdel noblo)

(PL1_2 ptmax ptmin setv03)

)

)

)

)

(defun PTEXT (lstdx scf ptins angbl / ltrm1 ltrm2 nnlist)

(if (not (equal (length lstdx) 2))

(progn

(setq ltrm1 (car lstdx)

ltrm2 (car lstdx)

lstdx (cdr lstdx)

nnlist (length lstdx))

(while (not (equal nnlist 0))

(setq ltrm1 (max ltrm1 (car lstdx))

ltrm2 (min ltrm2 (car lstdx))

lstdx (cdr lstdx)

nnlist (length lstdx))

)

(setq ltrm1 (* ltrm1 scf)

ltrm2 (* ltrm2 scf))

)

(setq ltrm1 (car lstdx)

ltrm1 (* ltrm1 scf)

ltrm2 (cadr lstdx)

ltrm2 (* ltrm2 scf)

lstdx nil)

)

(setq ptmin (polar ptins angbl ltrm1)

ptmax (polar ptins angbl ltrm2)

ptmin (osnap ptmin "end")

ptmax (osnap ptmax "end"))

)

(defun PL1_2 (ptmax ptmin setv03 / lstver entl1 entl2 vpl1 ptn nlin1 nlin2 lstv1

lstv2 lstvA lstvB play player lastpl envert)

(setq nlin1 (ssname (ssget ptmax) 0)

play (cdr (assoc 8 (entget nlin1))))

(if (not (equal setv03 play))

(setq player (assoc 8 (entget nlin1)))

)

(setq entl1 (entnext nlin1))

(VERPL1 entl1)

(setq lstv1 (reverse lstver)

nlin2 (ssname (ssget ptmin) 0)

entl2 (entnext nlin2)

lstver nil)

(VERPL1 entl2)

(setq lstv2 (reverse lstver)

vpl1 (car lstv1))

(if (or (and (equal (car vpl1) (car ptmax) 0.0005)

(equal (cadr vpl1) (cadr ptmax) 0.0005))

(and (equal (car vpl1) (car ptmin) 0.0005)

(equal (cadr vpl1) (cadr ptmin) 0.005)))

(setq lstvA (cdr lstv1)

lstvB (cdr (reverse lstv2)))

(setq lstvA (cdr lstv2)

lstvB (cdr (reverse lstv1)))

)

(repeat (length lstvB)

(setq lstvA (cons (car lstvB) lstvA)

lstvB (cdr lstvB))

)

(entdel nlin1)

(entdel nlin2)

(command "PLINE" (car lstvA))

(repeat (length lstvA)

(setq lstvA (cdr lstvA)

ptn (car lstvA))

(command ptn)

)

(command)

(if (not (null player))

(progn

(setq lastpl (entget (entlast))

lastpl (subst player (assoc 8 lastpl) lastpl))

(entmod lastpl)

)

)

)

(defun VERPL1 (envert / tbvert ptvert) ;construction of vertex list of the selected polyline

(setq tbvert (entget envert))

(while (equal (cdr (assoc 0 tbvert)) "VERTEX")

(setq ptvert (assoc 10 tbvert)

ptvert (cdr ptvert)

lstver (cons ptvert lstver)

envert (entnext envert)

tbvert (entget envert))

)

)

(defun DETVT1 (nbl / tblbl nent tbent) ;extraction of distances (dx dy dz) and related trim-point

(setq tblbl (tblsearch "block" nbl)

nent (cdr (assoc -2 tblbl)))

(while (not (null nent))

(setq tbent (entget nent))

(if (equal (cdr (assoc 0 tbent)) "POINT")

(if (and (not (equal (car (cdr (assoc 10 tbent))) 0.0))

(and (equal (cadr (cdr (assoc 10 tbent))) 0.0)

(equal (caddr (cdr (assoc 10 tbent))) 0.0)

)

)

(setq lstdx (cons (car (cdr (assoc 10 tbent))) lstdx))

)

)

(setq nent (entnext nent))

)

)

Link to comment
Share on other sites

Please use

 tags[/b].

 

Select the block, select the first line, select the second line, delete the block, and fillet the lines (you may need to check the angle of the nearest line segments for separate action).

Link to comment
Share on other sites

It might be easier to erase the block and use the AutoCAD 'Join' command.

 

Not when you have some 20 or 30 blocks.... and btw Join does't work with plines.

sorry, i though this was a serious forum.

Never mind.

Link to comment
Share on other sites

Not when you have some 20 or 30 blocks.... and btw Join does't work with plines.

 

Ok folks, here is a cryout for help...

let's assume ytou have to erase blocks from some lines in a drawing, and join the 2 lines that were interrupted by the block...

 

sorry, i though this was a serious forum.

Never mind.

 

And with a response like that, that's the last help you will receive from me.

Link to comment
Share on other sites

.... and btw Join does't work with plines.

 

That's not true . FYI the command :pedit would join them easily .:glare:

 

sorry, i though this was a serious forum.

 

That's completely disappointing and unrespectful . :x

 

And nobody here working for anyone , all are volunteers , kind , respectful , more than helpful and more than you could imagine .

Link to comment
Share on other sites

Not when you have some 20 or 30 blocks.... and btw Join does't work with plines.

sorry, i though this was a serious forum.

Never mind.

 

Dude, you post some poorly written code that you don't even know how to make work, and we're not serious? :lol:

 

What a schmuck... go back to where you came from:

 

190469520_b506b8643e.jpg

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