Author Topic: Extract Portion of polyline without exploding  (Read 3899 times)

0 Members and 1 Guest are viewing this topic.

matrix2005in

  • Guest
Extract Portion of polyline without exploding
« on: May 29, 2006, 01:50:55 PM »
hi

any one know how to extract a portion of main polyline wiout exploding the same....  8-)

thanks

mathew
 

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Extract Portion of polyline without exploding
« Reply #1 on: May 29, 2006, 03:47:39 PM »
Sure, by using some of the curve functions. :-)

Code: [Select]
vlax-curve-getArea
vlax-curve-getClosestPointTo
vlax-curve-getClosestPointToProjection
vlax-curve-getDistAtParam
vlax-curve-getDistAtPoint
vlax-curve-getEndParam
vlax-curve-getEndPoint
vlax-curve-getFirstDeriv
vlax-curve-getParamAtDist
vlax-curve-getParamAtPoint
vlax-curve-getPointAtDist
vlax-curve-getPointAtParam
vlax-curve-getSecondDeriv
vlax-curve-getStartParam
vlax-curve-getStartPoint
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

matrix2005in

  • Guest
Re: Extract Portion of polyline without exploding
« Reply #2 on: May 30, 2006, 02:10:29 AM »
Hi CAB

if you dont mind can you give it to me in full form..i mean a complete lisp....i am not that good to creat myself..thats why..
thanks

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Extract Portion of polyline without exploding
« Reply #3 on: May 30, 2006, 02:32:04 AM »
Visit my homepage -> Free Stuff -> Free Programs and search for 'CopyPlineSeg.lsp'...
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

matrix2005in

  • Guest
Re: Extract Portion of polyline without exploding
« Reply #4 on: May 30, 2006, 10:42:28 AM »
oh gr8 one....

but that will only extract one segment...i want select two point anywhere in polyline and extract that portion.....

any hope?/

thanks

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Extract Portion of polyline without exploding
« Reply #5 on: May 31, 2006, 11:19:29 AM »
Sorry for the delay...
I had to rewrite some functions from another project to create this one:

CopyPlineSection
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Extract Portion of polyline without exploding
« Reply #6 on: May 31, 2006, 02:12:21 PM »
Here is my quickie method.
Copies from the point of two pick points then allows the user to past the new pline.

Code: [Select]
;;  Copy a user selected section of a pline
;;  CAB 05/31/06
;;  Pick 2 clip points then pick new location for new pline
(defun c:plineclip (/ end1 end2 endpt p1 p2 pk1 pk2 strpt)
  (vl-load-com)
  (command "._undo" "_begin")
  (if (and
        (setq pk1 (entsel "\nPick pline trim point."))
        (setq pk2 (entsel "\nPick second pline trim point."))
        (eq (car pk1) (car pk2))
        (setq ent1 (car pk1))
        (setq p1 (vlax-curve-getclosestpointto (car pk1) (cadr pk1)))
        (setq p2 (vlax-curve-getclosestpointto (car pk2) (cadr pk2)))
        (setq endpt (vlax-curve-getendpoint (car pk1)))
        (setq strpt (vlax-curve-getstartpoint (car pk1)))
        (if (< (vlax-curve-getdistatpoint (car pk1) p1)
               (vlax-curve-getdistatpoint (car pk2) p2)
            )
          (setq end1 strpt end2 endpt)
          (setq end2 strpt end1 endpt)
        )
      )
    (progn
      (command "._copybase" "_non" p1 ent1 "")
      (command "._break" (list ent1 p1) end1)
      (command "._break" (list ent1 p2) end2)
      (command "._pasteclip" "_non" p1)
      (command "._move" ent1 "" p2 pause)
      (command "._undo" "_end")
    )
  )

  (princ)
)
(prompt "\nCopy Pline section Loaded, Enter PlineClip to run.")
(princ)
« Last Edit: June 01, 2006, 12:01:13 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

LE

  • Guest
