Author Topic: Copy and Paste, where does it go?  (Read 315 times)

0 Members and 1 Guest are viewing this topic.

jtoverka

  • Newt
  • Posts: 45
Copy and Paste, where does it go?
« on: February 13, 2020, 07:10:35 AM »
Hello all,

When I copy objects in AutoCAD (Electrical) where does it go?

I want to add reactors so that when I copy certain objects like wires (lines with xdata pointers to a wire number block) it will copy wire number blocks. Sometimes those wire number blocks are hidden (on a frozen layer) and so it is not always obvious to copy them as well.

I would like to modify my "clipboard" to add certain objects. So when I paste them, it will be included. If this doesn't work, is there a global selection set variable that I could possibly modify prior to being added to a clipboard?

Jeff H

  • Needs a day job
  • Posts: 6061
Re: Copy and Paste, where does it go?
« Reply #1 on: February 14, 2020, 03:33:53 PM »
Just focusing on this part of your post
When I copy objects in AutoCAD (Electrical) where does it go?
Not sure about AutoCAD Electrical, but here is a little test you can do to see if acts similar vanilla AutoCAD.

When you do CopyClip(Ctrl+C) it WBLOCK out items into a drawing in your TEMP folder(Maybe changed depending on a system variable) named starting with "A$"xxxxxx.dwg, and when you do a paste, it copys the entities into the drawings or inserts the drawing as a block depending on if PasteClip or PasteBlock is used.

Here are some steps you can do to test to see if acts similar.
  • Open TEMP folder and sort by Date Modified.
  • Do a COPYCLIP(Ctrl+C) or COPYBASE(Shift+Ctrl+C)
  • See if file is added to Temp folder starting with "A$"
  • Do a PasteBlock(Shift+Ctrl+V) to see if black name matches file name in temp.

Below link is a screencast doing steps above with vanilla AutoCAD, but does mutiple copies to show it renames file in temp folder and does a pasteclip & PasteBlock
https://autode.sk/3bwZvYa
 
Some other links with info might find useful
https://adndevblog.typepad.com/autocad/2013/03/get-path-of-file-on-clipboard-.html
https://through-the-interface.typepad.com/through_the_interface/2010/10/previewing-the-contents-of-the-clipboard-in-an-autocad-palette-using-net.html


jtoverka

  • Newt
  • Posts: 45
Re: Copy and Paste, where does it go?
« Reply #2 on: February 14, 2020, 08:12:14 PM »
Just focusing on this part of your post
When I copy objects in AutoCAD (Electrical) where does it go?
Not sure about AutoCAD Electrical, but here is a little test you can do to see if acts similar vanilla AutoCAD.

Yes! Using standard AutoCAD commands in AutoCAD Electrical simply behaves just like vanilla AutoCAD. This is a problem because many users don't want to go through the effort of using AutoCAD Electrical commands like circuit copy and paste. Not doing so can cause headaches down the line. So I am changing the way vanilla AutoCAD commands work to be compatible with AutoCAD Electrical.

Your suggestions have perfectly answered my questions. Thank you very much!  :yay!:

jtoverka

  • Newt
  • Posts: 45
Re: Copy and Paste, where does it go?
« Reply #3 on: February 14, 2020, 08:25:27 PM »
Here is the code I am using to access the copyclip file:

Code: [Select]
;; Directory Files  -  Lee Mac
;; Retrieves all files of a specified filetype residing in a directory (and subdirectories)
;; dir - [str] Root directory for which to return filenames
;; typ - [str] Optional filetype filter (DOS pattern)
;; sub - [bol] If T, subdirectories of the root directory are included
;; Returns: [lst] List of files matching the filetype criteria, else nil if none are found

(defun LM:directoryfiles ( dir typ sub )
  (setq dir (vl-string-right-trim "\\" (vl-string-translate "/" "\\" dir)))
  (append (mapcar '(lambda ( x ) (strcat dir "\\" x)) (vl-directory-files dir typ 1))
    (if sub
      (apply 'append
        (mapcar
         '(lambda ( x )
            (if (not (wcmatch x "`.,`.`."))
              (LM:directoryfiles (strcat dir "\\" x) typ sub)
            )
          )
          (vl-directory-files dir nil -1)
        )
      )
    )
  )
)

;; get Copy Clip - jtoverka
;; Gets the file from _copyclip
;; Returns: [str] String of file location, else nil if none are found

(defun JO:getCopyClip ( / tempPrefix files)
  (setq tempPrefix (getvar 'tempPrefix))
  (if tempPrefix
    (progn
      (setq files (LM:directoryfiles tempPrefix "A$*.dwg" nil))
      (if files
        (progn
          (car files)
        )
      )
    )
  )
)

roy_043

  • Water Moccasin
  • Posts: 1758
  • BricsCAD 18
Re: Copy and Paste, where does it go?
« Reply #4 on: February 15, 2020, 03:41:42 AM »
To keep objects grouped together it may also be interesting to look at hard pointers (hard references).
Adding an extension dictionary to each object with an Xrecord with hard references to all (other) objects in the group, f.e. (340 . <enameOfObject>), should work.

ribarm

  • Water Moccasin
  • Posts: 2239
  • Marko Ribar, architect
Re: Copy and Paste, where does it go?
« Reply #5 on: February 15, 2020, 05:33:33 AM »
Roy, your DWG crashes my ACAD... BTW. How big is your RAM on your PC?
I've got Fatal Error + not enugh memory to open file...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

jtoverka

  • Newt
  • Posts: 45
Re: Copy and Paste, where does it go?
« Reply #6 on: February 15, 2020, 09:25:45 AM »
Roy, your DWG crashes my ACAD... BTW. How big is your RAM on your PC?
I've got Fatal Error + not enugh memory to open file...

I opened the drawing on my machine and it works. However, it complains that the dwg file was not created by an AutoDesk application.

To keep objects grouped together it may also be interesting to look at hard pointers (hard references).
Adding an extension dictionary to each object with an Xrecord with hard references to all (other) objects in the group, f.e. (340 . <enameOfObject>), should work.

I don't understand what the drawing is supposed to do. When I copy one object is another object supposed to be copied with it? That's the goal I am trying to achieve.

roy_043

  • Water Moccasin
  • Posts: 1758
  • BricsCAD 18
Re: Copy and Paste, where does it go?
« Reply #7 on: February 15, 2020, 10:00:24 AM »
The DWG was created with BricsCAD. In BricCAD (V18) selecting one of the circles for a copy paste operation results in all circles 'coming along'. Even if the other circles are on frozen or 'off' layers.

jtoverka

  • Newt
  • Posts: 45
Re: Copy and Paste, where does it go?
« Reply #8 on: February 15, 2020, 10:24:23 AM »
I see, it won't do that in AutoCAD. At least on my machine.

jtoverka

  • Newt
  • Posts: 45
Re: Copy and Paste, where does it go?
« Reply #9 on: February 15, 2020, 10:55:08 AM »
Does anyone happen to have any code to tie an object to another object? It would be nice if I copy/delete a wire, the wire number is copied/deleted as well. Otherwise, I am using object reactors.

roy_043

  • Water Moccasin
  • Posts: 1758
  • BricsCAD 18
Re: Copy and Paste, where does it go?
« Reply #10 on: February 15, 2020, 02:40:29 PM »
I see, it won't do that in AutoCAD. At least on my machine.
Sorry, I thought BricsCAD was showing compatible behavior here.

jtoverka

  • Newt
  • Posts: 45
Re: Copy and Paste, where does it go?
« Reply #11 on: February 15, 2020, 04:03:05 PM »
I have attached a video showing the behavior of your drawing on my AutoCAD machine. So the behavior I am looking for, I will use your circles as an example, when I copy the red circle, the other circles should be copied as well. When I delete the red circle the other circles are deleted as well. However, when I delete the green or yellow circle, the red circle should be unaffected.

roy_043

  • Water Moccasin
  • Posts: 1758
  • BricsCAD 18
Re: Copy and Paste, where does it go?
« Reply #12 on: February 16, 2020, 05:14:20 AM »
Here's an MP4 showing BricsCAD's behavior.
Note:The colors in the movie are a bit off.