Jump to content

Copy certain amount


gazzalp

Recommended Posts

Hey everyone, does anyone have a quick lisp that will copy any object between two points a certain amount of times? IE. i have 2 circles each 3 metres apart, and between them i want 13 more circles. So the lisp would ask what i want to copy, pick start point, pick end point, and type how many copies i would like? i Have one which does the same but instead of asking how many copies i would like i put in a maximum spacing, so it would kind of be similar.

 

Thanks

Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • gazzalp

    6

  • lpseifert

    4

  • michaeloureiro

    4

  • Lee Mac

    3

Top Posters In This Topic

Thanks Lee, but while those lisps are very good, thjey are probably too detailed for what i would like. That lisp asks for x axis and lots of things i find unrelated to what i need, which is alot simpler than that. So if anyone has a lisp that would help it would be appreciated

Link to comment
Share on other sites

haha, not really considering yesterday i had many instances i needed about 20 circles drawn between two points, and i had to do it many times for all different lengths. Its a lot slower to dividea line, then copy the circle twenty times....

Link to comment
Share on other sites

I dont think thats going to help me at all. What i have is one circle at 0,0. I want to copy that circle a certain amount of times, untill a specified end point. so i have a circle at 0,0, i start the lisp, it asks me what i want to copy. I select the circle. It asks how many circles i want. for example i input 20. then it asks to specify the end point, I choose a point on the drawing which is for example 0,1800. It then copies that circle to at an even spacing exactly 20 times

Link to comment
Share on other sites

yes that sprobably possible (havent tried it) but its not quick, try doing that 30 times in an hour where the amount you copy is all different, youll see why i want something quicker....as i said i have one where it offsets to a maximum distance, which saves alot of time so i dont see why one cant be made the same, but instead of a maximum distance it is a number of copies being picked.... here is the other lisp im talking about:

 

 

;;; FUNCTION ObjectOffsetAverage.lsp
;;;  Variation of the Array command, user picks the direction and distance 
;;;  The objects are offset as near as <=24" oc as possiable to fill distance
;;;  with equally spacred objects
;;;  Offset direction angle is 0, 90, 180, or 270 deg only
;;; 
;;; ARGUMENTS 
;;; none 
;;; 
;;; USAGE 
;;;  ooa
;;; 
;;; PLATFORMS 
;;; 2000+ 
;;; 
;;; AUTHOR 
;;; Copyright© 2004 Charles Alan Butler 
;;; [email="ab2draft@TampaBay.rr.com"]ab2draft@TampaBay.rr.com[/email] 
;;; 
;;; VERSION 
;;; 1.0 Oct. 01, 2004 
;;; 1.1 Dec. 14, 2008 
;;;
;;; YOU MAY USE THIS CODE ONLY FOR *NON-COMMERCIAL* 
;;; PURPOSES AND ONLY IF YOU RETAIN 
;;; THIS HEADER COMPLETE AND UNALTERED 
;;; you must contact me if you want to use it commercially 
;;;  
(DEFUN c:ooa (/ p1 p2 ss dist inc step MaxDist)
 (setq usercmd (getvar "CMDECHO"))
 (setvar "CMDECHO" 0)
 (setq useros (getvar "osmode"))
 (setvar "osmode" 175)
 (or OffDist (setq OffDist 24)) ; default offset distance
 (prompt "\nSelect objects to offset.")
 (if (setq ss (ssget))
   (progn    
     (if (and (setq p1 (getpoint "\n*-*  Pick Starting point  *-*"))
       (setq p2 (getpoint p1 "\n*-*  Pick End point  *-*"))
              (null (initget 6))
              (or (setq MaxDist (getdist (strcat "\nEnter Max Distance.<" (rtos OffDist)"> ")))
                  (setq MaxDist OffDist)
              )
         )
    (progn
             (setq OffDist MaxDist)
      (setq dist (distance p1 p2)
            ang  (angle p1 p2)
     inc  (fix (1+ (/ dist MaxDist)))
     step (/ dist inc)
      )
      (cond 
        ((and (>= ang 0.785) (<= ang 2.36)); array up
         (command "_.array" ss "" "R" inc "" step)
        )
        ((and (> ang 2.36) (< ang 3.9)); array left
         (command "_.array" ss "" "R" "" inc (- step))
        )
        ((and (>= ang 3.9) (<= ang 5.5)); array down
         (command "_.array" ss "" "R" inc "" (- step))
        )
        (T  ; array right
         (command "_.array" ss "" "R" "" inc step)
        )
             ) ; end cond stmt
    ) ; end progn
     ) ; endif
   ) ; end progn
 ) ; endif
 ;;==========  Exit Sequence  ============ 
 (setvar "osmode" useros)
 (setvar "CMDECHO" usercmd)
 (princ)
) ; end defun
(prompt "\nOffset Object Average Loaded. Enter ooa to run.")
(princ) 

        
CAB 
View Public Profile 
Send a private message to CAB 
Find More Posts by CAB 
Add CAB to Your Buddy List 
CAB's Computer Details 
Today, 03:22 pm    #3  
CAB 
Senior Member



