Import stp file

Import stp file

Anonymous
Not applicable
646 Views
2 Replies
Message 1 of 3

Import stp file

Anonymous
Not applicable

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]);

 

0 Likes
647 Views
2 Replies
Replies (2)
Message 2 of 3

Mark.Lancaster
Consultant
Consultant

@Anonymous

 

For better results, you should post over in the Inventor Customization forum (when it comes to programming questions).   I will have the moderator relocate your posting to better suit your needs.

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

0 Likes
Message 3 of 3

Anonymous
Not applicable

Thanks, I didn't notice I was writing in the wrong forum.

P

0 Likes