Beispiel #1
0
        public InventorRelease()

        {
            InitializeComponent();
            btnOK.Enabled = false;
            VDF.Vault.Forms.Settings.SelectEntitySettings.EntityFilter initialFilter = new VDF.Vault.Forms.Settings.SelectEntitySettings.EntityRegularExpressionFilter("Assembly Files (*.iam)", ".+iam", VDF.Vault.Currency.Entities.EntityClassIds.Files);
            m_filterCanDisplayEntity = initialFilter.CanDisplayEntity;
            apprentice = new InventorApprentice.ApprenticeServerComponent();
            LoginToVault();
            LoginToEPDM();
            fileName_multiPartTextBox.EditMode = VDF.Forms.Controls.MultiPartTextBoxControl.EditModeOption.ReadOnly;
            initalizeGrid();
        }
Beispiel #2
0
        /*protected override void WndProc(ref Message m)
         * {
         *  const int wM_NCLBUTTONDOWN = 161;
         *  const int wM_SYSCOMMAND = 274;
         *  const int HTCAPTION = 2;
         *  const int SC_MOVE = 61456;
         *  if ((m.Msg == wM_SYSCOMMAND) && (m.WParam.ToInt32() == SC_MOVE))
         *  {
         *      return;
         *  }
         *
         *  if ((m.Msg == wM_NCLBUTTONDOWN) && (m.WParam.ToInt32() == HTCAPTION))
         *  {
         *      return;
         *  }
         *
         *  base.WndProc(ref m);
         * }*/

        public Form1()
        {
            try
            {
                InitializeComponent();
                m_oserver = new InventorApprentice.ApprenticeServerComponent();
                movrot    = new MoveAndRotate_1.InventorCamera();
                movrot.GetCurrentCamera();
                // AddInventorPath();
                try
                {
                    _invApp = (Inventor.Application)Marshal.GetActiveObject("Inventor.Application");
                    _invApp.UserInterfaceManager.RibbonDockingState = RibbonDockingStateEnum.kDockToLeft;
                    //oPartDoc = (PartDocument)_invApp.Documents.Add(Inventor.DocumentTypeEnum.kPartDocumentObject, _invApp.FileManager.GetTemplateFile(Inventor.DocumentTypeEnum.kPartDocumentObject));
                    PartDocument            oPartDoc = (PartDocument)_invApp.ActiveDocument;
                    PartComponentDefinition oCompDef = default(PartComponentDefinition);
                    oCompDef = oPartDoc.ComponentDefinition;
                    foreach (Inventor.PartFeature oFeat in oCompDef.Features)
                    {
                        oFeat.Delete();
                    }
                    movrot = new MoveAndRotate_1.InventorCamera();
                    movrot.GetCurrentCamera();
                }
                catch (Exception ex)
                {
                    try
                    {
                        Type invAppType = Type.GetTypeFromProgID("Inventor.Application");
                        _invApp         = (Inventor.Application)Activator.CreateInstance(invAppType);
                        _invApp.Visible = true;
                        _started        = true;
                        movrot          = new MoveAndRotate_1.InventorCamera();
                        movrot.GetCurrentCamera();
                    }
                    catch (Exception ex2)
                    {
                        MessageBox.Show("Wait, reopen your application", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        _invApp.UserInterfaceManager.RibbonDockingState = RibbonDockingStateEnum.kDockToLeft;
                    }
                }
            }
            catch
            {
                MessageBox.Show(this,
                                "Failed to create an instance of Apprentice server.",
                                "CSharpFileDisplaySample",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }