Author Topic: to insert point objects in broken line's each point  (Read 2037 times)

0 Members and 1 Guest are viewing this topic.

dussla

  • Bull Frog
  • Posts: 286
to insert point objects in broken line's each point
« on: December 26, 2007, 07:05:47 AM »
if you see attach file , you can see  some line
i would  like to use  boundary command ,  but there is faliure becuse of  broken lines
that is simple line
if i use complex line , i can't find broken area
so i thought good idea
if i select  line , pw line , arc ........... ,   and  that is open lines and arcs .  pw lines
i would like to make  point object  in open area  or  end line .........
can you understand ?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: to insert point objects in broken line's each point
« Reply #1 on: December 26, 2007, 10:03:03 AM »
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.

Fatty

  • Guest
Re: to insert point objects in broken line's each point
« Reply #2 on: December 26, 2007, 03:19:39 PM »
You can try this one too

Code: [Select]
;; | --------------------------------------------------------------------------
;; | CHAIN-SEL.LSP
;; | --------------------------------------------------------------------------
;; | Returns  : The list of all chained objects by selection just one of them
;; | Globals  : test_obj
;; | Updated  : June 12 2005; September 04 2005, December 26 2007
;; | Author   : Fatty The Old Horse
;; | NOTE     : Unclosed chain need to select by pick on STARTING or ENDING segment/line only
;; | ----------------------------------------------------------------------------------------

;helper function to test on common points
(defun point-test (test_obj obj_list fuzz)
  (if (and test_obj obj_list)
    (vl-remove-if-not
      (function (lambda (x)
  (or (equal (vlax-curve-getstartpoint x)
     (vlax-curve-getstartpoint test_obj)
     fuzz
      )
      (equal (vlax-curve-getstartpoint x)
     (vlax-curve-getendpoint test_obj)
     fuzz
      )
      (equal (vlax-curve-getendpoint x)
     (vlax-curve-getstartpoint test_obj)
     fuzz
      )
      (equal (vlax-curve-getendpoint x)
     (vlax-curve-getendpoint test_obj)
     fuzz
      )
  )
)
      )
      obj_list
    )
  )
)
;; main program ;;

(defun chain-sel (fuzz /    acsp     adoc     axss     chain_list
  couple   ept     line_list       ln       loop
  spt    ss
)
  (vl-load-com)
  (or adoc
      (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
  )
  (setq ln  (vlax-ename->vla-object (car (entsel)))
spt (vlax-curve-getstartpoint ln)
ept (vlax-curve-getendpoint ln)
  )

  (setq ss   (ssget "_x" (list(cons 0  "LINE,ARC,*POLYLINE")));(cons 8 "Set Your Layer Here")))
axss (vla-get-activeselectionset adoc)
  )

  (setq line_list '()
chain_list
(cons ln chain_list)
  )
  (vlax-for a axss (setq line_list (cons a line_list)))

  (setq loop t)
  (while loop
    (while
      (setq couple
     (point-test ln line_list fuzz);<-- fuzz factor = 0.5
      )
       (if couple
(progn
   (setq chain_list (append couple chain_list))

   (setq line_list (vl-remove ln line_list))
   (setq ln (car chain_list))
)
(setq line_list (cdr line_list))
       )
    )
    (setq loop nil)
  )
;;;  chain_list
  (setq ss2 (ssadd))
  (mapcar (function (lambda(x)(ssadd (vlax-vla-object->ename x) ss2)))
  chain_list)
  ss2
)

;; Usage:

(defun C:CHN()
(setq pda (getvar "peditaccept"))
(setvar "peditaccept" 1)
(setq fuzz 0.5)
(alert "Select any segment of boundary")
(vl-catch-all-apply(function (lambda()
(command "pedit" "m" (chain-sel fuzz) "" "j" fuzz ""))))
  ;; TesT :
(vla-put-color (setq bnd (vlax-ename->vla-object  (entlast))) acyellow)
; < do your stuff here with newly created boundary >
  (setvar "peditaccept" pda)
  )
(c:CHN)
(princ)

~'J'~

DEVITG

  • Bull Frog
  • Posts: 479
Re: to insert point objects in broken line's each point
« Reply #3 on: December 27, 2007, 08:37:22 PM »
if you see attach file , you can see  some line
i would  like to use  boundary command ,  but there is faliure becuse of  broken lines
that is simple line
if i use complex line , i can't find broken area
so i thought good idea
if i select  line , pw line , arc ........... ,   and  that is open lines and arcs .  pw lines
i would like to make  point object  in open area  or  end line .........
can you understand ?

after
(setvar "peditaccept" 1); allow to edit a no POLY

Do you try the PEDIT M J FUZZ command.

See the help, about it .



Location @ Córdoba Argentina Using ACAD 2019  at Window 10

dussla

  • Bull Frog
  • Posts: 286
Re: to insert point objects in broken line's each point
« Reply #4 on: December 28, 2007, 08:46:55 PM »
thank you always
thank you always

good day  always ~
really 8-) :lol: