santoshr0114 - Tuesday, December 2, 2014 5:36 AM:
Hi,
I have just started to use ARAS and write some basic programs like Save, CheckIn, CheckOut using C# .Net and Visual Studio 2013.
I am trying to add new file to ARAS but i get the below error
Failed to check-in file 'C:UsersABCDocumentsSolidEdge_DocsPart1.par':
ErrorCode: SOAP-ENV:Server
ErrorMessage: Innovator Server processed the request successfully, but physical save of following Files failed:
Part1.par saving to permanent directory failed (Error moving file D:ArasWorkingFolderVaultInnovatorSolutions3A10310513B43C28C538F0A8F4014C5Part1.par to Part1.par.)
ErrorDetails: Innovator Server processed the request successfully, but physical save of following Files failed:
Part1.par saving to permanent directory failed (Error moving file D:ArasWorkingFolderVaultInnovatorSolutions3A10310513B43C28C538F0A8F4014C5Part1.par to Part1.par.)
Below is the code which i am using (Taken from the same forum)
string fullFileName = "C:\Users\ABC\Documents\SolidEdge_Docs\Part1.par";
Aras.IOM.Innovator MyInnovator = new Aras.IOM.Innovator(arasConn);
Aras.IOM.Item ftem = MyInnovator.newItem("File", "add");
ftem.setProperty("filename", fullFileName.Substring(fullFileName.LastIndexOf(System.IO.Path.DirectorySeparatorChar)));
ftem.attachPhysicalFile(fullFileName);
Aras.IOM.Item checkin_result = ftem.apply();
if (checkin_result.isError())
{
rc = false;
throw new Exception(string.Format("Failed to check-in file '{0}': {1}", fullFileName, getErrorDescription(checkin_result)));
}
Any Suggestions would be helpful.
Regards
Santosh
edmoreirabr - Thursday, December 4, 2014 4:51 AM:
Santosh,
Here a small sample that works:
Item fileObj = inn.newItem("File", "add");
fileObj.setProperty("filename", "filename.txt");
fileObj.attachPhysicalFile("c://temp//filename.txt");
fileObj = fileObj.apply();
Please, let me know if works.
Regards,
santoshr0114 - Thursday, December 4, 2014 6:13 AM:
Hi Edson,
Thank you for your response.
I was able to correct the code based on your code. There was an extra slash(/) in the filename. Now i am able to upload a flat file
How can i upload a CAD model to the ARAS vault?
I am trying to do so using AMLStudio, i am able to add the CAD Document, but unable attach native file and set the type (Part/Assembly...)
Do you have any example in .Net or AML.
Regards,
Santosh
Harsha - Thursday, December 4, 2014 8:14 AM:
Hi,
Just set the added File item's id to CAD's native_file property.
Item CAD = inn.newItem("CAD","add");
CAD.setProperty("item_number","CAD1");
CAD.setProperty("native_file",fileObj.getID()); //get added file ID and set to CAD item
CAD.setProperty("classification","Mechanical/Assembly"); //You need to add the complete classification
CAD= CAD.apply();
santoshr0114 - Thursday, December 4, 2014 9:51 AM:
Hi Harsha,
Thank you... I ll try that out.
Can i add relationship at the same time.
Like as you showed in the above example, adding a native file to the CAD Document.
Can i have more CAD Documents referring to the native file just added, like Assembly and Part structure.
edmoreirabr - Thursday, December 4, 2014 5:32 PM:
Santosh,
The relationships are created setting up 2 properties: source_id and related_id.
Take care because some relationships have their own properties, such sort_order as instance in CAD Part relationship.
You need to put the source/related ids from each parent/child Items and put the relationships properties to setup the sequence.
Edson
santoshr0114 - Thursday, December 4, 2014 9:46 PM:
Hi Edson/Harsha,
Can you provide an example to do this in a single transaction....
santoshr0114 - Sunday, December 7, 2014 3:50 PM:
Hi,
I have started working on ARAS just a week ago. Guide me if i am wrong.
I am trying to build a CAD Structure for Assembly and Part. Below is my code which is currently failing.
Aras.IOM.Item CADItem = MyInnovator.newItem("CAD", "add");
CADItem.setProperty("item_number", "09876543");
CADItem.setProperty("name", System.IO.Path.GetFileNameWithoutExtension(fullFileName));
CADItem.setProperty("authoring_tool", "Solid Edge");
CADItem.setProperty("authoring_tool_version", "ST7");
CADItem.setProperty("description", "A sample file added by .Net");
CADItem.setProperty("native_file", ftem.getID());
CADItem.setProperty("ID", MyInnovator.getNewID());
CADItem.setProperty("classification", "Mechanical/Assembly");
// CADItem.addRelationship(relation);
Aras.IOM.Item checkin_result1 = CADItem.apply();
if (checkin_result1.isError())
{
rc = false;
throw new Exception(string.Format("Failed to Save file '{0}': {1}", fullFileName, getErrorDescription(checkin_result1)));
}
CAD Structure table stores the relationship between the CAD Documents
Aras.IOM.Item docfile = MyInnovator.newItem("CAD Structure", "edit");
docfile.setProperty("source_id", CADItem.getID());
docfile.setPropertyAttribute("source_id", "keyed_name", CADItem.getProperty("keyed_name"));
docfile.getPropertyAttribute("source_id", "type", "Document");
docfile.setProperty("related_id", CADItem_Part.getID());
docfile.setPropertyAttribute("related_id", "keyed_name", CADItem.getProperty("keyed_name"));
docfile.setPropertyAttribute("related_id", "Type", "File");
Aras.IOM.Item checkin_result3 = docfile.apply();
if (checkin_result3 .isError())
{
rc = false;
throw new Exception(string.Format("Failed to Save file '{0}': {1}", fullFileName, getErrorDescription(checkin_result3 )));
}
Any suggestions or sample code will be helpful to get me started.
Harsha - Monday, December 8, 2014 1:20 AM:
Hi,
You have to use 'add' action to create a new item. And I hope what you posted is not your complete code, because I can't see CADItem_Part, ftem and
fullFileName in your code.
A sample:
Item CADItem = MyInnovator.newItem("CAD", "add");
CADItem.setProperty("item_number", "09876543");
CADItem.setProperty("name", System.IO.Path.GetFileNameWithoutExtension(fullFileName));
CADItem.setProperty("authoring_tool", "Solid Edge");
CADItem.setProperty("authoring_tool_version", "ST7");
CADItem.setProperty("description", "A sample file added by .Net");
CADItem.setProperty("native_file", ftem.getID());
CADItem.setProperty("classification", "Mechanical/Assembly");
CADItem = CADItem.apply();
if (CADItem.isError())
{
rc = false;
throw new Exception(string.Format("Failed to Save file '{0}': {1}", fullFileName, getErrorDescription(CADItem)));
}
Item docfile = MyInnovator.newItem("CAD Structure", "add");
docfile.setProperty("source_id", CADItem.getID());
docfile.setProperty("related_id", CADItem_Part.getID()); //-- CADItem_Part must be a CAD item, because the relationship is not a poly item
docfile.setProperty("classification","Structure"); //-- setting dependency
Item checkin_result3 = docfile.apply();
if (checkin_result3 .isError())
{
rc = false;
throw new Exception(string.Format("Failed to Save file '{0}': {1}", fullFileName, getErrorDescription(checkin_result3 )));
}
return this;
santoshr0114 - Monday, December 8, 2014 2:36 AM:
Hi Harsha,
Yes it is not my complete code.
I shall try and let you know....
santoshr0114 - Tuesday, December 9, 2014 5:25 AM:
Hi Harsha/Edson,
Thank you... Its working and it helped me a lot.
This will get me started.....
edmoreirabr - Thursday, December 11, 2014 6:11 PM:
You're welcome. Good lucky with Aras, the best without comparison!