Author Topic: Any multiple Selection for Ncopy ?  (Read 6184 times)

0 Members and 1 Guest are viewing this topic.

pedroantonio

  • Guest
Any multiple Selection for Ncopy ?
« on: June 20, 2018, 04:59:52 AM »
Hi. I am using ncopy command. I dont know if is any way to select multyple lines or objects with a window selection or polygon selection.  Can be done with lisp ?

Thanks

pedroantonio

  • Guest
Re: Any multiple Selection for Ncopy ?
« Reply #1 on: June 20, 2018, 09:37:18 AM »
any ideas ?

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Any multiple Selection for Ncopy ?
« Reply #2 on: June 20, 2018, 10:02:56 AM »
You can try REFEDIT command... COPY while in-place refedit mode... REMOVE copied items from refedit entites... REFCLOSE and SAVE changes...
In refedit mode you can select for copying like you would do it in ordinary mode (by window, crossing, fence...).
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

pedroantonio

  • Guest
Re: Any multiple Selection for Ncopy ?
« Reply #3 on: June 20, 2018, 10:09:34 AM »
With ncopy the oblject stay in the original possition.

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Any multiple Selection for Ncopy ?
« Reply #4 on: June 20, 2018, 10:11:46 AM »
And you can't do copy from 0,0,0 to 0,0,0???
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

pedroantonio

  • Guest
Re: Any multiple Selection for Ncopy ?
« Reply #5 on: June 20, 2018, 10:14:56 AM »
yes. I have th one drawing as xres , under my drawing in the same coordinate system. And i want to take from the xref file  few lines or drawing buildings and come to my drawing in the same place , with the same coordinates

pendean

  • Mosquito
  • Posts: 20
  • "I am not a number, I am a free man"
Re: Any multiple Selection for Ncopy ?
« Reply #6 on: June 20, 2018, 10:50:14 AM »
To answer your original question, not an option in the core oldie command that has never been fixed.

XOPEN command, select your XREF, select those objects then CTRL+C them.
Close XREF.
In your top file, PASTEORIG if as you say all things are in exact locations. If not, use CTRL+SHIFT+C to copy with manually selected base point and CTRL+V to select the same base point in the top file.

pedroantonio

  • Guest
Re: Any multiple Selection for Ncopy ?
« Reply #7 on: June 20, 2018, 10:56:29 AM »
i already try that but the paste in original coordinates is not working !!! So i am trying to find a lisp code to do the job

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Any multiple Selection for Ncopy ?
« Reply #8 on: June 20, 2018, 12:29:05 PM »
Have you tried what I suggested?

Code - Auto/Visual Lisp: [Select]
  1. (defun c:ncopyselset ( / el ss )
  2.   (prompt "\nPick block-xref for ncopyselset...")
  3.   (vl-cmdf "_.REFEDIT" "\\")
  4.   (setq el (entlast))
  5.   (prompt "\nSelect objects you want to ncopyselset...")
  6.   (setq ss (ssget "_:L"))
  7.   (vl-cmdf "_.COPY" ss "" "_non" '(0.0 0.0 0.0) "_non" '(0.0 0.0 0.0))
  8.   (setq ss (ssadd))
  9.   (while (setq el (entnext el))
  10.     (ssadd el ss)
  11.   )
  12.   (vl-cmdf "_.REFSET" "_R" ss "")
  13.   (vl-cmdf "_.REFCLOSE" "_D")
  14.   (princ)
  15. )
  16.  
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

pedroantonio

  • Guest
