Author Topic: Adding vertices to a pline using another PLine as a template?  (Read 9770 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Adding vertices to a pline using another PLine as a template?
« Reply #15 on: March 09, 2009, 04:48:25 PM »
Cool.  But alas it not what "Exactly" need.

Let me Zoom out a little and I post a bigger picture.  I use the express tools break line to go across a series of objects.  usually the center object get vertices added to it but not always.  Hence my question about using another pline as template

I'm still not following what you are trying to do :?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Adding vertices to a pline using another PLine as a template?
« Reply #16 on: March 09, 2009, 08:00:36 PM »
My guess is that the break symbol is not always the same size & not always in the middle and
the break symbol has extensions the extend past the pline rectangle.
Therefore he desires to match the existing break symbol.
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.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Adding vertices to a pline using another PLine as a template?
« Reply #17 on: March 10, 2009, 09:17:18 AM »
My guess is that the break symbol is not always the same size & not always in the middle and
the break symbol has extensions the extend past the pline rectangle.
Therefore he desires to match the existing break symbol.

Yep that is about it.  See the attached drawing.  You will notice that there are three break lines and they are interacting with the objects differently.  Hence I need place vertices to the objects that is getting "broken".  Like CAB said the break could be anywhere on the object. 

More background info:
You ask why not simply place the break symbol and trim the object to the break line.   Because I am using ADT's detail component tools to generate some of the objects.  If I explode or trim the object I lose the data that is assigned the object thus loosing the ability to use tools like "add selected" or the use of key noting.  Plus for other objects I loose efficiency of hatching objects due not being able to selelct object or ADT's another version of subtract and merge commands. 
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Adding vertices to a pline using another PLine as a template?
« Reply #18 on: March 15, 2009, 08:03:55 PM »
very nice ronjonp, thanks for sharing.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Adding vertices to a pline using another PLine as a template?
« Reply #19 on: March 16, 2009, 10:03:49 AM »
very nice ronjonp, thanks for sharing.

 :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Adding vertices to a pline using another PLine as a template?
« Reply #20 on: March 16, 2009, 10:52:31 AM »
Here is a variation of Ron's routine.
Note that there is no error checking so you must use responsible.   :evil:
Code: [Select]
(defun c:breakitmeng (/ e e2 pt n obj param vlst)
  (vl-load-com)
  (vla-EndUndoMark (vla-get-ActiveDocument (vlax-get-acad-object)))
  (vla-StartUndoMark (vla-get-activedocument (vlax-get-acad-object)))
  (if (and (setq e (entsel "\nSelect segment on polyline to update: "))
           (setq pt (cadr e))
           (setq e (car e))
           (= (cdr (assoc 0 (entget e))) "LWPOLYLINE")
           (setq obj (vlax-ename->vla-object e))
           (setq pt (vlax-curve-getclosestpointto e pt))
           (setq param (fix (vlax-curve-getparamatpoint e pt)))
           (setq pt (vlax-curve-getpointatparam e param))
   (setq e2 (car (entsel "\nSelect polyline for breakline points: ")))
           (= (cdr (assoc 0 (entget e2))) "LWPOLYLINE")
           (setq vlst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget e2))))
           (setq vlst (cdr vlst) ; remove 1st & last vertex
vlst (reverse (cdr (reverse vlst))))
   (if (> (distance pt (car vlst))(distance pt (last vlst)))
     (setq vlst (reverse vlst))
     t
   )
           (setq n 0)
      )
    (foreach pt vlst
      (setq n (1+ n))
      (vlax-invoke obj 'addvertex (+ param n) pt)
    )
  )
  (vla-EndUndoMark (vla-get-ActiveDocument (vlax-get-acad-object)))
  (princ)
)
<edit prompts>
<edit added UNDO>
« Last Edit: March 18, 2009, 09:05:48 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.