rectangular array - creating every other row offset?

rectangular array - creating every other row offset?

jetted4
Advocate Advocate
3,121 Views
14 Replies
Message 1 of 15

rectangular array - creating every other row offset?

jetted4
Advocate
Advocate

I would like to be able to create a rectangular array in which every other row is offset half the distance to the left (see attached jpg).  Is that possible?

0 Likes
Accepted solutions (1)
3,122 Views
14 Replies
Replies (14)
Message 2 of 15

CodeDing
Advisor
Advisor

@jetted4 ,

 

How comfortable are you with blocks?

this seems it could be easily accomplished w/ non-programming methods.

See attached dwg.

 

image.png

 

--- EDIT ---

I updated the attached DWG to incorporate a second block attempt, which you might prefer.

 

Best,

~DD

Message 3 of 15

jetted4
Advocate
Advocate

Blocks are fine. 

I was just hoping their might be some sort of option built in that I wasn't seeing so that I wouldn't have to create a 2nd item in the right spot in order to get the same result.

 

Thanks  🙂

0 Likes
Message 4 of 15

CodeDing
Advisor
Advisor

Hmmm, yeah I cannot think of another method to get that same effect.

0 Likes
Message 5 of 15

stevor
Collaborator
Collaborator

There lisp routines for creating arrays here, and everywhere.

Yours could be 2 arrays, 2 start points.

S
0 Likes
Message 6 of 15

Kent1Cooper
Consultant
Consultant

Another thing you can do is to set up two of them with the offset, say, the two closest to the bottom left corner in your image, and then just Array with those two as the selection, using twice the row spacing.  That is simple, but has the possible drawback that you can do only an even number of rows, so if you want an odd number, you'd need to Erase the extra row.

Kent Cooper, AIA
0 Likes
Message 7 of 15

Kent1Cooper
Consultant
Consultant

You may find CylinderSphereLine.lsp, available >here<, a starting point.  It's a 3D application, lining the end surfaces and walls of the inside of a cylinder with spheres, but the "floor" part of what it does could be adaptable to your purposes using Circles.

 

Another option is a Hatch pattern that does what look pretty much like  Circles, though they are really polygons of a large number of sides.  I made several patterns that do that, all called CirclesTriGrid followed by a descriptive suffix, available >here<.  You would want CirclesTriGridOpen.  I think the "circles" it makes [really 24-gons] may be a little closer together than in your image -- the space between is equal to the "diameter" of each.  See the rest of the topic there, and the comments at the top of the file.

Kent Cooper, AIA
0 Likes
Message 8 of 15

jetted4
Advocate
Advocate

Thanks to everyone for the ideas.  🙂

It's kind of a common enough sort of need and not overly complicated...wish there were an offset every other row sort of feature option in.

0 Likes
Message 9 of 15

Kent1Cooper
Consultant
Consultant

There's a designated place to suggest that to them -- the >Product Feedback< page.

Kent Cooper, AIA
0 Likes
Message 10 of 15

Sea-Haven
Mentor
Mentor

It could be done as a row of circles make a list of how many then entity names, copy and create at the diagonal offset, then paste diagonal again sq up. A odd - even style approach looping for as many as required but yeah no direct array.

0 Likes
Message 11 of 15

ParishSouthBdx
Collaborator
Collaborator

for example, if the spacing between the rows is 1", the array the first row of circles on a 2" center to center, then copy those arrays down 1", and then move them over.  but in one fell swoop, not sure

0 Likes
Message 12 of 15

Sea-Haven
Mentor
Mentor
Accepted solution

Its cold and wet so inside

 

; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-array-creating-every-other-row-offset/td-p/9667120
; array rows a 1/2 x spacings
; Enter -ve values to change direction.
;By AlanH info@alanh.com.au Aug 2020

(defun c:zigzag ( / ent ss ans hor ver numx numy x )
(setq ent (entsel "\nSelect object to array"))
(setq ss (ssadd))
(ssadd (car ent) ss)
(if (not AH:getvalsm)(load "Multi Getvals.lsp"))
(setq ans (AH:getvalsm (list "Enter spacings " "Horizontal  " 5 4 "100" "Vertical" 5 4 "50" "Num X " 5 4 "3"  "Num Y" 5 4 "3")))
(setq hor (atof (nth 0 ans)))
(setq ver (atof (nth 1 ans)))
(setq numx (atoi (nth 2 ans)))
(setq numy (atoi (nth 3 ans)))
(setq x 1.0)
(repeat (- numx 1)
(command "copy" ent "" (list 0.0 0.0) (list  (* x hor) 0.0) )
(ssadd (entlast) ss)
(setq x (+ x 1))
)
(setq x 1.0)
(while (< x numy)
(command "copy" ss "" (list 0.0 0.0) (list (* 0.5 (- hor)) (* x ver)))
(setq x (+ x 2))
)
(setq x 2.0)
(while (< x numy)
(command "copy" ss "" (list 0.0 0.0) (list 0.0 (* ver x)))
(setq x (+ x 2))
)
(princ)
)
(c:zigzag)



0 Likes
Message 13 of 15

jetted4
Advocate
Advocate

Works great. thanks  🙂

 

(although it took me a couple of tries before I realized that I needed to load both the imbedded lsp program and the attached one as well)

0 Likes
Message 14 of 15

Sea-Haven
Mentor
Mentor

Glad to here it works. The library Multi getvals.lsp can be used in any program. Multi Radio buttons & Multi toggles are available also.

 

(if (not AH:getvalsm)(load "Multi Getvals.lsp"))

You only need the multi getvals in a support search path location should have all your lisps there. Then can call from menu etc just by name no need for path. Or change the (load "c:\directory\etc\etc\multi getvals") to suit 

0 Likes
Message 15 of 15

jetted4
Advocate
Advocate

Though it generates the array wonderfully, I did run into a glitch with printing and also with saving the lsp in my contents library that I could use your input on (pls see PM).

 

Thanks  🙂

0 Likes