Exemplo n.º 1
0
        public void addDimConstr(SketchPoint p, SketchLine sl, Parameter par = null)
        {
            Vector2d v = ut.normal(sl.StartSketchPoint.Geometry, sl.EndSketchPoint.Geometry), v1 = p.Geometry.VectorTo(sl.StartSketchPoint.Geometry);

            if (v.AngleTo(v1) > Math.PI / 2)
            {
                v.ScaleBy(-1);
            }
            pt = p.Geometry.Copy();
            pt.TranslateBy(v);
            ObjectsEnumerator en = sl.Geometry.IntersectWithCurve(I.tg.CreateLineSegment2d(p.Geometry, pt), 0.1);

            if (en != null && en.Count != 0)
            {
                pt = en[1] as Point2d;
            }
            OffsetDimConstraint offs = ps.DimensionConstraints.AddOffset(sl, p as SketchEntity, ut.midPt(p.Geometry, pt, p.Geometry.DistanceTo(pt) / 5, 0), false);

            if (par != null)
            {
                offs.Parameter.Expression = par.Name;
            }
            else
            {
                offs.Parameter.Value = 0;
            }
        }
Exemplo n.º 2
0
        public void addMidConsraint(SketchLine line)
        {
            pt = line.Geometry.MidPoint;
            SketchPoint s = ps.SketchPoints.Add(pt, false);

            ps.GeometricConstraints.AddMidpoint(s, sl);
        }
Exemplo n.º 3
0
 public InsertOutlineRequest(Inventor.Application application, Face face, iFeature ifeature, Point2d point1, Point2d point2)
 {
     m_inventorApplication = application;
     m_insertFace          = face;
     m_selectiFeature      = ifeature;
     m_Point1 = point1;
     m_Point2 = point2;
 }
        /// <summary>
        /// Generate drawing document with input model document
        /// </summary>
        /// <param name="filePath">File path for the generated drawing document</param>
        /// <param name="doc">The Inventor document.</param>
        private void SaveAsIDW(string filePath, Document doc)
        {
            LogTrace("Create a new drawing document");
            DrawingDocument drawDoc = (DrawingDocument)inventorApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject);

            Inventor.Sheet sheet;

            LogTrace("Get or create a new drawing sheet");
            try
            {
                if (drawDoc.Sheets.Count > 0)
                {
                    sheet      = drawDoc.Sheets[1];
                    sheet.Size = DrawingSheetSizeEnum.kA2DrawingSheetSize;
                }
                else
                {
                    sheet = drawDoc.Sheets.Add(DrawingSheetSizeEnum.kA2DrawingSheetSize);
                }

                TransientGeometry oTG = inventorApplication.TransientGeometry;
                Inventor.Point2d  pt  = oTG.CreatePoint2d(10, 10);

                LogTrace("Create a base view");
                Inventor.DrawingView dv = sheet.DrawingViews.AddBaseView((_Document)doc, pt, 1, ViewOrientationTypeEnum.kIsoTopLeftViewOrientation, DrawingViewStyleEnum.kShadedDrawingViewStyle, "", null, null);
                LogTrace("Change scale of base drawing view");
                dv.Scale = CalculateViewSize(sheet, dv);

                LogTrace("Create projected view");
                Inventor.Point2d     pt2      = oTG.CreatePoint2d(dv.Position.X, dv.Position.Y + dv.Height * 1.2);
                Inventor.DrawingView projView = sheet.DrawingViews.AddProjectedView(dv, pt2, DrawingViewStyleEnum.kShadedDrawingViewStyle);

                Inventor.Point2d pt3 = oTG.CreatePoint2d(sheet.Width - 5, sheet.Height / 3);
                LogTrace("Create part list");
                Inventor.PartsList pl = sheet.PartsLists.Add(dv, pt3, PartsListLevelEnum.kPartsOnly);

                Inventor.Point2d pt4 = oTG.CreatePoint2d(sheet.Width / 2, sheet.Height / 4);
                LogTrace("Create Revision table");
                Inventor.RevisionTable rtable = sheet.RevisionTables.Add(pt4);
                rtable.ShowTitle = true;
                rtable.Title     = "Revision Table Test";
                rtable.RevisionTableRows[1][1].Text = "Inventor IO";
                rtable.RevisionTableRows[1][3].Text = "Test revision table in drawing";
                rtable.RevisionTableRows[1][4].Text = "Autodesk";
                LogTrace("Done:Create Revision table");

                LogTrace($"Saving IDW {filePath}");
                drawDoc.SaveAs(filePath, false);
                drawDoc.Close();
                LogTrace($"Saved IDW as {filePath}");
            }
            catch (Exception e)
            {
                drawDoc.Close();
                LogError($"Generate IDW fails: {e.Message}");
            }
        }
