AnsweredAssumed Answered

change/update reference between assembly and part file using document manager API

Question asked by Arun Kumar on Jan 3, 2018

i want to change/update reference between assembly and part file using document manager API

I am very new to solidworks API programming. I don't have idea how to code in dot net to update/change file reference between assembly and part file. here is my code...

//my code in c#
private
void buildFolder(string Drawing,string Part, int rowIndex)

{
            for (int i = 0; i < dgvResultList.Rows.Count; i++)
            {
                folderSpec = dgvResultList.Rows[i].Cells["FOLDERPATH"].Value.ToString();               
                newDrwFileName = folderSpec + "\\"+ dgvResultList.Rows[i].Cells["FILENAME"].Value.ToString() + ".slddrw" ;               
                newPrtFileName = Path.ChangeExtension(newDrwFileName, "sldprt");               
                if (!Directory.Exists(folderSpec))              
                 {
                   Directory.CreateDirectory(folderSpec);
                   File.Copy(Drawing, folderSpec +"\\"+ Path.GetFileName(Drawing));                                       
                   File.Move(folderSpec + "\\" + Path.GetFileName(Drawing), newDrwFileName); // renaming file                   
                   File.Copy(Part, folderSpec + "\\" + Path.GetFileName(Part));                   
                   File.Move(folderSpec + "\\" + Path.GetFileName(Part), newPrtFileName ); // renaming file

 

               // HERE I WANT TO WRITE CODE TO REPLACE REFERENCE
                 }
            }
}

 

can anybody guide me please..

Outcomes