Beispiel #1
0
 public void CopyProperties()
 {
     try
     {
         parentDoc = (IModelDoc2)swApp.IActiveDoc;
         var parentItem = ExternalFileReferences.Get(swApp);
         childDoc = swApp.OpenDoc6(parentItem.ModelPathName, (int)swDocumentTypes_e.swDocPART,
                                   (int)swOpenDocOptions_e.swOpenDocOptions_Silent, "", 0, 0);
         swApp.ActivateDoc(parentDoc.GetTitle());
         parentDoc.SelectByName(0, parentItem.ModelPathName);
         parentItem = ExternalFileReferences.Get(swApp);
         PartProperties.AddAll(swApp, (ModelDoc2)parentDoc, PartProperties.GetAll(swApp, childDoc, ExternalFileReferences.Get(swApp).ConfigName));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
            public void CopyProperties()
            {
                try
                {
                    parentDoc = (IModelDoc2)swApp.IActiveDoc;
                    var parentItem = ExternalFileReferences.Get(swApp);

                    childDoc = swApp.OpenDoc6(parentItem.ModelPathName, (int)swDocumentTypes_e.swDocPART,
                                              (int)swOpenDocOptions_e.swOpenDocOptions_Silent, "", 0, 0);
                    swApp.ActivateDoc(parentDoc.GetTitle());
                    var props = PartProperties.GetAll(swApp, childDoc, ExternalFileReferences.Get(swApp).ConfigName);
                    //foreach (var item in props)
                    //{
                    //    MessageBox.Show(item.Key + " - " + item.Value, "Свойство заготовки");
                    //}
                    PartProperties.AddAll(swApp, (ModelDoc2)parentDoc, props);
                }
                catch (Exception)
                {
                    throw;
                }
            }