termal007 Posted July 31, 2012 Posted July 31, 2012 hi i have to layers "c-road-sctn-titl" and "area-block" ; i need sort each layers to one line . how can i do simple? please see my upload file for example !! Drawing1.dwg Quote
Organic Posted August 1, 2012 Posted August 1, 2012 One continuous line? Or several lines (rows) like the data appears to be laid out in? I'd be looking at wherever the data came from and seeing if I could export it better. Quote
Arin9916 Posted August 1, 2012 Posted August 1, 2012 (edited) i`m not sure what u want exactly. if u need to sort method Considering the tolerance values, See below PTE:Sortobj function (defun c:aa ( / doc spc obj tol PTE:objects PTE:sortobj ) (vl-load-com) (defun PTE:objects ( ss / i re ) (if ss (repeat (setq i (sslength ss)) (setq re (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) re)) ) ) ) (defun PTE:sortobj ( olst typ tol / typ objs opt npt lst data lst rev sx sy dxf x y PTE:s1 PTE:s2 PTE:s3 PTE:s4 ) (defun rev (ls f) (mapcar '(lambda (l)(if (setq f (not f)) (reverse l) l)) ls)) (defun sx (objs) (vl-sort objs '(lambda (a b) (< (x a) (x b))))) (defun sy (objs) (vl-sort objs '(lambda (a b) (< (y a) (y b))))) (defun dxf (o c) (cdr (assoc c (entget (vlax-vla-object->ename o))))) (defun x (o) (car (dxf o 10))) (defun y (o) (cadr (dxf o 10))) (setq typ (vl-string->list (strcase typ))) (if (member (car typ) '(76 82)) (setq PTE:s1 sy PTE:s2 y PTE:s3 sx PTE:s4 rev) (setq PTE:s1 sx PTE:s2 x PTE:s3 sy PTE:s4 rev) ) (setq objs (PTE:s1 olst) opt (PTE:s2 (car objs))) (foreach o objs (if (< tol (abs (- (setq npt (PTE:s2 o)) opt))) (setq lst (cons data lst) data (list o) opt npt) (setq data (cons o data)) ) ) (setq lst (mapcar '(lambda (l) (PTE:s3 l))(cons data lst)) lst (if (member (cadr typ) '(85 82)) (reverse lst) lst) lst (if (member (car typ) '(68 76)) (mapcar '(lambda (l) (reverse l)) lst) lst) lst (if (/= (car typ) (caddr typ))(PTE:s4 lst t) lst) ) ) (setq doc (vla-get-activedocument (vlax-get-acad-object)) spc (vla-get-modelspace doc) obj (PTE:objects (ssget '((0 . "*text") (8 . "C-ROAD-SCTN-TITL")))) tol (* 15. (vla-get-height (car obj))) ) (mapcar '(lambda ( os ) (mapcar '(lambda ( o1 o2 ) (vla-addline spc (vla-get-InsertionPoint o1) (vla-get-InsertionPoint o2)) ) os (cdr os) ) )(PTE:SortObj obj "rdr" tol) ) ) ;;PTE:sortobj Use like this.... ;; ;; Made By.......... TaeEun -_-)=b ;; ;; Contact Me.......[email="Me.......arin9916@naver.com"]arin9916@naver.com[/email] ;; ....... [url]http://cafe.naver.com/ptelisp[/url] ;; ;; Arguments........ olst : vla-object list ;; ........ typ : Sort type (str .. See below) ;; ........ tol : tolerance (real or int) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Type Description. ; 1 2 3 r = right l = left ; 4 5 6 u = up d = down ; 7 8 9 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Sort by type rdr : ((1 2 3) (4 5 6) (7 8 9)) ; Sort by type ldl : ((3 2 1) (6 5 4) (9 8 7)) ; Sort by type rur : ((7 8 9) (4 5 6) (1 2 3)) ; Sort by type lul : ((9 8 7) (6 5 4) (3 2 1)) ; Sort by type drd : ((1 4 7) (2 5 (3 6 9)) ; Sort by type uru : ((7 4 1) (8 5 2) (9 6 3)) ; Sort by type dld : ((3 6 9) (2 5 (1 4 7)) ; Sort by type ulu : ((9 6 3) (8 5 2) (7 4 1)) ; Sort by type rdl : ((1 2 3) (6 5 4) (7 8 9)) ; Sort by type ldr : ((3 2 1) (4 5 6) (9 8 7)) ; Sort by type rul : ((7 8 9) (6 5 4) (1 2 3)) ; Sort by type lur : ((9 8 7) (4 5 6) (3 2 1)) ; Sort by type dru : ((1 4 7) (8 5 2) (3 6 9)) ; Sort by type urd : ((7 4 1) (2 5 (9 6 3)) ; Sort by type dlu : ((3 6 9) (8 5 2) (1 4 7)) ; Sort by type uld : ((9 6 3) (2 5 (7 4 1)) ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Edited August 3, 2012 by Arin9916 Quote
termal007 Posted August 2, 2012 Author Posted August 2, 2012 hi sorry for late answer i have error to run lisp plz see attach file and read error . Command: aa ; error: no function definition: VLAX-GET-ACAD-OBJECT Quote
Lee Mac Posted August 2, 2012 Posted August 2, 2012 http://www.cadtutor.net/forum/showthread.php?1390-How-to-use-the-LISP-routines-in-this-archive&p=339645&viewfull=1#post339645 Quote
termal007 Posted August 2, 2012 Author Posted August 2, 2012 i can not answer my question !!!!!!!? i try to say again ! when i draw on line straight in one row of layer "C-ROAD-SCTN-TITL" ; you see numbers are not array on line i want to all numbers layer "C-ROAD-SCTN-TITL" to array and layer "area-block" Quote
Recommended Posts
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.