Example #1
0
        private void import_Click(object sender, RoutedEventArgs eve)
        {
            TopSolidHost.Connect();

            var lib_id = TopSolidHost.Pdm.SearchDocumentByUniversalId(PdmObjectId.Empty,
                                                                      "Geislinger", "TopToolLibrary");

            int imp_id = GetImporter("TopSolid'Design");

            if (imp_id >= 0)
            {
                List <string>     log;
                List <DocumentId> bad_ids;

                // Importieren mit den Standardeinstellungen
                var good_ids = TopSolidHost.Documents.Import(imp_id, filenameBox.Text, lib_id, out log, out bad_ids);

                // Mögliche Optionen eines Importers abfragen
                // var importOptions = TopSolidHost.Application.GetImporterOptions(imp_id);

                //var importerOptions = new List<KeyValue>()
                //{
                //    new KeyValue()
                //    {
                //        Key = "ASSEMBLY_DOCUMENT_EXTENSION",
                //        Value = ".TopPrt"
                //    }
                //};

                //try
                //{
                //    TopSolidHost.Pdm.EnsureIsDirty(lib_id);
                //    var good_ids = TopSolidHost.Documents.ImportWithOptions(imp_id,
                //    importerOptions,
                //    filenameBox.Text,
                //    lib_id,
                //    out log,
                //    out bad_ids);
                //    foreach (DocumentId doc in good_ids)
                //    {
                //        TopSolidHost.Documents.Save(doc);
                //        TopSolidHost.Documents.Close(doc, false, true);
                //    }
                //}
            }

            TopSolidHost.Disconnect();
        }
Example #2
0
 private void Window_Unloaded(object sender, RoutedEventArgs e)
 {
     TopSolidCamHost.Disconnect();
     TopSolidHost.Disconnect();
 }
Example #3
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     TopSolidHost.Connect();
     plist = new ObservableCollection <ParameterItem>();
     paramGrid.DataContext = plist;
 }
Example #4
0
 public static void StopTs()
 {
     TopSolidDraftingHost.Disconnect();
     TopSolidDesignHost.Disconnect();
     TopSolidHost.Disconnect();
 }
Example #5
0
 public static void StartTs()
 {
     TopSolidHost.Connect();
     TopSolidDesignHost.Connect();
     TopSolidDraftingHost.Connect();
 }
Example #6
0
 private void versionBox_Loaded(object sender, RoutedEventArgs e)
 {
     TopSolidHost.Connect();
     versionBox.Text = TopSolidHost.Application.Version.ToString();
     TopSolidHost.Disconnect();
 }