Message 1 of 3
Import stp file

Not applicable
01-24-2018
09:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
this is my request:
- open an STP file in Inventor
- save as .ipt file inside a defined folder
My problem:
- I don't get i how to set the final folder for saving;
- is it possible to make all this in a silent way, because right now doesn't work, maybe via apprencticve server?
Thanks
Paolo
this is my code
// call Inventor application Inventor.Application InvApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") as Inventor.Application; InvApp.SilentOperation = true; // GET STP Addin string stpId = "{90AF7F40-0C01-11D5-8E83-0010B541CD80}"; TranslatorAddIn StpAddin = InvApp.ApplicationAddIns.ItemById[stpId] as TranslatorAddIn; TransientObjects tObjs = InvApp.TransientObjects as TransientObjects; DataMedium file = tObjs.CreateDataMedium(); file.FileName = fileName; TranslationContext context = tObjs.CreateTranslationContext(); context.Type = Inventor.IOMechanismEnum.kDataDropIOMechanism; NameValueMap options = tObjs.CreateNameValueMap(); options.Value["SaveComponentDuringLoad"] = true; options.Value["SaveLocationIndex"] = 0; options.Value["ComponentDestFolder"] = ""; options.Value["ImportSolid"] = true; options.Value["ImportSurface"] = true; options.Value["ImportWire"] = false; options.Value["ImportPoint"] = false; options.Value["CreateSurfIndex"] = 1; options.Value["GroupNameIndex"] = 0; options.Value["GroupName"] = ""; options.Value["CEGroupLevel"] = 0; options.Value["CEPrefixCk"] = false; options.Value["CEPrefixString"] = ""; options.Value["ImportUnit"] = 0; options.Value["CheckDuringLoad"] = false; options.Value["AutoStitchAndPromote"] = true; options.Value["AdvanceHealing"] = false; Object obj; StpAddin.Open(file, context, options, out obj); string iptName = String.Format(@"{0}\{1}.ipt", new_dir, temp_geo_code[j]);