Jump to content

EXTRIM Between Two Lines


sidhu412

Recommended Posts

Bingooooooooooo

 

Great.........!

That's 100% What I needed You are Genius Mr. Marko_Ribar.

 

Thanxxxxxx a lot

 

Regards,

 

 

Sidhu

 

You're welcome, Sidhu...

All the best in your work, I hope you'll find useful posted code...

 

M.R.

Link to comment
Share on other sites

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • marko_ribar

    7

  • sidhu412

    6

  • ReMark

    5

  • OMEGA-ThundeR

    3

Top Posters In This Topic

Posted Images

Thanks Greg, I've cleaned code further more... Had mistake in checking weather picked entities belong to curve entities... Now fixed that issue and also changed defined functions to be local to main command function... This version I use now in my start-up acaddoc.lsp...

 

(defun c:exb2c ( / colect_entdata store_entdata colect_modified_entdata sel_mod_ents 
                  hig osm c1 c2 p ss entdata )

 (defun colect_entdata ( / ss i ent entdata )
   (setq ss (ssget "_X"))
   (setq i -1)
   (while (setq ent (ssname ss (setq i (1+ i))))
     (setq entdata (cons (entget ent) entdata))
   )
   entdata
 )

 (defun store_entdata nil
   (setq entdata (colect_entdata))
   (princ)
 )

 ;;; Modify entities ;;;

 (defun colect_modified_entdata ( / ss i ent entdatachk entdatamod )
   (setq ss (ssget "_X"))
   (setq i -1)
   (while (setq ent (ssname ss (setq i (1+ i))))
     (setq entdatachk (cons (entget ent) entdatachk))
   )
   (foreach data entdatachk
     (if (not (vl-some '(lambda ( x ) (equal x data 1e-6)) entdata))
       (setq entdatamod (cons data entdatamod))
     )
   )
   entdatamod
 )

 (defun sel_mod_ents nil
   (setq ss (ssadd))
   (foreach data (colect_modified_entdata)
     (ssadd (cdr (assoc -1 data)) ss)
   )
   (princ)
 )

 ;;; Main function ;;;

 (vl-load-com)

 (setq hig (getvar 'highlight))
 (setq osm (getvar 'osmode))
 (setvar 'osmode 0)
 (if (not (or etrim (not (vl-catch-all-error-p (vl-catch-all-apply 'load (list (findfile "extrim.lsp")))))))
   (progn
     (alert "\nExpress Tool EXTRIM not available - quitting...")
     (exit)
   )
 )
 (setq c1 (car (entsel "\nPick first curve")))
 (while (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getstartparam (list c1)))
   (prompt "\nPicked entity isn't curve entity. Try again...")
   (setq c1 (car (entsel "\nPick first curve")))
 )
 (setq c2 (car (entsel "\nPick second curve")))
 (while (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getstartparam (list c2)))
   (prompt "\nPicked entity isn't curve entity. Try again...")
   (setq c2 (car (entsel "\nPick second curve")))
 )
 (initget 1)
 (setq p (getpoint "\nPick or specify point between 2 prviously picked curves where do you want extrim to be processed : "))
 (store_entdata)
 (etrim c1 p)
 (sel_mod_ents)
 (command "_.copybase" '(0.0 0.0 0.0) ss "")
 (command "_.undo" "3")
 (etrim c2 p)
 (command "_.pasteclip" '(0.0 0.0 0.0))
 (setvar 'osmode osm)
 (setvar 'highlight hig)
 (princ)
)

 

HTH, M.R.

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