ktbjx Posted July 9, 2016 Share Posted July 9, 2016 Can someone help me make a LISP??? to select LINEs, input elevations and devide those elevations depending on how many lines are selected, and put it as start Z and end Z... We are making a topography map and we use LINE because it has 2 Z's (Start Z and End Z ). i included a sample... im sorry i cannot duplicate the map we are doing at work so i just made an example of what I needed... as you will see on the sample, i have: 5 lines connected, from Elevation 1 to 10 every start Z and End Z is different, but you will notice what i mean... is there a way to make a lisp out of it??? sampleline.dwg Quote Link to comment Share on other sites More sharing options...
ktbjx Posted July 10, 2016 Author Share Posted July 10, 2016 please help me?? i have some code that copy Y to Z, maybe someone could help me change it so i can input 2 numbers, and the lisp do the rest? (defun c:test ( / ss n i e el start_point End_point new_start_point new_End_point ) (setq ss (ssget "_:L" '((0 . "LINE")))) (setq i 0) (setq n (sslength ss)) (while (< i n) (setq e (ssname ss i)) (setq el (entget e)) (setq start_point (assoc 10 el)) (setq new_start_point (list 10 (cadr start_point) (caddr start_point) (caddr start_point))) (setq el (subst new_start_point start_point el)) (setq End_point (assoc 11 el)) (setq new_End_point (list 11 (cadr End_point) (caddr End_point) (caddr End_point))) (setq el (subst new_End_point End_point el)) (entmod el) (setq i (+ 1 i)) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
ktbjx Posted July 10, 2016 Author Share Posted July 10, 2016 please???? ANYONE??? how can i change the list (start_point and End_point )??? even if i make it itoa or rtos, its still error, so please someone point me on what im doint wrong? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 11, 2016 Share Posted July 11, 2016 A few problems starting with all lines at z=0 pick all so know how many therfore can add Z now it does not work as the creation order would control the z value so end up with 0 1 5 6 3 4. I would make a pline use any of the get co-ords of a pline lisps that are here and then using this list of co-ords add the correct z increment make the lines or create a new 3dpline. ; pline co-ords example ; By Alan H (defun getcoords (ent) (vlax-safearray->list (vlax-variant-value (vlax-get-property (vlax-ename->vla-object ent) "Coordinates" ) ) ) ) (defun co-ords2xy () ; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z (setq len (length co-ords)) (setq numb (/ len 2)) ; even and odd check required (setq I 0) (repeat numb (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) )) ; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) )) (setq co-ordsxy (cons xy co-ordsxy)) (setq I (+ I 2)) ) ) ; program starts here (setq co-ords (getcoords (car (entsel "\nplease pick pline")))) (co-ords2xy) ; list of 2d points making pline are saved in co-ordsxy Quote Link to comment Share on other sites More sharing options...
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.