Re: Extract Portion of polyline without exploding
« Reply #7 on: May 31, 2006, 02:27:51 PM »
Here is my quickie method.
Copies from the point of two pick points then allows the user to past the new pline.
 

NICE one!

GDF

  • Water Moccasin
  • Posts: 2081
Re: Extract Portion of polyline without exploding
« Reply #8 on: May 31, 2006, 02:47:46 PM »
Here is my quickie method.
Copies from the point of two pick points then allows the user to past the new pline.
 

NICE one!

Alan

Vey very nice!

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Extract Portion of polyline without exploding
« Reply #9 on: May 31, 2006, 02:51:56 PM »
Well thank you both. :)
I revised it to this so if the user hits escape there will not be a copy left in the drawing.
Code: [Select]
;;  Copy a user selected section of a pline
;;  CAB 05/31/06
;;  Pick 2 clip points then pick new location for new pline
(defun c:plineclip (/ end1 end2 endpt p1 p2 pk1 pk2 strpt)
  (vl-load-com)
  (command "._undo" "_begin")
  (if (and
        (setq pk1 (entsel "\nPick pline trim point."))
        (setq pk2 (entsel "\nPick second pline trim point."))
        (eq (car pk1) (car pk2))
        (setq ent1 (car pk1))
        (setq p1 (vlax-curve-getclosestpointto (car pk1) (cadr pk1)))
        (setq p2 (vlax-curve-getclosestpointto (car pk2) (cadr pk2)))
        (setq endpt (vlax-curve-getendpoint (car pk1)))
        (setq strpt (vlax-curve-getstartpoint (car pk1)))
        (if (< (vlax-curve-getdistatpoint (car pk1) p1)
               (vlax-curve-getdistatpoint (car pk2) p2)
            )
          (setq end1 strpt end2 endpt)
          (setq end2 strpt end1 endpt)
        )
      )
    (progn
      (command "._copybase" "_non" p1 ent1 "")
      (command "._break" (list ent1 p1) end1)
      (command "._break" (list ent1 p2) end2)
      (command "._pasteclip" "_non" p1)
      (command "._copybase" "_non" p2 ent1 "")
      (entdel ent1)
      (command "._pasteclip" "_non" pause)
      (command "._undo" "_end")
    )
  )

  (princ)
)
(prompt "\nCopy Pline section Loaded, Enter PlineClip to run.")
(princ)
« Last Edit: June 01, 2006, 12:00:50 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

matrix2005in

  • Guest
Re: Extract Portion of polyline without exploding
« Reply #10 on: May 31, 2006, 10:47:24 PM »
HI CAB that was excellent

One main problem is this wont work with autoCAD 2000i...can you revise to make compatible with it..

thanks


matrix2005in

  • Guest
Re: Extract Portion of polyline without exploding
« Reply #11 on: May 31, 2006, 10:54:59 PM »
HI Jürg Menzi

Sory i forgot to mention you ...in your code it gives alert if below AuotCAD 2004
can you enable this to work in AUtoCAD 2000i tooo

thanks

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Extract Portion of polyline without exploding
« Reply #12 on: May 31, 2006, 11:59:50 PM »
HI CAB that was excellent

One main problem is this wont work with autoCAD 2000i...can you revise to make compatible with it..

thanks
I'm running it in ACAD2000, what problem did you have?

Edit: Try to copy it again, I added (vl-load-com)
Some systems do not load this on startup.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

matrix2005in

  • Guest
Re: Extract Portion of polyline without exploding
« Reply #13 on: June 01, 2006, 12:45:25 AM »
HI CAB
sorry boss....actually i dont know what happend it works fine with other machines which installed 2000i
thanks man

i will ask more help if you dont mind
 :-)

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Extract Portion of polyline without exploding
« Reply #14 on: June 02, 2006, 04:47:43 AM »
Sory i forgot to mention you ...in your code it gives alert if below AuotCAD 2004
can you enable this to work in AUtoCAD 2000i tooo

I've upload a new version which supports A2k+...
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18