Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NCOPY through X-Refs

8 REPLIES 8
Reply
Message 1 of 9
gccdaemon
913 Views, 8 Replies

NCOPY through X-Refs

I know this isn't the right place to post this, but I'm not getting any help (no replies what so ever) on the LISP forum. Basically, I want to have a LISP routine that acts as ncopy does except with window selection instead of picking single items. Any criticism or routine modification would be hugely appreciated.

 

What I am trying to accomplish is as follows:

1. Select multiple x-refs and/or blocks in a DWG.

2. Created a selection set from a boundary that will select crossing objects and objects contained within the boundary.

3. Each x-ref/block to be opened in refedit and using the boundary in step 2, select the items.

4. Copy each of those items.

5. Remove the new copies from the refedit set.

6. Close & discard the changes for each refedit instance.

 

Here is what I have so far, but I'm new to LISP, so I'm having problems getting the boundary.

 

(defun c:XCOPY (/ SS1 XREF ZBASE XRLIST)
  (setq ZBASE 0,0,0)
  (setq cmdecho (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (princ "\nPick X-Refs or Blocks to copy objects from... ")
  (setq XRLIST (ssget '((-4 . "<OR")(0 . "INSERT")(-4 . "OR>"))))
  (if (null XRLIST)
    (progn
      (princ "No XREF/BLOCK selected")
      (quit)
    )
  )
  (princ "\nSelect nested objects to copy over... ")
  (setq SS1
    (if (null SS1)
    (progn
      (princ "No XREF/BLOCK selected")
      (quit)
    )
  )
  (foreach XREF
    (COMMAND "-refedit" XREF "O" "N" "WP" SS1 "N")
    (COMMAND "_copy" "ALL" "" ZBASE ZBASE)
    (COMMAND "_refset" "R" "ALL" "")
    (COMMAND "_refclose" "D")
  )
  (setvar "cmdecho" cmdecho)
  (princ)
)

 

Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram
8 REPLIES 8
Message 2 of 9
3wood
in reply to: gccdaemon

Just for dicussion:

What is the purpose to run NCOPY with window selection?

Why don't you just open the original xref and copy objects from there?

 

When I use NCOPY, I only copy a few objects, otherwise I open xref and copy directly from there.

It is a bit complicate to realize your request with LISP, otherwise why Autodesk NCOPY can only pick up objects one by one?

 

Message 3 of 9
gccdaemon
in reply to: 3wood

Because I am using GIS x-refs and the files are over 100meg in many cases. Not to mention I'm trying to automate this process so entry level CAD can't mess up the x-refs.

 

What I am aiming to do is not allowable through the NCOPY command, so I have set this up using REFEDIT to copy, drop from the working set into the current drawing, and discard changes. I have a macro that I use but if you miss/pick the wrong item you have to exit the macro process. I am looking at applying ssnamex also, but don't know how it works.

Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram
Message 4 of 9
3wood
in reply to: gccdaemon

Now I understand your situation.

If the accuracy and layer settings are not very important for copied objects, you can zoom to the area you want to copy, then use WMFOUT and WMFIN to import in this part of drawing as a block.

BTW, I guess using BEDIT is not practical because it may need a long time to deal with a 100M xref file.

Message 5 of 9
gccdaemon
in reply to: 3wood

Unfortunately, WMF is not what i'm looking for. Let me give you a little more detail about the items I'm trying to copy. I have imported in GIS linework from .SHP files with additional data (Ex. City Water ID numbers, pipe sizes, etc.). Layering is important as I already have standard GIS layers. This is why it's important to use the Refedit command in this process.

 

I just need help with getting the routine I've already started to work. Is there a way to get and store a WP selection window, and how would I set a FOREACH on the XREF data set?

Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram
Message 6 of 9
azmand01
in reply to: gccdaemon

Hi there,

 

I know exactly what you're talking about. Microstation has this feature and it is a life time saver.

 

Have you been able to get around with a Lisp that does it?

 

I would be interested if you can share it.

 

WFMOUT and WFMIN are not the same thing..

 

Thanks

Message 7 of 9
gccdaemon
in reply to: azmand01

Havn't yet. Trying to get some help coding it out. There is a lot I don't know about Lisp, and I'm having trouble trying to find a way to get a selection boundary that I can store and use on other refedit instances.

Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram
Message 8 of 9
Mhancock27
in reply to: 3wood

Why have xref's if you're copying the line work? Why not do it all in one dwg? I;ve never understood the purpose of xref's.
Message 9 of 9
gccdaemon
in reply to: gccdaemon

X-Refs have multiple uses, but the main one is for splitting out work load. If we have a 30 acre development that has parking, roads, grading, drainage, utilities, etc., we can seperate them and have one person focus on grading, one on utilities, one on site layout for roads and parking and so on. The same goes for having seperate drawings for each sheet. If we have 20 pages of utilities, we could have 20 people annotate in those files without having to wait for anyone to get out of a drawing.

 

The second has to do with file size and plotting complications. If you put everything in one file, you'd have a huge cumbersome drawing that crashes alot. You'd also have to have a plot style for each sheet which makes sheet set-up cumbersome and time consuming.

 

In this instance, I have 100+ MB GIS files that I want to x-ref in, copy a certain area of data out of them, and detach the x-refs so my new "site specific" GIS file is closer to 1 to 2 MB.

 

X-refs speed up plan set production time so you can focus more on design instead of fumbling around with setting up sheets.

Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost