Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need a Continuous Copy Array Fit lisp

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Anonymous
2064 Views, 6 Replies

Need a Continuous Copy Array Fit lisp

Hello! first time poster here and really need some help. Im looking for a lisp command that will function like the Copy Array command in AutoCAD. the normal command is "Copy", select object, specify base point, then "Array", how many objects, then "Fit", then choose second point.

 

This command is useful when im putting joists in bays so I dont have to do the math for the spacing of the joists. However this command takes a looong time and its a one time command. I was wondering if there was a way to repeat the command.

 

I want to be able to start the command again from the second point but be able to change the quantity of objects im fitting in the next section. Can anyone point me to an existing lisps that does this, or if someone has the knowledge to be able to write it that would make me very happy!

 

I will drop a screen recording of the command im using and you can maybe see how I want the lisp to work.

Thank you! 

Labels (3)
6 REPLIES 6
Message 2 of 7
ВeekeeCZ
in reply to: Anonymous

Two versions. The first one is with a dynamic preview but with no ability to retrieve the last fit point.

The second, no preview, but when setting a base point you can press the up-arrow to see and confirm the last fit point.

 

(defun c:CAFit ( / s )

  (if (setq s (ssget))
    (progn
      (initcommandversion)
      (command "_.copy" s "" pause "_a" pause "_f" pause "")))
  (princ)
  )


(defun c:CAFit2 ( / p r s)

  (or *ca-n*
      (setq *ca-n* 10))
  
  (if (and (setq s (ssget))
	   (setq p (getpoint (strcat "\nBase point: ")))
	   (setq r (getpoint p "\nFit to point: "))
	   (setq *ca-n* (cond ((getint (strcat "\nNumber of copies <" (itoa *ca-n*) ">:")))
			      (*ca-n*)))
	   )
    (progn
      (initcommandversion)
      (command "_.copy" s "" "_non" p "_a" *ca-n* "_f" "_non" r "")
      (setvar 'lastpoint r)))
  (princ)
  )

 

Message 3 of 7
Anonymous
in reply to: ВeekeeCZ

Is there a way to repeat the command after completing the first array to start the next one? 

Message 4 of 7
Kent1Cooper
in reply to: Anonymous

Here's my take on it:

 

(defun C:CA (/ esel)
  (while (setq esel (entsel "\nObject to Copy in Array fashion: "))
    (command "_.copy" (car esel) "" (osnap (cadr esel) "_nea") "_array" pause "_fit" pause) 
  ); while
  (princ)
); defun

 

You can keep going as long as you want, though you need to pick the last one each time [or you could pick something else, such as the original first one and go the other way].  It could be made to automatically select that for you, which I think would require ESCape to end it [this needs only Enter/space or even to just pick in open space].

Kent Cooper, AIA
Message 5 of 7
Anonymous
in reply to: Kent1Cooper

Nice, ya this is what im looking for thank you!

Message 6 of 7
Sea-Haven
in reply to: Anonymous

Your talking about joists but no mention of max spacing that is buiding code required. Why would you not just pick 2 points with max spacing and work out the new spacing to suit. This method has been used for years.

 

You can have a module, balance 1 end, equal ends with fixed spacing, or max number not exceeding joist spacing as requested.

 

There is dynamic block examples of this.

Message 7 of 7
Kent1Cooper
in reply to: Sea-Haven


@Sea-Haven wrote:

Your talking about joists but no mention of max spacing that is buiding code required. Why would you not just pick 2 points with max spacing and work out the new spacing to suit. ....


It won't be as fast as my earlier routine here, but if you have a maximum spacing, and want to use the fewest joists or trusses needed so that the spacing does not exceed the maximum, and don't want to do the calculation of how many that will require in a given distance, that's one of the reasons I made DivideMeasurePlus.lsp and its DIV+ command.  Get it >here<.  It will Divide something with a User-selection of object(s) such as your joist or truss line [regular Divide uses only Points or Blocks], and it has a Maximum-spacing option in which it calculates the number required for you [regular Divide requires a specified number].  It requires an object to so Divide, which means you would need something like a string of Lines along the bays.  But it remembers your Maximum spacing and your object selection and other choices, and offers them as defaults on subsequent use [regular Divide saves no defaults].  And it has an option to put the selection [or other optional things] at the ends of the path object [regular Divide won't do that].

 

Then, of course, there is the question of what kind of joists or trusses you're talking about, or rather, what kind of floor or roof deckDIV+ with whatever spacing it calculates may be fine for steel joists and deck, but not for wood framing and plywood sheathing, which should be done at specific spacings that divide evenly into the length of the plywood sheets [in standard imperial sizes, 16" or 19.2" or 24" for 6 or 5 or 4 spaces per 8' sheet].  For those, you can use the MEA+ plus command in the same file.  It can, for example, center the things it places on the length of the path object with equal remainder lengths at each end [regular Measure will only go from the starting end, with all remainder at the other end].

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report