Jump to content

For Join... Plz edit my attached lisp


Guest balajibth84

Recommended Posts

Guest balajibth84

Hai here Balaji..Actually now i am using the lisp for join(Tracking method)..While i am Join the 3 continues line(Line or Polyline) my lisp creating the unwanted vertex...But i want only 2 endpoint and midpoint vertex only ...So i want remove that unwanted remaining vertex.....Can you edit this lisp????

 

(defun c:j ()

(setvar "cmdecho" 0)

(setq lines (ssget (list (cons 0 "LINE,ARC,LWPOLYLINE,POLYLINE")))) ;POLYLINE added 300910 - will crash with 3D POLYLINES

(if lines

(progn

(while (> (sslength lines) 0)

(if (= (cdr (assoc 0 (entget (ssname lines 0)))) "LWPOLYLINE")

(progn

(command "pedit" (ssname lines 0) "j" lines "" "X")

(ssdel (ssname lines 0) lines)

)

(command "pedit" (ssname lines 0) "y" "j" lines "" "X")

)

(setq lines2 (ssadd))

(setq cnt 0 len (sslength lines))

(while (

(if (entget (ssname lines cnt))

(setq lines2 (ssadd (ssname lines cnt) lines2))

)

(setq cnt (1+ cnt))

)

(setq lines lines2)

 

)

(princ "\n......Tada!!")

)

(princ "\n....Doh!!")

)

(setvar "cmdecho" 1)

(princ)

)

Link to comment
Share on other sites

What you are asking for is possible but will require a bit of programming to take in count all the possible scenarios. Sounds like it would be easer just to trace over the lines with a polyline then erase the old ones.

Example if you draw two polylines one left to right and the other right to left then the starting points of each polyline is different. So if you have a polyline and a line connected end to end at the same angle to will have to determine where the start point is. This is easy if everything is drawn left to right or right to left but complicated if not.

But I did find this cool program free on a site and it works well for removing a vertex.

I don’t know who wrote it but they deserve credit

http://www.xanadu.cz/en/download.asp?file=AddV

Link to comment
Share on other sites

Guest balajibth84
What you are asking for is possible but will require a bit of programming to take in count all the possible scenarios. Sounds like it would be easer just to trace over the lines with a polyline then erase the old ones.

Example if you draw two polylines one left to right and the other right to left then the starting points of each polyline is different. So if you have a polyline and a line connected end to end at the same angle to will have to determine where the start point is. This is easy if everything is drawn left to right or right to left but complicated if not.

But I did find this cool program free on a site and it works well for removing a vertex.

I don’t know who wrote it but they deserve credit

http://www.xanadu.cz/en/download.asp?file=AddV

 

 

I tried ..But i cannt able to Find....Can u give exact path plz????i want to knw that lisp join+Remove vertex both are combined????bcoz 2 command we want use means better we will use cad actual command......

Link to comment
Share on other sites

I posted that lisp a few days ago.

 

If all you lines are 'in-line' i.e. following the same angle and at the same height then try this lisp. It will work even if the lines are drawin in different directions.

 

;linj - joins a series of lines into one line - does not check angles or joins
;
;
(defun c:linj ()
(setvar "cmdecho"  0)
(if (setq sset (ssget (list (cons 0 "line"))))
 (progn
  (setq cnt 0 ln (sslength sset))
  (setq la (cdr (assoc 8 (entget (ssname sset 0)))))
  (setq elist nil nlist nil)
  (command "undo" "g")
  (while (< cnt ln)
   (setq e1 (entget (ssname sset cnt))
     elist (append elist (list (setq p1e (car (trans (cdr (assoc 10 e1)) 0 1)))(setq p2e (car (trans (cdr (assoc 11 e1)) 0 1)))))
     nlist (append nlist (list (setq p1n (cadr (trans (cdr (assoc 10 e1)) 0 1)))(setq p2n (cadr (trans (cdr (assoc 11 e1)) 0 1)))))
     cnt (1+ cnt)
   )
  )
  (setq mae (apply 'max elist) mie (apply 'min elist)
    man (apply 'max nlist) miin (apply 'min nlist)
  )
  (if (< p1e p2e)
   (if (< p1n p2n)
    (entmake (list (cons 0 "line")
         (cons 8 la)
         (cons 10 (trans (list mie miin 0.0) 1 0))
         (cons 11 (trans (list mae man 0.0) 1 0))
       )
    )
    (entmake (list (cons 0 "line")
         (cons 8 la)
         (cons 10 (trans (list mie man 0.0) 1 0))
         (cons 11 (trans (list mae miin 0.0) 1 0))
       )
    )
   )
   (if (< p1n p2n)
    (entmake (list (cons 0 "line")
         (cons 8 la)
         (cons 10 (trans (list mae miin 0.0) 1 0))
         (cons 11 (trans (list mie man 0.0) 1 0))
       )
    )
    (entmake (list (cons 0 "line")
         (cons 8 la)
         (cons 10 (trans (list mae man 0.0) 1 0))
         (cons 11 (trans (list mie miin 0.0) 1 0))
       )
    )
   )
  )
  (command "erase" sset "")
  (command "undo" "end")
 )
)
(setvar "cmdecho" 1)
(princ)
)

Link to comment
Share on other sites

I posted that lisp a few days ago.

 

You should put your name on it then, so when people re-post it, everyone will know who wrote it.

Just like an artist signing his paintings, you should sign your code.

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