Пример #1
0
 private void OnConfigurationActivated(IXDocument3D doc, IXConfiguration newConf)
 {
     if (doc == m_App.Documents.Active)
     {
         InvokeTrigger(Triggers_e.ConfigurationSheetChange, doc);
     }
 }
Пример #2
0
        public bool TryGet(string name, out IXConfiguration ent)
        {
            var conf = m_Doc.Model.GetConfigurationByName(name);

            if (conf != null)
            {
                ent = SwObject.FromDispatch <SwConfiguration>((IConfiguration)conf, m_Doc);
                return(true);
            }
            else
            {
                ent = null;
                return(false);
            }
        }
Пример #3
0
            internal ScopedDocument(IDocumentAdapter docAdapter, IXDrawing drw, IXLogger logger, bool useRefDoc)
            {
                m_DocAdapter = docAdapter;

                m_CloseDrawing  = false;
                m_CloseDocument = false;

                m_Logger = logger;

                m_Drawing = (IXDrawing)m_DocAdapter.GetDocumentReplacement(drw, true);

                if (drw != m_Drawing)
                {
                    m_CloseDrawing = !m_Drawing.IsCommitted;
                }

                if (!m_Drawing.IsCommitted)
                {
                    m_Drawing.Commit();
                }

                if (useRefDoc)
                {
                    var view = m_Drawing.Sheets.Active.DrawingViews.FirstOrDefault();

                    if (view == null)
                    {
                        throw new UserException("No drawing views in this document");
                    }

                    var refDoc = view.ReferencedDocument;

                    if (refDoc == null)
                    {
                        throw new UserException("View does not have a document");
                    }

                    var conf = view.ReferencedConfiguration;

                    var replDoc = (IXDocument3D)m_DocAdapter.GetDocumentReplacement(refDoc, true);

                    if (refDoc != replDoc)
                    {
                        refDoc = replDoc;
                    }

                    m_CloseDocument = m_CloseDrawing || !refDoc.IsCommitted;

                    if (!refDoc.IsCommitted)
                    {
                        refDoc.Commit();
                    }

                    if (!conf.IsCommitted)
                    {
                        conf = refDoc.Configurations[conf.Name];
                    }

                    Document      = refDoc;
                    Configuration = conf;
                }
                else
                {
                    Document = m_Drawing;
                }
            }