Reply

How to change path of a CopyConstruction?

[ Edited ]

 

I have been trying to change the path of a CopyConstruction by using the PutFileName method.  It does not update it into the object; however, if I change the FileName in Solid Edge Spy it updates it.  Any idea why this is not working or how to properly do this?  I appreciate anyone's assistance with this problem.  I am placing the code I've been trying below:

 

 

 

if(filename.find(xref->getCadName()) != wstring::npos)     //convert wstring to string

 

{

 

     string new_name(new_filename.begin(), new_filename.end());

     new_name.assign(new_filename.begin(), new_filename.end());

     _bstr_t cppstrings(new_name.c_str());

     copy->PutFileName(cppstrings);

 

     _bstr_t temp_name = copy->FileName;

}

 

CopyConstructionPtr copy = construct_copies->Item(i);

wstring filename(copy->GetFileName());

 

 

Posted by: Derek Rollinson
Post date: 4/29/2010 4:57:40 AM

2 REPLIES

RE: How to change path of a CopyConstruction?

[ Edited ]

 

Dear

Even I had a same problem but I could not resolved it! Sorry..

But manually you can change in Revision Manager but I have used VB.NET to change the copied parts in a part or assembly environment.

Try with Revision Manager may by you will get it.

All the Best

Sandeep S

 

Posted by: Sandeep Shewale
Post date: 4/29/2010 6:45:01 PM

RE: How to change path of a CopyConstruction?

[ Edited ]

 

Sandeep,

How did you do this with Revision Manager? I have been trying but when I use PutFullName I get a com exception saying that it is a read only property? It also looks like RevisionManager might be opening the file as readonly, any idea on this? I appreciater your assistance.

 

 

 

RevisionManager::ILinkedDocsAutoPtr linked_docs = rev_doc->GetLinkedDocuments();

 

for (long i=1; iCount; i++)

{

RevisionManager::IDocAutoPtr doc = linked_docs->GetItem(i);

 

wstring filename = const_cast((LPCTSTR)doc->Get_FullName());

 

if(filename.find(xref->getCadName()) != wstring::npos)

{

//convert wstring to string

string new_name(new_filename.begin(), new_filename.end());

new_name.assign(new_filename.begin(), new_filename.end());

 

_bstr_t name(new_name.c_str());

 

doc->_FullName = name;

}

}

 

rev_doc->SaveAllLinks();

 

 

Posted by: Derek Rollinson
Post date: 4/30/2010 2:13:10 AM