Re: Any multiple Selection for Ncopy ?
« Reply #9 on: June 20, 2018, 12:40:10 PM »
Thanks ribarm

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Any multiple Selection for Ncopy ?
« Reply #10 on: June 20, 2018, 06:08:01 PM »
This isn't completely what you are looking for, but it will copy an entire block if you select it or you can tell it to only copy individual entities. It might be a good starting point for a routine that is faster than the above routine. Also, a would of caution about the approach above is some versions of AutoCAD can't copy to the clipboard during a refedit.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:ncopy ( / ob olderr *Prompt* SS StopLoop input code data pt1 blk blks e i lst obj tm a b)
  2.         (setq OldErr *error*
  3.               *error* newerr
  4.         )
  5.         (setq SS (ssadd))
  6.         (while (= StopLoop nil)
  7.                 (if (> (sslength SS) 0)
  8.                         (progn
  9.                                 (if (= *Block* T)
  10.                                         (setq *Prompt* "\rSelect object or base point [<Block>/Single]")
  11.                                         (setq *Prompt* "\rSelect object or base point [Block/<Single>]")
  12.                                 )
  13.                         )
  14.                         (progn
  15.                                 (if (= *Block* T)
  16.                                         (setq *Prompt* "\rSelect object [<Block>/Single]")
  17.                                         (setq *Prompt* "\rSelect object [Block/<Single>]")
  18.                                 )
  19.                         )
  20.                 )
  21.                 (princ *Prompt*)
  22.                 (setq input (grread t 4 2)
  23.                           code (car input)
  24.                           data (cadr input)
  25.                 )
  26.                 (cond
  27.                         ((= code 2);Keyboard entry
  28.                                 (cond
  29.                                         ((or (= data 66) (= data 98)); Block
  30.                                                 (setq *Block* T)
  31.                                         )
  32.                                         ((or (= data 83) (= data 115)); Single                 
  33.                                                 (setq *Block* nil)
  34.                                         )
  35.                                         ((or (= data 13) (= data 32))
  36.                                                 (setq StopLoop T)
  37.                                                 (princ)
  38.                                         )
  39.                                 )
  40.                         )
  41.                         ((= code 25)
  42.                                 (setq StopLoop T)
  43.                                 (princ)
  44.                         )
  45.                         ((= code 3);Left mouse click
  46.                                 (if (/= data nil)
  47.                                         (progn
  48.                                                 (setq pt1 data
  49.                                                           ob1 (nentselp "" pt1)
  50.                                                 )
  51.                                                 (if (= ob1 nil)
  52.                                                         (progn ;Object not found
  53.                                                                 (if (> (sslength SS) 0)
  54.                                                                         (progn
  55.                                                                                 (princ "\rSelect displacement point: ")
  56.                                                                                 (command "._move" SS "" pt1 PAUSE)
  57.                                                                                 (setq StopLoop T)
  58.                                                                                 (princ)
  59.                                                                         )
  60.                                                                 )
  61.                                                         )
  62.                                                         (progn ;Object found
  63.                                                                 (defun ncp:Single (Ob1 /) ; Original Code for single object from: LeeMac at http://www.theswamp.org/index.php?topic=39876.msg451779#msg451779
  64.                                                                         (if
  65.                                                                                 (and
  66.                                                                             (setq a OB1)
  67.                                                                             (= 4 (length a))
  68.                                                                             (setq b (entmakex (entget (car a))))
  69.                                                                                 )
  70.                                                                         (vla-transformby (vlax-ename->vla-object b) (vlax-tmatrix (caddr a)))
  71.                                                                         )
  72.                                                                         (ssadd (entlast) ss)
  73.                                                                 )              
  74.                                                                 (if *Block*
  75.                                                                         (progn ;Copy entire block - Original Code for entire block from: RonJonP at http://www.theswamp.org/index.php?topic=27354.msg329179#msg329179
  76.                                                                                 (setq blks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))
  77.                                                                                 (setq e ob1)
  78.                                                                                 (setq tm (caddr e))
  79.                                                                                 (setq blk (car (cadddr e)))
  80.                                                                                 (setq blk (vlax-ename->vla-object blk))
  81.                                                                                 (setq i (vla-item blks (vla-get-name blk)))
  82.                                                                                 (if     (= (vla-get-isxref i) :vlax-false)
  83.                                                                                         (vlax-for       be i
  84.                                                                                                 (if (and (setq e (entget (vlax-vla-object->ename be)))
  85.                                                                                                         (not (cdr (assoc 102 e)))
  86.                                                                                                                 (setq obj (entmakex e))
  87.                                                                                                                 (setq obj (vlax-ename->vla-object obj))
  88.                                                                                                         )
  89.                                                                                                         (progn
  90.                                                                                                                 (vla-transformby obj (vlax-tmatrix tm))
  91.                                                                                                                 (setq lst (cons (list obj (vla-get-color obj)) lst))                                                                                                           
  92.                                                                                                                 (vla-update obj)
  93.                                                                                                         )
  94.                                                                                                         (ncp:Single Ob1)
  95.                                                                                                 )
  96.                                                                                         )
  97.                                                                                         (progn
  98.                                                                                                 (setq obj (vlax-ename->vla-object (entmakex (entget (car e)))))
  99.                                                                                                 (vla-transformby obj (vlax-tmatrix tm))
  100.                                                                                                 (setq lst (cons (list obj (vla-get-color obj)) lst))
  101.                                                                                                 (vla-update obj)
  102.                                                                                         )
  103.                                                                                 )
  104.                                                                                 (if lst
  105.                                                                                         (progn
  106.                                                                                                 (foreach o lst   
  107.                                                                                                         (ssadd (vlax-vla-object->ename (car o)) ss)
  108.                                                                                                 )
  109.                                                                                         )
  110.                                                                                 )
  111.                                                                         )
  112.                                                                         (progn ;Copy single entity
  113.                                                                                 (ncp:Single Ob1)
  114.                                                                         )
  115.                                                                 )
  116.                                                         )
  117.                                                 )
  118.                                         )
  119.                                 )
  120.                         )
  121.                 )
  122.         )
  123. )

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Any multiple Selection for Ncopy ?
« Reply #11 on: June 20, 2018, 06:58:47 PM »
or open the files simultaneously
tile the windows

