Jump to content

Recommended Posts

Posted

HELP !!

I am looking for a quick way to key-in 3 dimensions and then have a rectangle polyline drawn and closed. It could automatically start drawing at 0,0,0

 

The three user entries would be A, B, C where A and C would be different and the program would close the object.

 

See attached for a better explanation.

 

I appreciate any input on this.. I am not very good at writing lisps but i have good visions :) THanks guys you are the best.

Document1.pdf

Posted

Why do you need a lisp routine to draw that shape? It could all be done at the command line very quickly.

 

Command: _pline

Specify start point:

Current line-width is 0.0000

Specify next point or [Arc/Halfwidth/Length/Undo/Width]: 10

 

Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 4

 

Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 14

 

Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: c

Posted

I know it is very simple... however I have an engineer who wants to just type in three dimensions and nothing else and have it done for him...

Posted

An help would be appreciative.. THank you again.

Posted

I see. I think I'll stop now before I say something I'll regret.

 

I'm sure one of the lisp gurus here can solve this dilemma for your engineer in no time flat.

 

Good luck and happy coding.

Posted

This one ?

 

(defun c:Test (/ i x p pt l)
 (setq i 0
       x '("First" "Second" "Third" "Fourth")
 )
 (while (and
          (not (eq (length l) 4))
          (if pt
            (setq p (getpoint (strcat "\n" (nth i x) " point :") pt))
            (setq p (getpoint (strcat "\n" (nth i x) " point :")))
          )
          (setq pt p)
        )
   (setq l (cons p l)
         i (1+ i)
   )
 )
 (if (eq (length l) 4)
   (command "_.pline"
            "_non"
            (car l)
            "_non"
            (cadr l)
            "_non"
            (caddr l)
            "_non"
            (nth 3 l)
            "c"
   )
 )
 (princ)
)

Posted

And they all lived happily ever after. The End.

Posted (edited)

Feeling generous...

 

(defun c:Test (/ a b c p1 p2)
 (if (and (progn (initget 6) (setq a (getdist "\nSpecify length of side A: ")))
          (progn (initget 6) (setq b (getdist "\nSpecify length of side B: ")))
          (progn (initget 6) (setq c (getdist "\nSpecify length of side C: ")))
          (setq p1 (getpoint "\nSpecify intersection of sides A and C: "))
     )
   (command "_.pline"
            "_non"
            (mapcar '+ p1 (list 0. a 0.))
            "_non"
            p1
            "_non"
            (setq p2 (mapcar '+ p1 (list c 0. 0.)))
            "_non"
            (mapcar '+ p2 (list 0. b 0.))
            "_close"
   )
 )
 (princ)
)

Edited by alanjt
Posted

YOU ARE AWESOME THAT WORKS GREAT .. I know it is simple and really un-needed but i appreciate still the same.

Posted

One small thing....What would I change to make this startt drawing the polyline at 0,0,0 ??

Posted
(defun c:Test (/ a b c)
 (initget 6)
 (if (and (setq a (getdist "\nSpecify length of side A: "))
          (progn (initget 6) (setq b (getdist "\nSpecify length of side B: ")))
          (progn (initget 6) (setq c (getdist "\nSpecify length of side C: ")))
     )
   (command "_.pline"
            "_non"
            (list 0. a 0.)
            "_non"
            '(0. 0. 0.)
            "_non"
            (list c 0. 0.)
            "_non"
            (list c b 0.)
            "_close"
   )
 )
 (princ)
)

Posted

Works great thank you gentleman... As always you always amaze me.

Posted

You should see these guys when they are faced with a real challenge...they're simply amazing.

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...