TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: V-Man on November 10, 2004, 05:20:24 PM

Title: Help..Calling all Corinthians, Dorians and other columnists.
Post by: V-Man on November 10, 2004, 05:20:24 PM
I am trying to write a routine that will draw a column (using the rectangle command). The insertion point is the column intersection point and it prompts the user to type in the column size in the "x" direction and then the "y" direction. From that it need to calculate and draw in the column from the column intersection. I'm having some trouble with that. Any ideas?
Title: Help..Calling all Corinthians, Dorians and other columnists.
Post by: CAB on November 10, 2004, 05:52:52 PM
Can you show us what you have so far?
What exactly is the column intersect point?
  Is it the corner of the column? Which corner?
  What is it intersecting with?
Title: Help..Calling all Corinthians, Dorians and other columnists.
Post by: daron on November 11, 2004, 08:08:26 AM
Don, I edited the name of your thread to better help others to know right away what they're in for when selecting this thread. Do you know how many threads there'd be with the title HELP..., if we left them alone. Sorry, what was your question again?
Title: Help..Calling all Corinthians, Dorians and other columnists.
Post by: V-Man on November 11, 2004, 08:12:06 AM
Ok, here is the code. I know it's not pretty but it does work. Any suggestions welcome of course.

Code: [Select]

(defun c:col ( / savosmode savortho pt xcol ycol divx divy newx newy x1 x3 x4 dir1 dir2 newans newans1)
(setq savosmode (getvar "osmode"))
(setq savortho (getvar "orthomode"))
(setvar "osmode" 32)
(setq pt (getpoint "\nSelect column intersection point:"))
(setq XCOL (getdist "\nEnter the X direction size: "))
(setq YCOL (getdist "\nEnter the Y direction size: "))
(setq divx (/ xcol 2))
(setq divy (/ ycol 2))
(setq newx (rtos divx))
(setq newy (rtos divy))
(setq newans (strcat "@" newx "<" "180"))
(setq newans1 (strcat "@" newy "<" "270"))
(setq xans (strcat "@" (rtos xcol) "," (rtos ycol)))
(command "rectangle" pt xans)
(setvar "osmode" 0)
(setvar "orthomode" 1)
(command "move" (entlast) "" "0,0" newans)
(command "move" (entlast) "" "0,0" newans1)
(setvar "osmode" savosmode)
(setvar "orthomode" savortho)
(princ)
)
Title: Help..Calling all Corinthians, Dorians and other columnists.
Post by: SMadsen on November 11, 2004, 08:34:20 AM
You mean it's a rectangle-from-center kind of routine you're putting together?

I'd suggest some basic point calculations. You could look into POLAR or - provided the column section is orthogonal in WCS - you could simply build diagonal points on the fly. E.g. something like:

Code: [Select]
(defun c:col (/ pt xcol ycol divx divy llpt urpt savosmode)
  (setq savosmode (getvar "osmode"))
  (setvar "osmode" 32)
  (setq pt (getpoint "\nSelect column intersection point:"))
  (setq XCOL (getdist "\nEnter the X direction size: "))
  (setq YCOL (getdist "\nEnter the Y direction size: "))
  (setq divx (/ xcol 2.0))
  (setq divy (/ ycol 2.0))
 
  (setq llpt (list (- (car pt) divx)(- (cadr pt) divy))
        urpt (list (+ (car pt) divx)(+ (cadr pt) divy))
  )

  (setvar "osmode" 0)
  (command "rectangle" llpt urpt)
  (setvar "osmode" savosmode)
  (princ)
)
Title: Help..Calling all Corinthians, Dorians and other columnists.
Post by: V-Man on November 11, 2004, 08:44:22 AM
Quote

You mean it's a rectangle-from-center kind of routine you're putting together?


Yea, it's so that you can draw in a column, any size the user inputs from the (column) intersection. I knew that there was a smarter way of writng this routine but just needed a little direction.

Thanks,
Title: Help..Calling all Corinthians, Dorians and other columnists.
Post by: hendie on November 11, 2004, 09:31:47 AM
I just love the title of this thread  :P
Title: Help..Calling all Corinthians, Dorians and other columnists.
Post by: Keith™ on November 11, 2004, 09:39:18 AM
Quote from: hendie
I just love the title of this thread  :P


I was wondering if this was a reference to the middle east around the time of Jesus, but then I was wondering if they had newspapers then ... and if not why would they need columnists ... but anyway it is kinda neat
Title: Help..Calling all Corinthians, Dorians and other columnists.
Post by: t-bear on November 11, 2004, 09:41:01 AM
Yah, me too.  Seems our Daron has a poetic streak.......
Title: Help..Calling all Corinthians, Dorians and other columnists.
Post by: daron on November 11, 2004, 10:49:44 AM
Quote from: Keith
Quote from: hendie
I just love the title of this thread  :P


I was wondering if this was a reference to the middle east around the time of Jesus, but then I was wondering if they had newspapers then ... and if not why would they need columnists ... but anyway it is kinda neat


Sort of, but aren't there Corinthian, Doric and other types of columns? It's all a play on words related to what I could figure out what Don was trying to ask.

Thanks for the love.
Title: Help..Calling all Corinthians, Dorians and other columnists.
Post by: t-bear on November 11, 2004, 11:07:03 AM
Not love Daron....wonder and amazement.......LOL