Jump to content

Recommended Posts

Posted

Can someone someone make up a lisp that

 

Asks me to draw a line.

Reads the distance of that line.

Asks for how many circles to enter evenly spaced across this distance

Askes the diameter of the circles

Places the circles evenly and delete the line.

 

thanks

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    5

  • digger

    4

  • alanjt

    3

  • Lt Dan's legs

    3

Posted

1) Start an if statement to test for a valid input from the following:

 

2) Use the getpoint function to prompt for first point (pt1)

 

3) Use the getpoint function with the basepoint argument as the first picked point to retrieve the second point (pt2)

 

4) Use the getint function coupled with the initget function to prompt the user for the number of circles

 

5) Use the getdist function to prompt for the diameter of the circles.

 

6) Use the distance function to determine the distance between 'pt1' and 'pt2', and the angle function to determine the angle between 'pt1' and 'pt2'.

 

7) Divide the distance retrieved in Step (6) by the number of circles from Step (4) minus 1 to get the spacing between the circles.

 

8] Start a counter at zero

 

9) Start a repeat loop repeating the number of circles from Step (4).

 

10) For every iteration of the loop, determine the center of the circle using the polar function with a basepoint as 'pt1' from Step (1), the angle from Step (6) and the spacing from Step (7) multiplied by the counter from Step (8]

 

11) Create a circle either using the command function, or entmake (use the reference from my Entmake thread) to create a circle with radius equal to the Diameter from Step (5) divided by 2.

 

11) Increment the counter with every iteration.

 

12) Exit cleanly using the princ function.

 

And you're done!

 

Don't just expect people to write code for you Mike without a little effort to learn on your part. We do enjoy writing the code, but this forum is designed to be a help and advice forum. I've noticed that the majority of your threads are merely code requests - I will be willing to help you write the program, but I think its best if you make a start on it using some research, trial and error, and my above advice. That said, unfortunately, no doubt someone else will post a solution and my advice will be wasted.

 

Lee

Posted

I appreciate your help, I will try it and let you know where my problems areas area

Posted

I did this months ago.. not great but it's a start

 

(defun c:Bubble (/ *error* p1 p2 radius)
 (setvar "cmdecho" 0)
 (command "undo" "begin")
 (defun *error* (msg)
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **"))
   )
   (command "undo" "end")
   (setvar "cmdecho" 1)
   (princ)
 )
 (if
   (setq p1 (getpoint "\nSpecify first point: ")
         p2 (getpoint p1 "\nSpecify second point: "))
   (repeat
     (1+ 
       (fix 
         (/
           (distance p1 p2)
           (* 2 (setq radius )
         )
       )
     )
     (entmakex 
       (list 
         (cons 0 "CIRCLE")
         (cons 10 p1);insertion point
         (cons 8 "0");layer
         (cons 40 radius)
       )
     )
     (setq p1 (polar p1 (angle p1 p2)(* 2 radius)))
   )
 )
 (command "undo" "end")
 (setvar "cmdecho" 1)
 (princ)
)

  • 2 weeks later...
  • 2 weeks later...
Posted

1) .......

...... And you're done!

 

Lee

 

can't get any clearer than that...

 

 

.....That said, unfortunately, no doubt someone else will post a solution and my advice will be wasted.

 

Lee

 

That too :)

Posted

(defun c:use( / areaa chn hno ptx pty shno sno)

(setq OLD_CMDECHO (getvar "CMDECHO"))

(setvar "CMDECHO" 0)

;(setq height (GETREAL"\nENTER THE TEXT HEIGHT :"))

(setq FILENAME (getstring"\nNAME OF DATA INPUT FILE TO WRITE TEXT with extension: "))

;(SETQ FILENAME (strcat FILENAME1 ".TXT"))

 

(setq FILEUNIT (open FILENAME "r"))

(while (setq LINE_INPUT (read-line FILEUNIT))

(setq l1 LINE_INPUT )

(setq AREAA (atof (substr LINE_INPUT 1 15)))

(setq CHN (atof (substr LINE_INPUT 16 30)))

(setq HNO (atof (substr LINE_INPUT 31 45)))

(setq PTX (atof (substr LINE_INPUT 46 60)))

(setq PTY (atof (substr LINE_INPUT 61 75)))

(setq shno (substr LINE_INPUT 76 90))

(setq sno (atof(substr LINE_INPUT 91 105)))

;(setq inspt (list (atof PTX)(atof PTY)))

(setq inspt (list ptx pty))

;(prinC ptx)(princ pty)(getreal"inspt............")

; (COMMAND"POINT" inspt)

(command"insert" "CHNO" inspt "1""1""0" shno (rtos sno 2 0) (rtos HNO 2 0) (RTOS CHN 2 0) (RTOS AREAA 2 3) )

;(command "text" "ML" (LIST INSX INSY) height 0 TEXTLINE)

)

(CLOSE FILEUNIT)

)

 

