teknomatika Posted March 27, 2012 Share Posted March 27, 2012 I made this simple routine that allows me to split rectangles in rows and columns. However, I intend that the first line, horizontal or vertical, according to the situation or option, is not drawn, or is deleted so as not to overlap the outer edge of the polygon. Who can help me? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun colunas (/ pnt1 pnt2 pnt3 disth ncol) (setq pnt1 (getpoint "\nPonto 1 - 1º Ponto da distância vertical:")) (setq pnt2 (getpoint "\nPonto 2 - 2º Ponto da distância vertical:")) (setq pnt3 (getpoint "\nPonto 3 - Distância horizontal relativamente ao Ponto 2:")) (setq disth (distance pnt2 pnt3)) (setq ncol (getint "\nNº de Colunas")) (setq disth (/ disth ncol)) (repeat ncol (command "_.line" "_non" pnt1 "_non" pnt2 "_non" "") (setq pnt1 (list (+ (car pnt1)disth)(cadr pnt1)(caddr pnt1))) (setq pnt2 (list (+ (car pnt2)disth)(cadr pnt2)(caddr pnt2))) (princ) );repeat );defun:colunas ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun linhas (/ pnt1 pnt2 pnt3 distv nlin) (setq pnt1 (getpoint "\nPonto 1 - 1º Ponto da distância horizontal:")) (setq pnt2 (getpoint "\nPonto 2 - 2º Ponto da distância horizontal:")) (setq pnt3 (getpoint "\nPonto 3 - Distância vertical relativamente ao Ponto 2:")) (setq distv (distance pnt2 pnt3)) (setq nlin (getint "\nNº de Linhas")) (setq distv (/ distv nlin)) (repeat nlin (command "_.line" "_non" pnt1 "_non" pnt2 "_non" "") (setq pnt1 (list (car pnt1)(+ (cadr pnt1)distv)(caddr pnt1))) (setq pnt2 (list (car pnt2)(+ (cadr pnt2)distv)(caddr pnt2))) (princ) );repeat );defun:linhas ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:GRE (/ opt) (command "layer" "new" "Grelha" "color" "103" "Grelha" "") (command "layer" "set" "Grelha" "") (initget 1 "C L") (setq opt (getkword "\n(C)olunas ou (L)inhas? ")) (cond ((= opt "C") (colunas) ) ((= opt "L") (linhas)) ) ); defun c:GRE (prompt "\n Type GRE - Opções: C para colunas ou L para linhas: ") Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted March 27, 2012 Share Posted March 27, 2012 try this (repeat (1- ncol) (setq pnt1 (list (+ (car pnt1)disth)(cadr pnt1)(caddr pnt1))) (setq pnt2 (list (+ (car pnt2)disth)(cadr pnt2)(caddr pnt2))) (command "_.line" "_non" pnt1 "_non" pnt2 "_non" "") (princ) ) and the same for nlin Quote Link to comment Share on other sites More sharing options...
teknomatika Posted March 27, 2012 Author Share Posted March 27, 2012 Already upgraded but it seems not work. In fact, this way it just removes the last line (vertical or horizontal). What I want is to delete the first. Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted March 27, 2012 Share Posted March 27, 2012 It works here... Are you sure you moved (command ""_.line"... after (setq pnt1... (setq pnt2... Quote Link to comment Share on other sites More sharing options...
teknomatika Posted March 27, 2012 Author Share Posted March 27, 2012 It works here...Are you sure you moved (command ""_.line"... after (setq pnt1... (setq pnt2... That's it. And do not drink beer at lunch .... Tanks, Stefan 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.