Jump to content

Recommended Posts

Posted

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: ")

Posted

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

Posted

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.

Posted

It works here...

Are you sure you moved

(command ""_.line"...

after

(setq pnt1...
(setq pnt2...

Posted
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 ....:oops:

Tanks, Stefan

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...