コード例 #1
0
 public void OnMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (_oview != null)
     {
         _oview.Update(false);
         _bmouseDown = false;
         _rmouseDown = false;
     }
 }
        private void buttonBrowse_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog fdlg = new OpenFileDialog();

            fdlg.Title            = "C# Inventor Open File Dialog";
            fdlg.InitialDirectory = @"c:\program files\autodesk\inventor 2013\samples\models\";
            fdlg.Filter           = "Inventor files (*.ipt; *.iam; *.idw)|*.ipt;*.iam;*.idw";
            fdlg.FilterIndex      = 2;
            fdlg.RestoreDirectory = true;
            if (fdlg.ShowDialog() == DialogResult.OK)
            {
                // get the file name
                textBoxFileName.Text = fdlg.FileName;
                m_odocument          = m_oserver.Open(textBoxFileName.Text);

                // if drawing document, get the first sheet and from it the client views collection, then create a client view
                if (m_odocument.DocumentType == DocumentTypeEnum.kDrawingDocumentObject)
                {
                    m_odrawingDocument = (Inventor.ApprenticeServerDrawingDocument)m_odocument;

                    m_oview = m_odrawingDocument.Sheets[1].ClientViews.Add(pictureBox1.Handle.ToInt32());

                    m_ocamera             = m_oview.Camera;
                    m_ocamera.Perspective = false;
                }
                // if part or assembly get the client views collection from the document, then create a client view
                else
                {
                    m_oview = m_odocument.ClientViews.Add(pictureBox1.Handle.ToInt32());

                    m_ocamera = m_oview.Camera;
                    m_ocamera.ViewOrientationType = ViewOrientationTypeEnum.kIsoTopRightViewOrientation;
                }

                m_ocamera.Fit();
                m_ocamera.Apply();

                m_oview.Update(false);

                // using the control to display the file
                axInventorView1.FileName = fdlg.FileName;
            }
        }
コード例 #3
0
        public void OnSizeChanged(object sender, EventArgs e)
        {
            _oview = _odocument.ClientViews[1];
            if (_oserver != null && _oview != null)
            {
                _oview.Update(true);
                _ocamera = _oview.Camera;
                if (_previousPoint != null)
                {
                }
                //Point2d opoint = _oserver.TransientGeometry.CreatePoint2d(e.X, e.Y);
                //_ocamera.ComputeWithMouseInput(_previousPoint, _previousPoint, 0, ViewOperationTypeEnum.kRotateViewOperation);
                _ocamera.Fit();
                _ocamera.Apply();
                _oview.Update(false);

                /*_ocamera = _oview.Camera;
                 * _ocamera.Apply();
                 * _oview.Update(true);*/
            }
        }