<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.aras.com/community/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>File Check Out After Creation CAD</title><link>https://www.aras.com/community/f/development/3152/file-check-out-after-creation-cad</link><description>Hi All,
 I&amp;#39;m trying for checking out attached File(just Viewable File PDF) in CAD to Server Machine using AfterAdd Server Event of CAD ItemType, to push to another app as a record. I fill CAD Data and attached file and save CAD. Then, I get this issue</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: File Check Out After Creation CAD</title><link>https://www.aras.com/community/thread/200?ContentTypeID=1</link><pubDate>Fri, 03 Mar 2017 06:33:45 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:4875a814-fbb9-411d-8a3c-975c3f79b30c</guid><dc:creator>Former Member</dc:creator><description>Hello Jillian,
              Yes , Thank you so much.

Sincerely
Thiha Swe
Myanmar&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Check Out After Creation CAD</title><link>https://www.aras.com/community/thread/192?ContentTypeID=1</link><pubDate>Thu, 02 Mar 2017 14:12:33 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:14301595-a2ab-49ac-9dfb-e26d57c373f8</guid><dc:creator>Jillian Jakubowicz</dc:creator><description>Hi Thiha,

I agree with Dennis that the best approach is to use the conversion server since the file is not immediately available in the onAfterAdd event of an item. You can use the conversion server to create a custom conversion task to transfer the file, which would allow you to configure a slight delay.

Jillian

&lt;hr /&gt;

Jillian Jakubowicz

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Check Out After Creation CAD</title><link>https://www.aras.com/community/thread/160?ContentTypeID=1</link><pubDate>Mon, 27 Feb 2017 04:49:27 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:78c74a41-5490-4ccd-8571-2bf3725bb02c</guid><dc:creator>Former Member</dc:creator><description>Hello Jillian,

             Yes, Aras Innovator version is 11SP2.





Thanks
Thiha Swe
Myanmar&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Check Out After Creation CAD</title><link>https://www.aras.com/community/thread/159?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2017 09:26:47 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:86ca1b15-6442-45a8-b954-df46b016953f</guid><dc:creator>Jillian Jakubowicz</dc:creator><description>Hi Thiha,

Thank you for the additional information on your use case. Could you confirm what version of Aras Innovator you are using?

Jillian

&lt;hr /&gt;

Jillian Jakubowicz

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Check Out After Creation CAD</title><link>https://www.aras.com/community/thread/155?ContentTypeID=1</link><pubDate>Tue, 21 Feb 2017 04:12:38 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:d323b3f9-e95b-4a21-b010-730f617ae313</guid><dc:creator>Former Member</dc:creator><description>Hello Jilian,

Firstly I&amp;#39;d like to thank you for you reply.Actually by my side, I don&amp;#39;t need to convert to PDF. PDF files are already generated and attached as Viewable files of CAD. As soon as CAD with attached file has been saved in Aras, I&amp;#39;d like to grab these data (like itemNumber,Generation...) and check out Viewable file(Already Attached) and upload to ERP. So I developed and attached method on Server Event &amp;#39;OnAfterAdd&amp;#39; of CAD Item Type, the method is to grab data, check out physical file on SAME SERVER not in the CLIENT and push that data ,upload or transfer the file from the SERVER to ANOTHER SERVER (ERP). But at this time,to check out the physical File, that does not exit in the vault. Summary, I understand, physical files do not go in the Vault immediately. The main requirement is to check out on same server the file On Creation CAD Data. Please any suggestion?
Sample Codes are below

&lt;pre&gt;&lt;code&gt;

System.Diagnostics.Debugger.Break();
Innovator EngineeringInnovator = this.getInnovator();
string itemId = this.getID();
Innovator ERPInnovator = GetERPInnovatorServerConnection(EngineeringInnovator);
Item engineeringCAD = EngineeringInnovator.applySQL(“select * From innovator.CAD where id =&amp;#039;” + itemId + “‘”);
string itemNumber = engineeringCAD.getProperty(“item_number”);
string itemID = engineeringCAD.getID();
CreateCAD(EngineeringInnovator,ERPInnovator,engineeringCAD);

return this;
}

