TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: dussla 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 ?
-
This may be of intrest to you.
http://www.theswamp.org/index.php?topic=1749.0
-
You can try this one too
;; | --------------------------------------------------------------------------
;; | 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'~
-
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 .
-
thank you always
thank you always
good day always ~
really 8-) :lol: