Can't change line coordin
I'm trying to increase a vertical line height by fixing the point with the lowest Y coordinate(defun c:inclength ( / trama e o s x z y w obj patternName a b ponto1 ponto2 diferenca processo) (if (setq s (ssget "_:L" '((0 . "LINE")))) (repeat (setq i (sslength s)) (setq e (ssname s (setq i (1- i))) x (entget e) trama (cdr (assoc 2 x)) ponto1 (caddr (assoc 10 x)) ;gets Y coordinate of the lowest point ponto2 (caddr (assoc 11 x)) ;gets Y coordinate of highest point ) (setq diferenca (+ ponto1 9.4)) ;sets the length in coordinate (entmod (subst diferenca ponto2 x)) ;this doesn't work ) ) (princ))
I've made some prin1's to check diferenca, ponto1 and ponto2 value and they are all right, I think the problem is on entmod, which doesn't work somehow, and i'm also not getting any kind of error by autocad A few points:
[*]entmod doesn't error when unsuccessful, it will return nil.
[*]LINE entities do not contain DXF group 2, so your variable trama will always be nil
[*]Nothing will be substituted within the DXF data by your subst expression, as the DXF data is an association list and hence will only contain lists; your subst expression is attempting to substitute numerical values which are not present as distinct items in the list. You should instead construct a new DXF group to be substituted for the appropriate endpoint.
Yes, trama is a variable i forgot (i take pieces of previous code and modify them to spare work)
But, entmod didnt return nil anyways.
Something like this maybe?
(entmod (subst (cons 11 (pontoinicial diferenca 0.0) ) (assoc 11 x) x))
where pontoinicial is the X coordinate and diferenca the Y coordinate i want to change. I've worked around the problem for now
Thank you very much, you're always of such help.
But in this case the entmod expression is successful, as you are supplying it with valid data - no substitution is made by subst, so the supplied list (i.e. the original DXF data) is returned and supplied to entmod.
It may not always be the end point (DXF 11) which holds the highest y-coordinate.
Your current code will also error as pontoinicial is not a valid function; you should use the list function instead (no need for cons, as you are not constructing a dotted pair).
You're welcome.
页:
[1]