Jump to content

Recommended Posts

Posted (edited)

This was question in another post but I thought I would have a go at something, it uses a simple method 2x40 copy objects 2 times in the X direction 40 apart, it works for Y as well, it is written with ortho in mind ie X & Y axis but works on an angle if you use a temporary UCS. It supports 2x-40 to go other way.

 

It may be usefull.

 

; copy multiple objects along x or y axis
; use 2x40 etc
; by Alan H aug 2017
(defun c:cd ( / ss  num ans)
(defun copyx ( / x)
(setq howmany (atoi (substr ans 1 num)))
(setq dist (atof (substr ans (+ num 2)(- (strlen ans) (+ num 1)))))
(setq x 1.0)
(repeat howmany
(command "copy" ss "" (list 0 0) (list (* dist x) 0))
(setq x (+ x 1.0))
)
(setq ss nil)
)

(defun copyy ()
(setq howmany (atoi (substr ans 1 num)))
(setq dist (atof (substr ans (+ num 2)(- (strlen ans) (+ num 1)))))
(setq x 1.0)
(repeat howmany
(command "copy" ss "" (list 0 0) (list 0 (* dist x) ))
(setq x (+ x 1.0))
)
(setq ss nil)
)
(princ "\nPlease pick objects <Cr> to exit")
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0) 
(while (/= (setq ss (ssget)) nil)
(setq ans (strcase (getstring "Enter num XY offset 2x40")))
(cond
((/= (setq num (vl-string-search "X" ans )) nil)(copyx))
((/= (setq num (vl-string-search "Y" ans )) nil)(copyy))
(alert "You have Entered an incorrect value")
)
)
)

Edited by BIGAL
Posted

Is this the same function as a rectangular array?

Posted (edited)

No it was done purposely to not use array command rather a simplified version of copying an object in x & y directions you can do 1x40 copy 1 object +40 in X direction. It would be used by people who stuff like bolt holes in patterns, it will work on angles as well, provided you set the ucs.

 

Something like this starting with bottom right circle, 1y100 copy up, L copy across 1x-100 L then 3x-50 L 1x-100 L 1y-50

 

Using the L LAST and Enter key is a fast way of repeating using an object like a circle.

ScreenShot016.jpg

Edited by BIGAL

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