public static Innovator GetERPInnovatorServerConnection(Innovator engineeringInnovator)
{
HttpServerConnection myConnection;
Innovator myNewInnovator;
string newServerURL = “”;
string newServerDBName = “”;
Item urlVar = engineeringInnovator.newItem(“VARIABLE”, “get”);
urlVar.setProperty(“name”, “NewServerURL”);
urlVar = urlVar.apply();
newServerURL = urlVar.getProperty(“value”);
Item dbVar = engineeringInnovator.newItem(“VARIABLE”, “get”);
dbVar.setProperty(“name”, “NewServerDBName”);
dbVar = dbVar.apply();
newServerDBName = dbVar.getProperty(“value”);
/*End Get Data From Variable*/
string webURL = newServerURL;
string dbName = newServerDBName;
string userName = “admin”;
string passWord = “innovator”;
myConnection = IomFactory.CreateHttpServerConnection(webURL, dbName, userName, passWord);
Item login_result = myConnection.Login();
if (login_result.isError())
{
throw (new Exception(“login failed”));
}
myNewInnovator = IomFactory.CreateInnovator(myConnection);
return myNewInnovator;
}

public static void CreateCAD(Innovator engineeringInnovator,Innovator ERPInnovator,Item engineeringCAD)
{
/*__ Get New Server Connection __*/
string filePath = “”;
Item currentCAD = engineeringCAD;
Item itemResult = ERPInnovator.newItem();
if(currentCAD.getItemCount()&amp;gt;0)
{
string[] CADArray = GetCADFields();
for(int c=0; c&amp;lt;currentCAD.getItemCount();c++)
{
string nativeFile = currentCAD.getItemByIndex(0).getProperty(“native_file”);
string viewable = currentCAD.getItemByIndex(0).getProperty(“viewable_file”);
filePath = FileDownloadAndUpload(engineeringInnovator,””,nativeFile,viewable);

Item addCAD = ERPInnovator.newItem(“CAD”,”add”);
if(filePath.Length&amp;gt;0)
{
addCAD.setFileProperty(“viewable_file”,filePath);
}
for(int k = 0; k&amp;lt;CADArray.Count();k++)
{
string CADcolumnName = CADArray[k];
addCAD.setProperty(CADcolumnName,currentCAD.getItemByIndex(0).getProperty(CADcolumnName));
}
addCAD = addCAD.apply();
}
}
}

public static string FileDownloadAndUpload(Innovator engineerInnovator, string cadID,string nativeFile,string viewable)
{
Innovator ERPInnovator = GetERPInnovatorServerConnection(engineerInnovator);
string workingDirectory = getLocalWorkFolder(engineerInnovator,”admin”);
/* Viewable File */
Item viewableItem = engineerInnovator.newItem(“File”,”get”);
viewableItem.setProperty(“id”,viewable);
if(viewable.Length&amp;gt;0)
viewableItem = viewableItem.apply();
string viewablefileName = viewableItem.getProperty(“filename”);
string viewableFilePath = CheckOutFile(engineerInnovator,viewable,workingDirectory,viewablefileName);

/*End Viewable File*/
return viewableFilePath;
}

