ktbjx Posted March 29, 2019 Posted March 29, 2019 (defun c:test ( / ss n i e el start_point End_point new_start_point new_End_point romabels ) (setq ss (ssget "_:L" '((0 . "LINE")))) (setq romabels (Getreal "\nEnter X Value: ")) (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 (romabels) (cadr 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 (romabels) (cadr End_point) (caddr End_point))) (setq el (subst new_End_point End_point el)) (entmod el) (setq i (+ 1 i)) ) (princ) ) basically my routine just change the coordinate... StartX = input value StartY = old StartX StartZ = old StartY EndX = input value EndY = old EndX EndZ = old EndY But it says Error Bad Function "whatever the input value is" Quote
dlanorh Posted March 29, 2019 Posted March 29, 2019 (edited) (setq start_point (cdr (assoc 10 el))) (setq new_start_point (list 10 (romabels) (cadr start_point) (caddr start_point))) (setq el (subst new_start_point (assoc 10 el) el)) (setq End_point (cdr (assoc 11 el))) (setq new_End_point (list 11 (romabels) (cadr End_point) (caddr End_point))) (setq el (subst new_End_point (assoc 11 el) el)) (entmod el) This (cadr start_point) (caddr start_point) won't work with this (setq start_point (assoc 10 el)) Learn how to use the vlide Edited March 29, 2019 by dlanorh clarity Quote
ScoRm Posted March 29, 2019 Posted March 29, 2019 1 hour ago, dlanorh said: (setq start_point (cdr (assoc 10 el))) (setq new_start_point (list 10 (romabels) (cadr start_point) (caddr start_point))) (setq el (subst new_start_point (assoc 10 el) el)) (setq End_point (cdr (assoc 11 el))) (setq new_End_point (list 11 (romabels) (cadr End_point) (caddr End_point))) (setq el (subst new_End_point (assoc 11 el) el)) (entmod el) This (cadr start_point) (caddr start_point) won't work with this (setq start_point (assoc 10 el)) Learn how to use the vlide what do you mean??? If i do this, it works just fine (setq new_start_point (list 10 (cadr start_point) (cadr start_point) (caddr start_point))) but if i do this, it gives me error (setq new_start_point (list 10 (romabels) (cadr start_point) (caddr start_point))) romabels is taken here at the begining (setq romabels (Getreal "\nEnter X Value: ")) Quote
Roy_043 Posted March 29, 2019 Posted March 29, 2019 Romabels is a variable not a function. There should not be parentheses around it. (setq new_start_point (list 10 romabels (cadr start_point) (caddr start_point))) 1 Quote
dlanorh Posted March 29, 2019 Posted March 29, 2019 start_point is a dotted pair which is a different type of list. Quote
dlanorh Posted March 29, 2019 Posted March 29, 2019 1 hour ago, Roy_043 said: Romabels is a variable not a function. There should not be parentheses around it. (setq new_start_point (list 10 romabels (cadr start_point) (caddr start_point))) missed that Quote
dlanorh Posted March 29, 2019 Posted March 29, 2019 42 minutes ago, dlanorh said: start_point is a dotted pair which is a different type of list. My mistake, this isn't true. However (cadr start_point) (caddr start_point) returns the x and y coordinates, not the y and z coordinates Quote
BIGAL Posted March 30, 2019 Posted March 30, 2019 An alternative (defun c:test ( / ss ent start_point End_point romabels ) (setq ss (ssget "_:L" '((0 . "LINE")))) (setq romabels (Getreal "\nEnter X Value: ")) (setq ent (ssname ss 0)) (setq start_point(getpropertyvalue ent "startpoint" )) (setq end_point (getpropertyvalue ent "endpoint" )) (setq start_pointx (car start_point)) (setq start_pointy (cadr start_point)) (setq start_pointz (caddr start_point)) (setq end_pointx (car end_point)) (setq end_pointy (cadr end_point)) (setq end_pointz (caddr end_point)) (setpropertyvalue ent "startpoint" (list romabels start_pointx start_pointy)) (setpropertyvalue ent "endpoint" (list romabels end_pointx end_pointy)) ) (C:test) 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.