in this programme problem is that when i call this programme in autocad in sheet no survey no is comming in end please solve this problem

  • 3 weeks later...
Posted

Well, it looks like my instructions were a waste of time - did you give this a try Mike?

 

Heres the start:

 

 (if
   (and
     (setq p1 (getpoint "\nSpecify First Point: "))
     (setq p2 (getpoint "\nSpecify Second Point: " p1))
     (progn
       (initget 6)
       (setq no (getint "\nSpecify Number of Circles: "))
     )
     (setq di (getdist "\nSpecify Diameter of Circles: "))
   )

Posted

..... this forum is designed to be a help and advice forum. I've noticed that the majority of your threads are merely code requests - I will be willing to help you write the program, but I think its best if you make a start on it using some research, trial and error, and my above advice. That said, unfortunately, no doubt someone else will post a solution and my advice will be wasted.

 

Lee

 

lee mac,

 

which forum would you recommend us code challenged draughtsman use to post our requests for a routine to help ease our daily drudgery?

 

digger

Posted (edited)
which forum would you recommend us code challenged draughtsman use to post our requests for a routine to help ease our daily drudgery?

 

If you require programs to ease your daily drudgery but aren't willing to learn to write the code, look into hiring a programmer.

Edited by Lee Mac
Posted

Just as there will always been people that want to learn and those that do not, there will always be at least one individual that will code something out for a person. You'll get a lot farther if you put forth a little learning effort, but request away. You're bound to get someone to code for you. Most of us here have either requested something or coded out a request. I know guilty of both.

Posted

lee mac,

 

which forum would you recommend us code challenged draughtsman use to post our requests for a routine to help ease our daily drudgery?

 

digger

Posted

Lee Mac,

So you don't have a suggestion?

There is a difference between not willing and not able.

When you were still ****ting yellow I was writing code in BASIC. That was a far as I was able to go in any code.

Not everyone has a touch of AS.

Posted
Lee Mac,

So you don't have a suggestion?

There is a difference between not willing and not able.

When you were still ****ting yellow I was writing code in BASIC. That was a far as I was able to go in any code.

Not everyone has a touch of AS.

Request away. Someone will either help, tell you no, or ignore you.

Posted

Since this one was almost what you wanted to begin with.

 

 

(defun c:Bubble (/ *error* p1 p2 nu dia di)
 (setvar "cmdecho" 0)
 (command "undo" "begin")
 (defun *error* (msg)
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **"))
   )
   (command "undo" "end")
   (setvar "cmdecho" 1)
   (princ)
 )
 (if
   (and
     (setq p1 (getpoint "\nSpecify first point: "))
     (setq p2 (getpoint p1 "\nSpecify second point: "))
     (setq di 
       (/ 
         (distance p1 p2)
         (1+ (setq nu (getint "\nNumber of circles: ")))
       )
     )
     (setq dia (getdist "\nDiameter of circles: "))
   )
   (repeat nu
     (entmakex 
       (list 
         (cons 0 "CIRCLE")
         (cons 10 (setq p1 (polar p1 (angle p1 p2) di)))
         (cons 8 "0")
         (cons 40 (* dia 0.5))
       )
     )
   )
 )
 (command "undo" "end")
 (setvar "cmdecho" 1)
 (princ)
)

Posted

Being that this is my first post, I'd like to say hello to the community and give two thumbs up to the mods and the forum starter. Also, without nit-picking or taking sides, I find it quite amazing that things don't change from one CAD forum to the next. Especially when it comes to programming AutoCAD.

 

I completely understand and respect Lee Mac's viewpoint. He's giving out beans for you to sow, not to eat.

Posted (edited)
Request away. Someone will either help, tell you no, or ignore you.

 

thanks alanjt. you seem to be the only one here that gets it.

you and se7en are my favorite reads.

 

digger

Edited by digger
Posted
Well, it looks like my instructions were a waste of time - did you give this a try Mike?

 

Instructions are never a waste of time, perhaps the OP did or did not use your instruction, at least they are there for others that may need them. :thumbsup:

 

 

Request away. Someone will either help, tell you no, or ignore you.

 

Correct and do not get offended. There are plenty here that want the challenge and practice, so don't be shy, just don't get angry, it is a voluntary arrangement. :thumbsup:

 

 

If it is urgent and a necessity, then do as suggested and hire a programmer. 8)

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