Hi,
I came across a problem in the projectwise reference creation.
I am basically trying to create a new command in Autocad which will created new sheet in PW with a reference attached(Title block).
For that I am doing
1. On new document , select the title block from PW.
2. copy out the Title block to some hard drive path.
3. Attach Xref in the document opened in the autocad with this path file.
4. Save the document with some name(document code).
5. Now create a unknown document in PW and set the file we created with the titleblock as reference. (and set reference in PW with aaApi_CreateReferenceInformation2)
6. The document is created in the PW and I fire Open document from PW as we need the integration to work.
7. Perfect , the document get opened and reference title block is also opened and seen properly.
8. Now Copy out the titleblock , it get to another temporary directory. Free it.
9. Free the opened document with the title block reference.
10.Again open the document with title block reference. Now the reference is missing. WHY?
As the reference is created with the GUI (projectid and document ID) which is show properly in PW and first open is good. However when the temporary bak file(title block copy out) is deleted , the reference,
does not work. Why? What is its connection with the temporary copy out reference file?
I have tried all the possible combination for aaApi_CreateReferenceInformation2 functions, but some how it keeps link with copy out document with working directory.
Create Reference line
if (!PWWrapper.aaApi_CreateReferenceInformation2(1, ref masterGuid[0], 0, ref referenceGuid[0], 1, 114/*177*/, 0, 2)) {
}
Create Document Line
status = PWWrapper.aaApi_CreateDocument( ref docID, // new document's doc id iProjectID, // id of folder to create doc in 0, // 0 means default storage 0, // 0 unless you have reason to use something else PWWrapper.DocumentType.Unknown, // 0 unless you have reason to use something else lngAppID, // 0 means none for application 0, // 0 means none for department lngWorkSpaceID, // workspace profile strFileName, // source file sDocCode, // what to call the file in PW sDocCode, // doc name strFileName, // doc description null, // version string - you might want to check DS settings... false, // TRUE means file is checked out at create time PWWrapper.DocumentCreationFlag.NoAttributeRecord, // check documentation for ulFlags strWorkingDir, // location of the file if checked out 4021 - 1, // make sure the buffer is large enough ref lAttributeId // new attribute id in environment if created - see ulFlags );
Reference information in PW
Thank you for helping me.
Regards,
Rashmi.
Why do this? "Free the opened document with the title block reference." Why not Check-In? Check-in saves the change to the file back to the server. Free discards the file with the changes.
The problem occurs even though I check-in the file. As mentioned in scenario, after flowing the titleblock on the document , the file is saved in the PW and then opened. The reference creation in PW is not respected, as still refers to copyout file(which gets deleted if we open the titleblock documents which refer to different place i.e. temporary dms folder) not the one in PW .
aaApi_CreateReferenceInformation2 only tells PW that the file is a reference, so that when you check out the master file the XREF is copied into the local DMS folder. The path stored in the reference should be a relative path like ...\..\d01234\mytitleBlock.dwg