.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copying and pasting XData between drawings

6 REPLIES 6
Reply
Message 1 of 7
SRSDS
541 Views, 6 Replies

Copying and pasting XData between drawings

Hi again,

 

How can know if entities are being manually copied and pasted between drawings.

A thought is to add a GUID to each entities Xdata and check if the value is in the named object dictionary. 

 

6 REPLIES 6
Message 2 of 7
Alfred.NESWADBA
in reply to: SRSDS

Hi,

 

good idea, but copying the drawing (with file-copy) is not prevented with this way.

Not as criticism, just as info to think of it!

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 7
SRSDS
in reply to: Alfred.NESWADBA

ohh.. good point! 

I will read the filename also as a second measure. Filenames might be the same as well but both would be rare.

Or maybe the file creation date and time. 

Probably no need to write anything as data. I just need to read the identifiers during copy and paste to see if they don't match. 

Thanks again.

Message 4 of 7
Alfred.NESWADBA
in reply to: SRSDS

Hi,

 

not sure what your global direction is. For me and my way of work, the filename is used as variable as possible.

1) On one side I save with a drawing-name ending with 2-4 digits as version-number and from time to time I do a _SAVEAS and increase the number.

2) On the other side, I transfer the files between computers (e.g. to home-office), continue to work and then copy it back (will be an allowed copy?)

3) not to forget, what if you get a file back by restoring from a backup-system (also allowed filecopy, isn't it?)

 

...and I think that there are a lot more reasons to copy a file and it sould be also valid out of your sight.

 

I think (without something like a data-managementserver, where the files are not stored in a filessystem you can directly access) it will not be possible to handle a filecopy with data stored within the DWG-file, that on one side allows the above variations but limit some - from your point of view - "not allowed"mechanism of copying.

Within the dataserver you have document-id's that give you the possibility of using a unique-id that you cannot get from a filesystem. However, also handling that with the fileserver is a challange.

 

Maybe you could describe more of "for what reason" are you doing that, then there may come some better ideas than this one.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 5 of 7
SRSDS
in reply to: Alfred.NESWADBA

I really just need to know if the objects being pasted into a drawing have been copied from the same drawing.

COPYBASE command is the only event I need to consider.

I’ll tell users that other methods like inserting a drawing as a block then exploding isn't supported.

Maybe the file creation date and time is a good unique identifier to monitor.

Dim FileCreationTime As String = File.GetCreationTime(db.Filename())

 


 

Message 6 of 7
Alfred.NESWADBA
in reply to: SRSDS

Hi,

 

I even don't know what type of copy is now allowed, sorry. Why do you have to watch only _COPYBASE, there is also _COPYCLIP and also I think that not creating the copy-buffer will be the problem but the _PASTE*-methods have to be watched (or is it also not allowed to create a copy of geometry into MS-Word for documentation?).

 

The file-creation-date will also fail with my above types (backup-restore/copy to home-office/version-numbering).

 

And if you write EEDs and NOD, how will you handle the situation of home-work? Will you ensure that the home-pc will also run your application every time AutoCAD starts (and with any AutoCAD-profile and ...)

 

Now, after reading that .... all I'm writing look so pessimistic. Please understand that just as ideas, not as "all is nonesens"!

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 7 of 7
SRSDS
in reply to: Alfred.NESWADBA

Hi Alfred.

Sorry. First time I've done this and have no experience at all. 

I personally only use COPYBASE between drawings. I wasn't thinking about COPYCLIP or CUTCLIP but will now.

 

Filename including the path should solve the drawing identification problem I think (checking source dwg = destination dwg). Two open drawings will never the same filepath & filename.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost