예제 #1
0
        private void SetViewDirection(Inventor.Face FaceView)
        {
            Inventor.Camera Camera = mInvApplication.ActiveView.Camera;
            Inventor.Point  Pnt;
            Inventor.View   PlaneView = mInvApplication.ActiveView;
            //  ' Set Eye or Target
            if (FaceView.IsParamReversed)
            {
                Pnt = Camera.Eye.Copy();
                Pnt.TranslateBy(GetMidPointAtFaceNormal(ref FaceView).AsVector());
                Camera.Target = Pnt;
            }
            else
            {
                Pnt = Camera.Target.Copy();
                Pnt.TranslateBy(GetMidPointAtFaceNormal(ref FaceView).AsVector());
                Camera.Eye = Pnt;
            }

            Camera.UpVector = GetLargestEdgeUnitVector(ref FaceView);
            Camera.Fit();
            Camera.Apply();
            PlaneView.SetCurrentAsTop();
            PlaneView.SetCurrentAsHome(true);
            PlaneView.Update();
        }
예제 #2
0
 private void Changeview()
 {
     Inventor.Camera Camera = InvApp.ActiveView.Camera;
     Camera.Fit();
     Camera.Apply();
 }
예제 #3
0
        private void SetDrawingView(Inventor.SurfaceBody mSurfaceBody, ref Inventor.Camera Camera, Inventor.Face TargetFace)
        {
            if (TargetFace != null)
            {
                if (!TargetFace.IsParamReversed)
                {
                    if (TargetFace.Geometry is Inventor.Plane)
                    {
                        //Inventor.Face TargetFace = Face;
                        Inventor.Point      FacePoint      = TargetFace.PointOnFace;
                        Inventor.UnitVector Normal         = GetFaceNormal(ref TargetFace, ref FacePoint);
                        Inventor.UnitVector UplDirection   = mInvApplication.TransientGeometry.CreateUnitVector(0, 1, 0);
                        Inventor.UnitVector Z_PosDirection = mInvApplication.TransientGeometry.CreateUnitVector(0, 0, 1);
                        Inventor.UnitVector Z_NegDirection = mInvApplication.TransientGeometry.CreateUnitVector(0, 0, -1);
                        Inventor.UnitVector X_PosDirection = mInvApplication.TransientGeometry.CreateUnitVector(1, 0, 0);
                        Inventor.UnitVector Y_PosDirection = mInvApplication.TransientGeometry.CreateUnitVector(0, 1, 0);
                        Inventor.UnitVector X_NegDirection = mInvApplication.TransientGeometry.CreateUnitVector(-1, 0, 0);
                        Inventor.UnitVector Y_NegDirection = mInvApplication.TransientGeometry.CreateUnitVector(0, -1, 0);
                        if (Z_PosDirection.IsEqualTo(Normal))
                        {
                            if (GetExtents(mSurfaceBody) == "X")
                            {
                                UplDirection = Y_NegDirection;
                            }
                            else if (GetExtents(mSurfaceBody) == "Y")
                            {
                                UplDirection = X_NegDirection;
                            }
                            else if (GetExtents(mSurfaceBody) == "Z")
                            {
                                UplDirection = GetXDir(ref TargetFace, ref FacePoint);
                            }
                            FacePoint = Camera.Eye.Copy();
                            FacePoint.TranslateBy(GetMidPointAtFaceNormal(ref TargetFace).AsVector());
                            Camera.Target = FacePoint;

                            Camera.UpVector = UplDirection;

                            Camera.Fit();
                            Camera.Apply();
                        }
                        else if (Z_NegDirection.IsEqualTo(Normal))
                        {
                            if (GetExtents(mSurfaceBody) == "X")
                            {
                                UplDirection = Y_PosDirection;
                            }
                            else if (GetExtents(mSurfaceBody) == "Y")
                            {
                                UplDirection = X_PosDirection;
                            }
                            else if (GetExtents(mSurfaceBody) == "Z")
                            {
                                UplDirection = GetXDir(ref TargetFace, ref FacePoint);
                            }

                            FacePoint = Camera.Eye.Copy();
                            FacePoint.TranslateBy(GetMidPointAtFaceNormal(ref TargetFace).AsVector());
                            Camera.Target = FacePoint;

                            Camera.UpVector = UplDirection;

                            Camera.Fit();
                            Camera.Apply();
                        }
                    }
                }
            }
        }