Exemplo n.º 5
0
        public SketchPoint addPoint(SketchLine sl1, SketchLine sl2)
        {
            Vector2d v1 = addVec(sp, sl1), v2 = addVec(sp, sl2);

            pt = sp.Geometry.Copy();
            v1.AddVector(v2);
            v1.ScaleBy(0.4);
            pt.TranslateBy(v1);
            return(ps.SketchPoints.Add(pt));
        }
Exemplo n.º 6
0
 private void mouseClick(MouseButtonEnum Button, ShiftStateEnum ShiftKeys, Inventor.Point ModelPosition, Point2d ViewPosition, Inventor.View View)
 {
     if (Button == MouseButtonEnum.kLeftMouseButton && pt1 == null)
     {
         pt    = ModelPosition;
         pt1   = ViewPosition;
         pt1.X = pt.X;
         pt1.Y = pt.Y;
         interEvts.StatusBarText = "Вторая точка выноски:";
         objs.Add(pt1);
         if (selEvts.SelectedEntities.Count != 0)
         {
             dcs = (Inventor.DrawingCurveSegment)selEvts.SelectedEntities[1];
         }
         dc = dcs.Parent;
     }
     else if (Button == MouseButtonEnum.kLeftMouseButton && pt2 == null)
     {
         try
         {
             pt2   = ViewPosition;
             pt2.X = ModelPosition.X; pt2.Y = ModelPosition.Y;
             objs.Add(pt2);
             interEvts.Stop();
             obj = dc.ModelGeometry;
             try
             {
                 compOcc = ((Inventor.FaceProxy)obj).ContainingOccurrence;
             }
             catch (Exception)
             {
                 try
                 {
                     compOcc = ((Inventor.EdgeProxy)obj).ContainingOccurrence;
                 }
                 catch (Exception ex1)
                 {
                     MessageBox.Show(ex1.ToString());
                 }
             }
             gInt = m_DrwDoc.ActiveSheet.CreateGeometryIntent(dc);
             objs.Add(gInt);
             ball = m_DrwDoc.ActiveSheet.Balloons.Add(objs);
             ball.BalloonValueSets.Add(m_AsmDoc.ComponentDefinition.Occurrences[1]);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
Exemplo n.º 7
0
 private void addSS(string name, Inventor.Point2d insPt)
 {
     try
     {
         foreach (SketchedSymbol ss in m_DrwDoc.ActiveSheet.SketchedSymbols)
         {
             if (ss.Name.StartsWith(name))
             {
                 return;
             }
         }
         m_DrwDoc.ActiveSheet.SketchedSymbols.Add(m_DrwDoc.SketchedSymbolDefinitions[name], insPt);
     }
     catch (Exception)
     {
     }
 }
        private void RotateSketch(PartComponentDefinition oPartCompDef, string name, double x, double y, double angle)
        {
            ObjectCollection oSketchObjects;

            oSketchObjects = m_inventorApplication.TransientObjects.CreateObjectCollection();

            TransientGeometry oTransGeo;

            oTransGeo = m_inventorApplication.TransientGeometry;
            Inventor.Point2d centorPoint = oTransGeo.CreatePoint2d(x, y);
            PlanarSketch     oSketch     = oPartCompDef.Sketches["Footprint" + name];

            foreach (SketchEntity oSketchEntity in oSketch.SketchEntities)
            {
                oSketchObjects.Add(oSketchEntity);
            }
            oSketch.RotateSketchObjects(oSketchObjects, centorPoint, angle, false, true);
        }
 private void mouseClick(MouseButtonEnum Button, ShiftStateEnum ShiftKeys, Inventor.Point ModelPosition, Point2d ViewPosition, Inventor.View View)
 {
     if (Button == MouseButtonEnum.kLeftMouseButton)
     {
         if (pt1 == null)
         {
             //m_View = (DrawingView)View;
             pt    = ModelPosition;
             pt1   = ViewPosition;
             pt1.X = pt.X;
             pt1.Y = pt.Y;
             interEvts.StatusBarText = "Вторая точка разрыва:";
         }
         else
         {
             pt    = ModelPosition;
             pt2   = ViewPosition;
             pt2.X = pt.X;
             pt2.Y = pt.Y;
             interEvts.Stop();
             try
             {
                 if (horizont)
                 {
                     oBreak = m_View.BreakOperations.Add(BreakOrientationEnum.kHorizontalBreakOrientation,
                                                         pt1, pt2, BreakStyleEnum.kRectangularBreakStyle, num, gap, 1, false);
                 }
                 else
                 {
                     oBreak = m_View.BreakOperations.Add(BreakOrientationEnum.kVerticalBreakOrientation,
                                                         pt1, pt2, BreakStyleEnum.kRectangularBreakStyle, num, gap, 1, false);
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString());
                 mouseEvts.OnMouseClick -= new MouseEventsSink_OnMouseClickEventHandler(mouseClick);
             }
         }
     }
 }
Exemplo n.º 10
0
        public SketchLine addPerpendicular(SketchLine line, SketchLine dir, SketchLine sl = null)
        {
            vec = addVec(sp, dir);
            vec.ScaleBy(0.5);
            pt = line.Geometry.MidPoint;
            pt.TranslateBy(vec);
            SketchLine l;

            if (sl == null)
            {
                l = ps.SketchLines.AddByTwoPoints(line.Geometry.MidPoint as object, pt as object);
            }
            else
            {
                l = ps.SketchLines.AddByTwoPoints(line.Geometry.MidPoint, sl.EndSketchPoint);
            }
            l.Construction = true;
            addMidConsraint(line, l);
            ps.GeometricConstraints.AddParallel(l as SketchEntity, dir as SketchEntity);
            return(l);
        }
Exemplo n.º 11
0
        void SelectEvents_OnSelect(
            Inventor.ObjectsEnumerator JustSelectedEntities,
            Inventor.SelectionDeviceEnum SelectionDevice,
            Inventor.Point ModelPosition,
            Inventor.Point2d ViewPosition,
            Inventor.View View)
        {
            if (_state == CommandState.Idle)
            {
                return;
            }

            if (JustSelectedEntities.Count != 1)
            {
                return;
            }

            if (!(JustSelectedEntities[1] is ComponentOccurrence))
            {
                return;
            }

            ComponentOccurrence selectedOccurrence = JustSelectedEntities[1] as ComponentOccurrence;

            switch (_state)
            {
            case CommandState.SourceComponentSelection:

                if (_targetComponent != null)
                {
                    if (selectedOccurrence.Definition == _targetComponent.Definition)
                    {
                        System.Windows.Forms.MessageBox.Show("Source and Target components cannot be the same, or refer to the same document...",
                                                             "Error selecting component",
                                                             System.Windows.Forms.MessageBoxButtons.OK,
                                                             System.Windows.Forms.MessageBoxIcon.Exclamation);

                        break;
                    }
                }

                _state = CommandState.Idle;

                _sourceComponent = selectedOccurrence;

                SourceComponentSelected(this, new EventArgs());

                break;

            case CommandState.TargetComponentSelection:

                if (_sourceComponent != null)
                {
                    if (selectedOccurrence.Definition == _sourceComponent.Definition)
                    {
                        System.Windows.Forms.MessageBox.Show("Source and Target components cannot be the same, or refer to the same document...",
                                                             "Error selecting component",
                                                             System.Windows.Forms.MessageBoxButtons.OK,
                                                             System.Windows.Forms.MessageBoxIcon.Exclamation);

                        break;
                    }
                }

                _state = CommandState.Idle;

                _targetComponent = selectedOccurrence;

                TargetComponentSelected(this, new EventArgs());

                break;

            default:
                _state = CommandState.Idle;
                break;
            }
        }
Exemplo n.º 12
0
 private void OnPreSelect(ref object PreSelectEntity, out bool DoHighlight, ref Inventor.ObjectCollection MorePreSelectEntities, Inventor.SelectionDeviceEnum SelectionDevice, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
 {
     if (PreSelectEntity is SurfaceGraphicsFace)
     {
         DoHighlight = true;
     }
     else
     {
         DoHighlight = false;
     }
 }
Exemplo n.º 13
0
        //do select in screen
        public void DoSelect()
        {
            switch (oSelectOption)
            {
            case SelectOptionsEnum.eApplication:

                if (m_inventorApplication.SoftwareVersion.Major > 13)
                {
                    m_inventorApplication.UserInterfaceManager.DoEvents();
                }
                else
                {
                    System.Windows.Forms.Application.DoEvents();
                }

                break;

            case SelectOptionsEnum.eDocument:

                if (m_inventorApplication.SoftwareVersion.Major > 13)
                {
                    m_inventorApplication.UserInterfaceManager.DoEvents();
                }
                else
                {
                    System.Windows.Forms.Application.DoEvents();
                }

                break;

            case SelectOptionsEnum.eWindow:

                if (selectingWin)
                {
                    selectingWin = false;       // ready for next status

                    //get new corner and size of window
                    InteractionEventsManager oInterEventsM = new InteractionEventsManager(m_inventorApplication);

                    Size             otempSize       = new Size(0, 0);
                    Inventor.Point2d otempInvPoint2d = m_inventorApplication.TransientGeometry.CreatePoint2d(0, 0);

                    oInterEventsM.DoSelectRegion(ref otempSize, ref otempInvPoint2d);

                    //record the size and corner point.
                    if (otempSize.Height == 0 || otempSize.Width == 0)
                    {
                        // the user may escape the selecting without selecting anything
                        // so do nothing
                        return;
                    }
                    oHasSelectWindow             = true;
                    oSelectParam_Win.oCornerPt.X = Convert.ToInt32(otempInvPoint2d.X);
                    oSelectParam_Win.oCornerPt.Y = Convert.ToInt32(otempInvPoint2d.Y);
                    oSelectParam_Win.oSize       = otempSize;
                }
                else
                {
                    //just change selection mode. so update the bitmap directly
                    if (m_inventorApplication.SoftwareVersion.Major > 13)
                    {
                        m_inventorApplication.UserInterfaceManager.DoEvents();
                    }
                    else
                    {
                        System.Windows.Forms.Application.DoEvents();
                    }
                }

                break;
            }

            updateBitmap();
        }
Exemplo n.º 14
0
        private void m_MouseEvents_OnMouseUp(Inventor.MouseButtonEnum Button, Inventor.ShiftStateEnum ShiftKeys, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
        {
            //if the interaction event is MyScreenshot, create the image
            if (m_InteractionEvents.Name == "MyScreenshot")
            {
                m_InteractionEvents.InteractionGraphics.PreviewClientGraphics.Delete();
                m_inventorApplication.ActiveView.Update();

                if (oGiLineStripG != null)
                {
                    oGiLineStripG.Delete();
                    oGiLineStripG = null;
                }

                if (oGiLineG != null)
                {
                    oGiLineG.Delete();
                    oGiLineG = null;
                }

                //stop interaction event
                m_InteractionEvents.SetCursor(CursorTypeEnum.kCursorBuiltInArrow);
                m_flagMouseDown = false;
                if (m_MouseEvents != null)
                {
                    m_MouseEvents.OnMouseDown -= m_MouseEvents_OnMouseDown;
                    m_MouseEvents.OnMouseMove -= m_MouseEvents_OnMouseMove;
                    m_MouseEvents.OnMouseUp   -= m_MouseEvents_OnMouseUp;
                    m_MouseEvents              = null;
                }
                m_InteractionEvents.Stop();
                m_InteractionEvents = null;

                //prepare size of the image region, in pixel

                oSize = new Size(Convert.ToInt32(Math.Abs(ViewPosition.X - m_MouseStartViewPt.X)), Convert.ToInt32(Math.Abs(ViewPosition.Y - m_MouseStartViewPt.Y)));

                if (ViewPosition.X > m_MouseStartViewPt.X & ViewPosition.Y > m_MouseStartViewPt.Y)
                {
                    oCornerPt = m_MouseStartViewPt;
                }
                else if (ViewPosition.X > m_MouseStartViewPt.X & ViewPosition.Y < m_MouseStartViewPt.Y)
                {
                    oCornerPt.X = m_MouseStartViewPt.X;
                    oCornerPt.Y = ViewPosition.Y;
                }
                else if (ViewPosition.X <m_MouseStartViewPt.X& ViewPosition.Y> m_MouseStartViewPt.Y)
                {
                    oCornerPt.X = ViewPosition.X;
                    oCornerPt.Y = m_MouseStartViewPt.Y;
                }
                else
                {
                    oCornerPt = ViewPosition;
                }

                //take the view position in screen, calculate
                //the real pixel data of the corners

                oCornerPt.X = (int)View.Left + oCornerPt.X;
                oCornerPt.Y = (int)View.Top + oCornerPt.Y;
            }
        }
Exemplo n.º 15
0
 private void m_SelectEvents_OnSelect(Inventor.ObjectsEnumerator JustSelectedEntities, Inventor.SelectionDeviceEnum SelectionDevice, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
 {
     if (JustSelectedEntities.Count != 0)
     {
         object selectObj1 = JustSelectedEntities[1];
         //object selectObj2 = JustSelectedEntities[2];
         System.Windows.Forms.MessageBox.Show((string)("Selected Entity Type: " + Information.TypeName(selectObj1)) + " , Interactive selection successful!", "Interactive Selection");
     }
 }
Exemplo n.º 16
0
        private void m_MouseEvents_OnMouseDown(Inventor.MouseButtonEnum Button, Inventor.ShiftStateEnum ShiftKeys, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
        {
            //if the interaction event is MyScreenshot,
            //then get the view position and model position

            if (m_InteractionEvents.Name == "MyScreenshot")
            {
                m_MouseStartViewPt = ViewPosition;
                m_StartModelPt     = ModelPosition;
                m_flagMouseDown    = true;

                //clean the last graphics
                m_InteractionEvents.InteractionGraphics.PreviewClientGraphics.Delete();
                m_inventorApplication.ActiveView.Update();

                //gi node
                oGiNode   = m_InteractionEvents.InteractionGraphics.PreviewClientGraphics.AddNode(1);
                oCoordSet = m_InteractionEvents.InteractionGraphics.GraphicsDataSets.CreateCoordinateSet(1);

                //color set
                oColorSet = m_InteractionEvents.InteractionGraphics.GraphicsDataSets.CreateColorSet(1);
                oColorSet.Add(1, 255, 0, 0);

                TransientGeometry tg    = m_inventorApplication.TransientGeometry;
                Inventor.Point    tempP = tg.CreatePoint(ViewPosition.X, ViewPosition.Y, 0);

                oCoordSet.Add(1, tempP);
                oCoordSet.Add(2, tempP);
                oCoordSet.Add(3, tempP);
                oCoordSet.Add(4, tempP);
                oCoordSet.Add(5, tempP);

                try
                {
                    if (oGiLineStripG != null)
                    {
                        oGiLineStripG.Delete();
                        oGiLineStripG = null;
                    }
                    oGiLineStripG = oGiNode.AddLineStripGraphics();
                    oGiLineStripG.CoordinateSet = oCoordSet;
                    oGiLineStripG.ColorSet      = oColorSet;
                    oGiLineStripG.BurnThrough   = true;
                }
                catch (Exception ex)
                {
                    //a problem in Inventor 2009( R13 ) with
                    //LineStripGraphics.BurnThrough. Use LineGraphics as workaround

                    if (oGiLineG != null)
                    {
                        oGiLineG.Delete();
                        oGiLineG = null;
                    }

                    oGiLineG = oGiNode.AddLineGraphics();
                    oGiLineG.CoordinateSet = oCoordSet;
                    oGiLineG.ColorSet      = oColorSet;
                    oGiLineG.BurnThrough   = true;
                }
            }
        }
Exemplo n.º 17
0
        private void StartEvent(bool region_or_object)
        {
            //start interaction event
            if (m_InteractionEvents == null)
            {
                m_InteractionEvents = m_inventorApplication.CommandManager.CreateInteractionEvents();
            }
            else
            {
                m_InteractionEvents.Stop();
            }

            m_InteractionEvents.InteractionDisabled = false;

            if (region_or_object)
            {
                //get mouse event
                if (m_MouseEvents == null)
                {
                    m_MouseEvents = m_InteractionEvents.MouseEvents;
                    m_MouseEvents.MouseMoveEnabled = true;
                    m_MouseStartViewPt             = m_inventorApplication.TransientGeometry.CreatePoint2d(0, 0);
                    m_flagMouseDown            = false;
                    m_MouseEvents.OnMouseUp   += m_MouseEvents_OnMouseUp;
                    m_MouseEvents.OnMouseMove += m_MouseEvents_OnMouseMove;
                    m_MouseEvents.OnMouseDown += m_MouseEvents_OnMouseDown;
                }
            }
            else
            {
                //get select event
                if (m_SelectEvents == null)
                {
                    m_SelectEvents = m_InteractionEvents.SelectEvents;
                    m_SelectEvents.SingleSelectEnabled = false;
                    m_SelectEvents.WindowSelectEnabled = true;
                    m_SelectEvents.OnSelect           += m_SelectEvents_OnSelect;
                }
            }



            m_InteractionEvents.OnTerminate += m_InteractionEvents_OnTerminate;

            m_InteractionEvents.Name = "MyScreenshot";

            //start
            m_InteractionEvents.Start();

            while (m_InteractionEvents != null)
            {
                if (m_inventorApplication.SoftwareVersion.Major > 13)
                {
                    m_inventorApplication.UserInterfaceManager.DoEvents();
                }
                else
                {
                    System.Windows.Forms.Application.DoEvents();
                }
            }
        }
Exemplo n.º 18
0
 public void DoSelectObject(ref Size bmSize, ref Inventor.Point2d bmCornetPt)
 {
     StartEvent(false);
     bmSize     = oSize;
     bmCornetPt = oCornerPt;
 }
Exemplo n.º 19
0
 public void DoSelectRegion(ref Size bmSize, ref Inventor.Point2d bmCornetPt)
 {
     StartEvent(true);
     bmSize     = oSize;
     bmCornetPt = oCornerPt;
 }
Exemplo n.º 20
0
 private void m_SelectEvents_OnSelect(Inventor.ObjectsEnumerator JustSelectedEntities, Inventor.SelectionDeviceEnum SelectionDevice, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
 {
     //reserved for future
 }
Exemplo n.º 21
0
 private void mSelectEvents_OnSelect(Inventor.ObjectsEnumerator JustSelectedEntities, Inventor.SelectionDeviceEnum SelectionDevice, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
 {
     if (JustSelectedEntities.Count != 0)
     {
         object selectedObj = JustSelectedEntities[1];
         System.Windows.Forms.MessageBox.Show((string)("Selected Entity: " + Information.TypeName(selectedObj)), "Simple Interaction");
     }
 }
Exemplo n.º 22
0
        // version 2010-05-23: to solve the issue in Perspective View
        private void m_MouseEvents_OnMouseMove(Inventor.MouseButtonEnum Button, Inventor.ShiftStateEnum ShiftKeys, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
        {
            //if the interaction event is MyScreenshot, draw selecting rectangle.
            if (m_InteractionEvents.Name == "MyScreenshot" && m_flagMouseDown)
            {
                TransientGeometry tg = m_inventorApplication.TransientGeometry;

                Inventor.Point P1 = tg.CreatePoint(m_MouseStartViewPt.X, -m_MouseStartViewPt.Y, 0);
                Inventor.Point P3 = tg.CreatePoint(ViewPosition.X, -ViewPosition.Y, 0);
                Inventor.Point P4 = tg.CreatePoint(P1.X, P3.Y, 0);
                Inventor.Point P2 = tg.CreatePoint(P3.X, P1.Y, 0);

                //update coordinates

                oCoordSet[1] = P1;
                oCoordSet[2] = P2;
                oCoordSet[3] = P3;
                oCoordSet[4] = P4;
                oCoordSet[5] = P1;

                //add line strip
                if (oGiLineStripG != null)
                {
                    //SetTransformBehavior, default value for PixelScale is 1
                    oGiLineStripG.SetTransformBehavior(P1, DisplayTransformBehaviorEnum.kFrontFacingAndPixelScaling, 1);
                    oGiLineStripG.SetViewSpaceAnchor(P1, m_MouseStartViewPt, ViewLayoutEnum.kTopLeftViewCorner);
                }
                else if (oGiLineG != null)
                {
                    //SetTransformBehavior, default value for PixelScale is 1
                    oGiLineG.SetTransformBehavior(P1, DisplayTransformBehaviorEnum.kFrontFacingAndPixelScaling, 1);
                    oGiLineG.SetViewSpaceAnchor(P1, m_MouseStartViewPt, ViewLayoutEnum.kTopLeftViewCorner);
                }


                m_inventorApplication.ActiveView.Update();
            }
        }