Jump to content

Recommended Posts

Posted

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.

  • 2 years later...
Posted

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

Posted

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

Posted

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

Posted

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.

Posted

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

Posted

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

Posted

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

Posted

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

Posted

Hello Marko

OK. when enter is a mistake.

For me it works so very good.

The error is just a blemish for me.

Many thanks

Martin

Posted

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

Posted

Hello Marko

OK I will use both

Thank you very much

Greetings Martin

  • 3 years later...
Posted
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. 

 

Posted (edited)

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
Posted

I tried it. The lisp copy more than one object but the copies are in the same place when you enter a new copy.  

Posted

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
Posted
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))
   )
   )
 
)
)

 

Posted

@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? 

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

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