Using: AutoCAD 2006

Join Date: May 2004
Location: Tampa, Florida
Posts: 487   

Link to comment
Share on other sites

here's a quick one:

 

 

 
(defun c:acopy (/ ang dist div div2 mode num pt1 pt2 spc sset)
   (defun *error* (msg)
       (princ msg)
       (setvar 'cmdecho 1)
   )
   (setvar 'cmdecho 0)
   (prompt "\nPick Object to Copy: ")
   (if (setq sset (ssget))
       (progn
           (setq pt1  (getpoint "\nPick first Point: ")
                 pt2  (getpoint pt1 "\nPick Second Point: ")
                 dist (distance pt1 pt2)
                 ang  (angle pt1 pt2)
           )
           (initget 7 "Item Spacing")
           (setq mode (getkword "\nEnter Mode [item/Spacing]: "))
           (Cond
               ((= mode "Item")
                (setq num (getint "\nEnter No. of Items: "))
                (setq div  (/ dist (1+ num))
                      div2 div
                )
                (repeat num
                    (command "._copy"
                             sset
                             ""
                             "_non"
                             pt1
                             "non"
                             (polar pt1 ang div2)
                    )
                    (setq div2 (+ div2 div))
                )
               )
               ((= mode "Spacing")
                (setq spc (getdist "\nPick Points or Enter Spacing: "))
                (if (< (rem dist spc) 0.00001)
                    (progn
                        (setq num  (/ dist spc)
                              div  (/ dist num)
                              div2 div
                        )
                        (repeat (fix (1- num))
                            (command "._copy"
                                     sset
                                     ""
                                     "_non"
                                     pt1
                                     "non"
                                     (polar pt1 ang div2)
                            )
                            (setq div2 (+ div2 div))
                        )
                    )
                    (progn
                        (setq num  (/ dist spc)
                              div  (/ dist (fix (1+ num)))
                              div2 div
                        )
                        (repeat (fix num)
                            (command "._copy"
                                     sset
                                     ""
                                     "_non"
                                     pt1
                                     "non"
                                     (polar pt1 ang div2)
                            )
                            (setq div2 (+ div2 div))
                        )
                    )
                )
               )
           )
       )
   )
   (*error* "")
   (princ)
)

Link to comment
Share on other sites

Is it not possible to copy the circle 20 times, then use the 'space evenly' command to space them from point to point?
What is this 'space evenly' command you speak of? Is it an MEP specific command?
Link to comment
Share on other sites

Not sure it is MEP specific. You should find it within your right click menu. Under AEC modify tools. Select the objects you wish to space, right click. AEC Modify tools > Space Evenly.

 

The press enter, and select the two points you wish to space between.

Link to comment
Share on other sites

Not sure it is MEP specific. You should find it within your right click menu. Under AEC modify tools. Select the objects you wish to space, right click. AEC Modify tools > Space Evenly.

 

The press enter, and select the two points you wish to space between.

 

Definitely not on '04! :D

Link to comment
Share on other sites

Thanks Wizman, nearly exactly what i was looking for. Only thing is it has one more prompt than what i wanted (asking whether i want the spacing or No. of items.) but in saying that it may be better, i might get rid of my lisp that does the spacing and use this for both. Thanks alot for your help :)

Link to comment
Share on other sites

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