select the object you want

right click over a higlited grip hold down...and drag them into the destination file....release mouse button
and select paste to original coordinates...
Be your Best


Michael Farrell
http://primeservicesglobal.com/

pedroantonio

  • Guest
Re: Any multiple Selection for Ncopy ?
« Reply #12 on: June 21, 2018, 12:44:38 AM »
I find this lisp code. Can any one update the code to select objects with window or polygon window ?

Code - Auto/Visual Lisp: [Select]
  1. ;;; Modified by Igal Averbuh 2015 (added option to move "transferred" items in current drawing)
  2. ;;; Based on http://www.theswamp.org/index.php?topic=27354.msg329179#msg329179
  3. (defun c:cob (/ blk blks e i lst obj tm ss)
  4. )
  5. ss (ssadd)
  6. )
  7. (while (and (setq e (nentselp "Select nested object to copy: "))
  8. (setq tm (caddr e))
  9. (setq blk (car (cadddr e)))
  10. (setq blk (vlax-ename->vla-object blk))
  11. (setq i (vla-item blks (vla-get-name blk)))
  12. )
  13. (if     (= (vla-get-isxref i) :vlax-false)
  14. (vlax-for       be i
  15. (if (and (setq e (entget (vlax-vla-object->ename be)))
  16. (not (cdr (assoc 102 e)))
  17. (setq obj (entmakex e))
  18. (setq obj (vlax-ename->vla-object obj))
  19. )
  20. (setq lst (cons (list obj (vla-get-color obj)) lst))
  21. )
  22. (princ (strcat "\nComplex entity not created [ "
  23. (cdr (assoc 0 e))
  24. " ]"
  25. )
  26. )
  27. )
  28. )
  29. (setq obj (vlax-ename->vla-object (entmakex (entget (car e)))))
  30. (setq lst (cons (list obj (vla-get-color obj)) lst))
  31.  
  32. )
  33. )
  34. )
  35. (if lst
  36. (progn (foreach o lst
  37. (setq ss (ssadd (vlax-vla-object->ename (car o)) ss))
  38. (command ".draworder"
  39. (vlax-vla-object->ename (car o))
  40. ""
  41. "front"
  42. )
  43. )
  44.  
  45. (command "_.move" ss "" pause)
  46.  
  47. (sssetfirst nil ss)
  48. )
  49. )
  50. )
  51.  
  52. (c:cob)
  53.  

Thanks

taoyi0727

  • Mosquito
  • Posts: 1
Re: Any multiple Selection for Ncopy ?
« Reply #13 on: June 28, 2018, 12:22:19 PM »
Thank you for the landlord's code
I can't speak English. This forum is all seen in translation software.
It's hard to learn without English