public static string getLocalWorkFolder(Innovator engineerInnovator,string username)
{
string FolderPath = default(string);
Item Item_results = default(Item);
Item qryitem = engineerInnovator.newItem(“user”, “get”);
qryitem.setProperty(“login_name”, username);
Item_results = qryitem.apply();
try
{
FolderPath = (string)(Item_results.getItemsByXPath(“//Result/Item”).getProperty(“working_directory”));
if (FolderPath.Length&amp;lt;3)
{
FolderPath = FolderPath + “\\”;
}
}
catch (Exception)
{
FolderPath = “”;
}

return FolderPath;
}

public static string CheckOutFile(Innovator engineerInnovator,string fileID,string checkOutDirector,string fileName)
{
checkOutDirector = HttpContext.Current.Server.MapPath(“Data”);
string FileDirectory = Path.Combine(checkOutDirector , fileName);
if(File.Exists(FileDirectory))
{
File.Delete(FileDirectory);
}
System.Timers.Timer myTimer= new System.Timers.Timer();
myTimer.Interval = 500000;
myTimer.Start();
myTimer.Enabled = true;
System.Threading.Thread.Sleep(100000);
Item get_file_request = engineerInnovator.newItem();
get_file_request.setType(“File”);
get_file_request.setAction(“get”);
get_file_request.setID(fileID);
Item fileItem = get_file_request.apply();
// Item saveFile = engineerInnovator.newItem(“File”,”add”);
// saveFile.setProperty(“filename”,fileItem.getProperty(“filename”));
// saveFile.attachPhysicalFile(@”C:\TCAD-004.pdf”);
// saveFile = saveFile.apply();
Item checkoutResult = fileItem.checkout(checkOutDirector);

if(checkoutResult.isError())
throw new Exception(string.Format(“Failed to check-out file with ID={0}: {1}”, fileID));
return FileDirectory;
}

private static string[] GetCADFields()
{
string[] CADArray = {“is_current”,”is_released”,”new_version”,”config_id”,”permission_id”,
“release_date”,”effective_date”,”team_id”,”authoring_tool”,
“authoring_tool_version”,”description”,”monolithic_model_file”,
“name”,
/*,”native_file”,*/”shattered_model_file”,/*”thumbnail”,*/
“view_file”,/*”viewable_file”,*/”item_number”,”classification”,
“created_on”,”current_state”,”generation”,”major_rev”,”modified_on”,
“owned_by_id”,”state”,”superseded_date”,”custom_generation”,
“custom_rev”,”drawing_media”,”generated_id”,”initiated_by”,
“initiated_date”,”n_p_id”,”workflow_check”,”updated_by”,”updated_date”,
“released2_date”,”released_by”,”released_date”,”reviewed_by”,
“reviewed_date”,”revision_code”,”revision_desc”,”running_number”,
“selected_part_item”};
return CADArray;

&lt;/code&gt;&lt;/pre&gt;


&amp;nbsp;

Thanks,
Thiha Swe
Myanmar.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Check Out After Creation CAD</title><link>https://www.aras.com/community/thread/150?ContentTypeID=1</link><pubDate>Fri, 17 Feb 2017 09:44:36 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:b88b972b-b93a-4e0a-97a1-4f2097b07e95</guid><dc:creator>Jillian Jakubowicz</dc:creator><description>Hi Thiha,

Could you let us know what version of Aras you are using? Also, are you using the Aras CAD to PDF converter or are you setting the viewable file manually?

Jillian

&lt;hr /&gt;

Jillian Jakubowicz

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Check Out After Creation CAD</title><link>https://www.aras.com/community/thread/142?ContentTypeID=1</link><pubDate>Thu, 09 Feb 2017 00:03:33 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:d639f1db-acbd-4a68-b7f8-c88827fdf3a2</guid><dc:creator>Former Member</dc:creator><description>Hello dlingdinger
Thank you so much for you reply. The client has already been using Aras for engineering side. Now they wanna to use ERP(Inventory Module), so Parts in Engineering will be Stock in Inventory. So when they create the part,cad (with attached files) , we need to bring these data including viewable pdf file in CAD to ERP(Inventory Module) to be stock for Sale,Purchase... like that. The client wants to bring data including file as soon as after Part and CAD create on Engineering. I can&amp;#39;t transfer file.

Thanks,
Thiha Swe
Myanmar.

&amp;nbsp;

Hello Jilian,

Firstly I&amp;#39;d like to thank you for you reply.Actually by my side, I don&amp;#39;t need to convert to PDF. PDF files are already generated and attached as Viewable files of CAD. As soon as CAD with attached file has been saved in Aras, I&amp;#39;d like to grab these data (like itemNumber,Generation...) and check out Viewable file(Already Attached) and upload to ERP. So I developed and attached method on Server Event &amp;#39;OnAfterAdd&amp;#39; of CAD Item Type, the method is to grab data, check out physical file on SAME SERVER not in the CLIENT and push that data ,upload or transfer the file from the SERVER to ANOTHER SERVER (ERP). But at this time,to check out the physical File, that does not exit in the vault. Summary, I understand, physical files do not go in the Vault immediately. The main requirement is to check out on same server the file On Creation CAD Data. Please any suggestion?
Sample Codes are below

&lt;pre&gt;&lt;code&gt;

System.Diagnostics.Debugger.Break();
Innovator EngineeringInnovator = this.getInnovator();
string itemId = this.getID();
Innovator ERPInnovator = GetERPInnovatorServerConnection(EngineeringInnovator);
Item engineeringCAD = EngineeringInnovator.applySQL(“select * From innovator.CAD where id =&amp;#039;” + itemId + “‘”);
string itemNumber = engineeringCAD.getProperty(“item_number”);
string itemID = engineeringCAD.getID();
CreateCAD(EngineeringInnovator,ERPInnovator,engineeringCAD);

return this;
}
public static Innovator GetERPInnovatorServerConnection(Innovator engineeringInnovator)
{
HttpServerConnection myConnection;
Innovator myNewInnovator;
string newServerURL = “”;
string newServerDBName = “”;
Item urlVar = engineeringInnovator.newItem(“VARIABLE”, “get”);
urlVar.setProperty(“name”, “NewServerURL”);
urlVar = urlVar.apply();
newServerURL = urlVar.getProperty(“value”);
Item dbVar = engineeringInnovator.newItem(“VARIABLE”, “get”);
dbVar.setProperty(“name”, “NewServerDBName”);
dbVar = dbVar.apply();
newServerDBName = dbVar.getProperty(“value”);
/*End Get Data From Variable*/
string webURL = newServerURL;
string dbName = newServerDBName;
string userName = “admin”;
string passWord = “innovator”;
myConnection = IomFactory.CreateHttpServerConnection(webURL, dbName, userName, passWord);
Item login_result = myConnection.Login();
if (login_result.isError())
{
throw (new Exception(“login failed”));
}
myNewInnovator = IomFactory.CreateInnovator(myConnection);
return myNewInnovator;
}

public static void CreateCAD(Innovator engineeringInnovator,Innovator ERPInnovator,Item engineeringCAD)
{
/*__ Get New Server Connection __*/
string filePath = “”;
Item currentCAD = engineeringCAD;
Item itemResult = ERPInnovator.newItem();
if(currentCAD.getItemCount()&amp;gt;0)
{
string[] CADArray = GetCADFields();
for(int c=0; c&amp;lt;currentCAD.getItemCount();c++)
{
string nativeFile = currentCAD.getItemByIndex(0).getProperty(“native_file”);
string viewable = currentCAD.getItemByIndex(0).getProperty(“viewable_file”);
filePath = FileDownloadAndUpload(engineeringInnovator,””,nativeFile,viewable);

Item addCAD = ERPInnovator.newItem(“CAD”,”add”);
if(filePath.Length&amp;gt;0)
{
addCAD.setFileProperty(“viewable_file”,filePath);
}
for(int k = 0; k&amp;lt;CADArray.Count();k++)
{
string CADcolumnName = CADArray[k];
addCAD.setProperty(CADcolumnName,currentCAD.getItemByIndex(0).getProperty(CADcolumnName));
}
addCAD = addCAD.apply();
}
}
}

public static string FileDownloadAndUpload(Innovator engineerInnovator, string cadID,string nativeFile,string viewable)
{
Innovator ERPInnovator = GetERPInnovatorServerConnection(engineerInnovator);
string workingDirectory = getLocalWorkFolder(engineerInnovator,”admin”);
/* Viewable File */
Item viewableItem = engineerInnovator.newItem(“File”,”get”);
viewableItem.setProperty(“id”,viewable);
if(viewable.Length&amp;gt;0)
viewableItem = viewableItem.apply();
string viewablefileName = viewableItem.getProperty(“filename”);
string viewableFilePath = CheckOutFile(engineerInnovator,viewable,workingDirectory,viewablefileName);

/*End Viewable File*/
return viewableFilePath;
}

public static string getLocalWorkFolder(Innovator engineerInnovator,string username)
{
string FolderPath = default(string);
Item Item_results = default(Item);
Item qryitem = engineerInnovator.newItem(“user”, “get”);
qryitem.setProperty(“login_name”, username);
Item_results = qryitem.apply();
try
{
FolderPath = (string)(Item_results.getItemsByXPath(“//Result/Item”).getProperty(“working_directory”));
if (FolderPath.Length&amp;lt;3)
{
FolderPath = FolderPath + “\\”;
}
}
catch (Exception)
{
FolderPath = “”;
}

return FolderPath;
}

public static string CheckOutFile(Innovator engineerInnovator,string fileID,string checkOutDirector,string fileName)
{
checkOutDirector = HttpContext.Current.Server.MapPath(“Data”);
string FileDirectory = Path.Combine(checkOutDirector , fileName);
if(File.Exists(FileDirectory))
{
File.Delete(FileDirectory);
}
System.Timers.Timer myTimer= new System.Timers.Timer();
myTimer.Interval = 500000;
myTimer.Start();
myTimer.Enabled = true;
System.Threading.Thread.Sleep(100000);
Item get_file_request = engineerInnovator.newItem();
get_file_request.setType(“File”);
get_file_request.setAction(“get”);
get_file_request.setID(fileID);
Item fileItem = get_file_request.apply();
// Item saveFile = engineerInnovator.newItem(“File”,”add”);
// saveFile.setProperty(“filename”,fileItem.getProperty(“filename”));
// saveFile.attachPhysicalFile(@”C:\TCAD-004.pdf”);
// saveFile = saveFile.apply();
Item checkoutResult = fileItem.checkout(checkOutDirector);

if(checkoutResult.isError())
throw new Exception(string.Format(“Failed to check-out file with ID={0}: {1}”, fileID));
return FileDirectory;
}

private static string[] GetCADFields()
{
string[] CADArray = {“is_current”,”is_released”,”new_version”,”config_id”,”permission_id”,
“release_date”,”effective_date”,”team_id”,”authoring_tool”,
“authoring_tool_version”,”description”,”monolithic_model_file”,
“name”,
/*,”native_file”,*/”shattered_model_file”,/*”thumbnail”,*/
“view_file”,/*”viewable_file”,*/”item_number”,”classification”,
“created_on”,”current_state”,”generation”,”major_rev”,”modified_on”,
“owned_by_id”,”state”,”superseded_date”,”custom_generation”,
“custom_rev”,”drawing_media”,”generated_id”,”initiated_by”,
“initiated_date”,”n_p_id”,”workflow_check”,”updated_by”,”updated_date”,
“released2_date”,”released_by”,”released_date”,”reviewed_by”,
“reviewed_date”,”revision_code”,”revision_desc”,”running_number”,
“selected_part_item”};
return CADArray;
&lt;/code&gt;&lt;/pre&gt;

Thanks,
Thiha Swe
Myanmar.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Check Out After Creation CAD</title><link>https://www.aras.com/community/thread/133?ContentTypeID=1</link><pubDate>Tue, 07 Feb 2017 08:32:05 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:cd302dcc-e6da-4960-b5db-8803568a8f92</guid><dc:creator>Dennis Lindinger</dc:creator><description>What if you hook the afterAdd of the File ItemType? Another approach may be to use the conversion server.

Dennis&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>