Jump to content

Accumulative copy lisp


Nobull84

Recommended Posts

Nail on the head there Lee Mac. Simple yet all that is needed. Although array and offset were similar, this will save those precious seconds. Thank you all for the good tips and quick responses.

Link to comment
Share on other sites

  • 2 years later...

Hello, would ask could be whether one could change this Lisp even so use it to copy with different distances?

Here but you'd have the thickness of the copied object into account with

1) query dist1

2) query Dist,

3) Command "copy" .........

4) Command "copy" .........

etc ......

Thanks for your help!

best regards

Martin

copy different distance.jpg

Link to comment
Share on other sites

No need for lisp... This can be achieved with standard COPY command "MULTIPLE" option... You have to supply correct base point and reference orientation and then just specify different distances values and copies of sel.set will be created... Only thing you have to subsequently add distances each time you specify new one (for this you may write simple code...)

Link to comment
Share on other sites

Hello Marko,

Thank you for your help.

I know the command to copy several times.

This command and transparent command track I use. Copy In many but this is very troublesome.

I would be glad if you could do this faster without each time you copy a Refferenzpunkt specify.

 

Greetings Martin

Link to comment
Share on other sites

This ? :

 

(defun c:ccdd ( / *error* ss cm p pp osm d dl v pn )

 (defun *error* ( msg )
   (if cm
     (setvar 'copymode cm)
   )
   (if osm
     (setvar 'osmode osm)
   )
   (if msg
     (prompt msg)
   )
   (princ)
 )

 (setq ss (ssget "_:L"))
 (setq cm (getvar 'copymode))
 (setvar 'copymode 0)
 (setq p (getpoint "\nPick or specify base point : "))
 (setq pp (getpoint "\nPick or specify direction vector point : " p))
 (setq osm (getvar 'osmode))
 (setvar 'osmode 0)
 (while 
   (progn
     (initget 2)
     (setq d (getdist "\nSpecify distance <Exit> : "))
   )
   (if d
     (progn
       (setq dl (cons d dl))
       (setq v (mapcar '/ (mapcar '- pp p) (list (distance p pp) (distance p pp) (distance p pp))))
       (setq pn (mapcar '+ p (mapcar '* v (list (apply '+ dl) (apply '+ dl) (apply '+ dl)))))
       (command "_.COPY" ss "" "_non" p "_non" pn)
     )
   )
 )
 (*error* nil)
)

 

M.R.

Link to comment
Share on other sites

Hello Marko,

Not quite. If I give you the base point, and then the vector point then this distance should be added to the query distance.

For example, if the distance from the base point to the vector point is 20 and the detection distance 100 is then the copy should be 120 units copied. Always the 20 units to enter.

 

Greetings Martin

Link to comment
Share on other sites

You are telling me that you can't select object(s), pick base, choose direction vector and then specify 20, then 100, then 20, then 100, then 20, then 150, and so on...

Link to comment
Share on other sites

Hello Marko

I have done it with your help!

Many thanks

 

 

;Lisp von Marko Ribar
;http://www.cadtutor.net/forum/showthread.php?82934-Accumulative-copy-lisp&p=655507#post655507
(defun c:ccdd ( / *error* ss cm p pp osm d dl v pn DD )

 (defun *error* ( msg )
   (if cm
     (setvar 'copymode cm)
   )
   (if osm
     (setvar 'osmode osm)
   )
   (if msg
     (prompt msg)
   )
   (princ)
 )

 (setq ss (ssget "_:L"))
 (setq cm (getvar 'copymode))
 (setvar 'copymode 0)
 (setq p (getpoint "\nPick or specify base point : "))
 (setq pp (getpoint "\nPick or specify direction vector point : " p))
 (setq DD (distance p pp));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (setq osm (getvar 'osmode))
 (setvar 'osmode 0)
 (while 
   (progn
     (initget 2)
     (setq d (getdist "\nSpecify distance <Exit> : "))
  (setq d (+ d DD))
   )
   (if d
     (progn
       (setq dl (cons d dl))
       (setq v (mapcar '/ (mapcar '- pp p) (list (distance p pp) (distance p pp) (distance p pp))))
       (setq pn (mapcar '+ p (mapcar '* v (list (apply '+ dl) (apply '+ dl) (apply '+ dl)))))
       (command "_.COPY" ss "" "_non" p "_non" pn)
     )
   )
 )
 (*error* nil)
)

Link to comment
Share on other sites

You can't exit (while) loop with that intervention by pressing ENTER - quiet exit... I suggest that you use : 20, 100, 20, 120, 20, 150, ...

Link to comment
Share on other sites

One day you'll probably realize that you not always want to copy 20,100,20,120,20,150... You'd realize that some time it'd be better to copy 20,100,20,120,25,150,30,120,...

Link to comment
Share on other sites

  • 3 years later...
On 11/16/2013 at 11:19 AM, Nobull84 said:

Now I believe I found damn near exactly what I'm looking for. The attached code, by Patrick Evangelista, is perfect except one minor change. With this, you can only select one item at a time. Can someone tweak this a little to be able to select multiple objects? Thank you in advance again.

 

 


;;; CADALYST 09/07  Tip 2236: copy_agn.lsp Continued Copy (c) 
2007 Patrick Evangelista


;;;;;;; copy again...again...again..."
(defun c:CCC ()
 
(setq obj (entsel "\nSelect object to copy: ")
pt1 (getpoint 
"\nPick base point:")
 )
 (initget 62)
 
(setq pt2 (getpoint pt1 "\nNext point:")
kk  'T
 
)
 (command "copy" obj "" pt1 pt2)
 (while 
KK
   (progn (initget "X")
   (setq opt 
(getkword "\nEnter to continue/X to exit: "))
   (cond ((= 
opt nil) (command "copy" (entlast) "" pt1 pt2))
  ((= opt "X") 
(setq kk nil))
   )
   )
 
)
)
 

Hi, I would like to know if you can figure it out how to select multiple objects. 

 

Link to comment
Share on other sites

In a real primitive way this allows multiple selection.

 

(setq obj (ssget))

Looking at the code not sure why you would bother the copy command allows select multiple objects, and paste multiple times.

 

Change this (command "copy" (entlast) "" pt1 pt2)) The (entlast) replaced with obj.

 

It looks like it just copies to the same point. Oh easier is change to how many rather than ask to repeat. Hint repeat.

Edited by BIGAL
Link to comment
Share on other sites

In Line with @BIGAL's comments, This stripped down version will suit. When you want to finish press enter or right click the mouse.

 

(defun c:CCC ( / ss pt1 pt2)
  (prompt "\nSelect objects to copy : ")
  (setq ss (ssget)
        pt1 (getpoint "\nSelect Base point : ")
  )
  (while (setq pt2 (getpoint pt1 "\nNext point : "))
    (command "copy" ss "" pt1 pt2)
  )
)

 

  • Like 1
Link to comment
Share on other sites

3 hours ago, dlanorh said:

In Line with @BIGAL's comments, This stripped down version will suit. When you want to finish press enter or right click the mouse.

 


(defun c:CCC ( / ss pt1 pt2)
  (prompt "\nSelect objects to copy : ")
  (setq ss (ssget)
        pt1 (getpoint "\nSelect Base point : ")
  )
  (while (setq pt2 (getpoint pt1 "\nNext point : "))
    (command "copy" ss "" pt1 pt2)
  )
)

 

Original idea. Nobull needed a copy lisp that will add the entered dimension accumulatively.

 

Example: Command; copy, pick object(s), pick base point, enter displacement, "10 foot", first click copies in a direction at ten foot, then twenty, thirty, forty, etc....

 

I would like to be able to do this without having to snap to the last copied object (as the standard copy command would be used for). The type of work I do, the drawings can be very busy and snaps can move too easily. The other reason is for speed.

 

He got the lisp but only for one object. He was asking the same question like me. How can I copy more than one object in this lisp? 

 

(defun c:CCC ()
 
(setq obj (entsel "\nSelect object to copy: ")
pt1 (getpoint 
"\nPick base point:")
 )
 (initget 62)
 
(setq pt2 (getpoint pt1 "\nNext point:")
kk  'T
 
)
 (command "copy" obj "" pt1 pt2)
 (while 
KK
   (progn (initget "X")
   (setq opt 
(getkword "\nEnter to continue/X to exit: "))
   (cond ((= 
opt nil) (command "copy" (entlast) "" pt1 pt2))
  ((= opt "X") 
(setq kk nil))
   )
   )
 
)
)

 

Link to comment
Share on other sites

@CarlosMD

I was able to get one to select multiple objects, pick any point (e.g. for 6"), hover in any direction, and then hold enter for 6, 12, 18, 24 etc. 

 

Was this what you're looking for? Or something slightly different? 

Link to comment
Share on other sites

3 minutes ago, Nobull84 said:

@CarlosMD

I was able to get one to select multiple objects, pick any point (e.g. for 6"), hover in any direction, and then hold enter for 6, 12, 18, 24 etc. 

 

Was this what you're looking for? Or something slightly different? 

I just want to copy more than one object.

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