som
Guest
hello to all, thanks to your help I managed to write a little code that fits my situation and that allows me to select a part of a dwg to turn it into jpeg by plotter.
Now I should move some texts that I would find myself out of the selected window, so I wrote the translatest function that I can use by autocad but not on the other lisp function, what am I wrong? !
Thanks again
to see if it works I was trying to directly insert numbers.. then I will have to enter a value that depends on the limits of the window.
Now I should move some texts that I would find myself out of the selected window, so I wrote the translatest function that I can use by autocad but not on the other lisp function, what am I wrong? !
Thanks again
Code:
(defun c:puntiassi ()
(setvar "cmdecho" 0)
(setq gr(ssget "x" ( (0 . "line") (8 . "assi"))))
(if gr)
(setq kk 0)
(setq xlimitedestro 0)
(setq xlimitesinistro 0)
(setq ylimitesup 0)
(setq ylimiteinf 0)
(repeat (sslength gr)
(setq point(entget(sname gr kk)))
(setq pnew)
(car(cdr(assoc 10 point)));
(cdr(cdr(assoc 10 point)));
(cadr(cdr(assoc 10 point)));
)
(princ "\n")
(if = kk 1)
(setq ylimitesup (cdr(assoc 10 point))))
)
(if = kk 2)
(setq ylimiteinf (cdr(cdr(assoc 10 point))))
)
(if = kk 3)
(setq xlimitedestro (car(cdr(assoc 10 point))))
)
(if = kk 4)
(setq xlimitesinistro (car(cdr(assoc 10 point)))))
)
(princ (car(cdr(assoc 10 point))))
;(seq point(subst (cons 10 pnew) (assoc 10 point)))
;(included)
(setq kk(+ kk 1))
)
)
(princ "\n limitedestro x : ")
(princ xlimitedestro)
(princ "\n limitless x : ")
(princ xlimitesinistro)
(princ "\n limitsup y : ")
(princ ylimitesup)
(princ "\n limitinf y : ")
(princ ylimiteinf)
(setq p3 (list xlimitesinistro ylimiteinf)); left bottom
(setq p4 (list xlimitedestro ylimitesup)); upper right
(princ "\n")
(princ "p3")
(princ p3)
(princ "p4")
(princ p4)
[COLOR="Red"] (command "traslatesto" 300.0 10.0 )[/COLOR];(command "300")
;(command "10")
(command "_plot" "yes" "model" "jpeg.pc3"" "horizontal" "no" "window"
p3 p4 "suitable" "center" "yes" "acad.ctb" "no" "hidden" "no" "yes" "yes" "yes")
; after hidden I have the file name
)
(defunc c:translatesto(/ traslx trasly)
(setq traslx 300.0)
(setq trasly 10.0)
(setq traslx (getint "\ninseri traslation x:"))
(setq trasly (getint "\ninserire translation y:"))
(setvar "cmdecho" 0)
(setq gr(ssget "x" ((8 . "text")))))
(if gr)
(setq kk 0)
;(seq translation 300)
;(seq traslazioney 10)
(repeat (sslength gr)
(setq point(entget(sname gr kk)))
(setq oldx (car(cdr(assoc 10 point)))))
(setq oldy (cadr(cdr(assoc 10 point))))
(setq newx (- oldx traslx)
(setq newy (- oldy trasly)
(setq pnew)
newx; x
newy, y
(cdr(cdr(assoc 10 point)));
)
(princ "\n")
(princ oldy)
(setq point(subst (cons 10 pnew) (assoc 10 point)))
(entmod point)
(setq kk(+ kk 1))
)
)
)