public virtual void ReadFromXMLNode(XmlNode node)
            {
                try
                {
                    // Deal with model path, must be only one
                    LoadModelPathNode(node);

                    // Deal with the start position
                    XmlNode startPositionNode = node.SelectSingleNode(ModelXMLDefinition.StartPosition);
                    if (startPositionNode != null)
                    {
                        m_ptStartPoint = CPoint3DSerializer.ReadPoint(startPositionNode);
                    }

                    // Read the scaleDirection
                    XmlNode scaleDirectionNode = node.SelectSingleNode(ModelXMLDefinition.SacleDirection);
                    CPoint3D scaleDirection = CPoint3DSerializer.ReadPoint(scaleDirectionNode);

                    Vector3D vec = new Vector3D(scaleDirection.X, scaleDirection.Y, scaleDirection.Z);
                    if (vec.LengthSquared != 0)
                    {
                        vec.Normalize();
                        m_scaleDirection = vec;
                    }
                }
                catch (SystemException ex)
                {
                    string errMsg = ex.Message + "\n" + ex.StackTrace;
                    vtk.vtkOutputWindow.GetInstance().DisplayErrorText(errMsg);
                    throw;
                }
            }
Example #2
0
        public static IHdPolyline3D DrawRect(IHeadsDocument doc, CPoint3D ptBottomLeft, CPoint3D ptTopRight)
        {
            CPoint3D ptTopLeft = new CPoint3D();

            ptTopLeft.X = ptBottomLeft.X;
            ptTopLeft.Y = ptTopRight.Y;
            ptTopLeft.Z = ptTopRight.Z;

            CPoint3D ptBottomRight = new CPoint3D();

            ptBottomRight.X = ptTopRight.X;
            ptBottomRight.Y = ptBottomLeft.Y;
            ptBottomRight.Z = ptBottomLeft.Z;

            List <CPoint3D> listpt = new List <CPoint3D>();

            listpt.Add(ptBottomLeft);
            listpt.Add(ptTopLeft);
            listpt.Add(ptTopRight);
            listpt.Add(ptBottomRight);
            IHdPolyline3D polyrect = doc.DrawPolyline3D(listpt);

            polyrect.Closed = true;

            return(polyrect);
        }
Example #3
0
        public void AcceptLayout(IHeadsApplication app)
        {
            if (this.LastAppliedLayout != null && this.LastAppliedLayoutID != 0)
            {
                IHdEntity entity = app.ActiveDocument.GetObjectById(this.LastAppliedLayoutID);
                if (entity != null && entity.EntityName == "POLYLINE3D")
                {
                    IHdPolyline3D polyline = (IHdPolyline3D)entity;
                    CPoint3D[]    cords    = polyline.Coordinates;
                    CPoint3D      pt1      = null;
                    CPoint3D      pt2      = null;

                    if (cords.Length > 7)
                    {
                        pt1 = cords[0];
                        pt2 = cords[1];
                        this.LastAppliedLayout.angle = ViewerUtils.GetAngle(pt1, pt2, false);
                        pt1 = cords[5];
                        this.LastAppliedLayout.startX = pt1.X;
                        this.LastAppliedLayout.startY = pt1.Y;

                        StreamWriter sw      = new StreamWriter(Path.Combine(app.AppDataPath, "Layout.fil"), true);
                        string       strTemp = string.Format("{0:f3} {1:f3} {2:f3} {3:f3} {4:f3} {5:f3} {6:f3} {7:f3} {8:f3} {9:f3} "
                                                             , this.LastAppliedLayout.startX
                                                             , this.LastAppliedLayout.startY
                                                             , this.LastAppliedLayout.angle
                                                             , this.LastAppliedLayout.sheetWidth
                                                             , this.LastAppliedLayout.sheetLength
                                                             , this.LastAppliedLayout.layOutScale
                                                             , this.LastAppliedLayout.bottomM
                                                             , this.LastAppliedLayout.rightM
                                                             , this.LastAppliedLayout.topM
                                                             , this.LastAppliedLayout.leftM);
                        sw.WriteLine(strTemp);
                        sw.Close();
                    }
                }

                //this.LastAppliedLayout = null;
                this.LastAppliedLayoutID = 0;
            }
        }
            public virtual void ReadFromXMLNode(XmlNode node)
            {
                try
                {
                    // Read the center pos
                    XmlNode centerNode = node.SelectSingleNode(ModelXMLDefinition.BoundaryCenterPosition);
                    m_ptCenter = new CPoint3D(CPoint3DSerializer.ReadPoint(centerNode).Point);

                    // Read the start pos
                    XmlNode startNode = node.SelectSingleNode(ModelXMLDefinition.BoundaryStartPosition);
                    m_ptStartPoint = new CPoint3D(CPoint3DSerializer.ReadPoint(startNode).Point);

                    // Read the end pos
                    XmlNode endNode = node.SelectSingleNode(ModelXMLDefinition.BoundaryEndPosition);
                    m_ptEndPoint = new CPoint3D(CPoint3DSerializer.ReadPoint(endNode).Point);

                    // Read the end pos
                    XmlNode colorNode = node.SelectSingleNode(ModelXMLDefinition.BoundaryColor);
                    m_Color = CPoint3DSerializer.ReadPoint(colorNode).Point;

                    // Read the end pos
                    XmlNode lineWidth = node.SelectSingleNode(ModelXMLDefinition.BoundaryLineWidth);
                    m_dLineWidth = float.Parse(lineWidth.InnerText);

                    // Read the show in multiple views option
                    try
                    {
                        XmlAttribute attrib = node.Attributes[ModelXMLDefinition.showInMultipleViews];
                        m_bShowInMultipleView = (int.Parse(attrib.Value) != 0);
                    }
                    catch (Exception)
                    {
                        // Don't catch write the message out since I use this way to deal with none showInMultipleViews attribute.
                    }
                }
                catch (SystemException ex)
                {
                    string errMsg = ex.Message + "\n" + ex.StackTrace;
                    vtk.vtkOutputWindow.GetInstance().DisplayErrorText(errMsg);
                    throw;
                }
            }
Example #5
0
        private void ShowDetails(bool bShow)
        {
            string strHipLabel = HeadsUtils.Constants.LABEL_DETAILS + ":HIP";

            ViewerUtils.DeleteEntitiesByLabel(this.m_app.ActiveDocument, strHipLabel, true);
            if (bShow)
            {
                double dTextHeight = 5.0;
                double dZVal       = 5.0;
                double dYPos       = 0;
                double dXPos       = 0;
                for (int iCnt = 0; iCnt < this.dtParams.Rows.Count; iCnt++)
                {
                    CHHipData hipdata = this.GetRow(iCnt);

                    dYPos = hipdata.yvalue - (dTextHeight * 1.5);
                    dXPos = hipdata.xvalue + 2.5;

                    string   strLine = "IP# " + iCnt.ToString();
                    CPoint3D pt      = new CPoint3D(dXPos, dYPos, dZVal);
                    IHdText  textObj = this.m_app.ActiveDocument.DrawText(pt, strLine, dTextHeight);
                    textObj.Label = strHipLabel;

                    dYPos = dYPos - (dTextHeight * 1.5);

                    strLine       = "X : " + hipdata.xvalue.ToString("0.000");
                    pt            = new CPoint3D(dXPos, dYPos, dZVal);
                    textObj       = this.m_app.ActiveDocument.DrawText(pt, strLine, dTextHeight);
                    textObj.Label = strHipLabel;

                    dYPos = dYPos - (dTextHeight * 1.5);

                    strLine       = "Y : " + hipdata.yvalue.ToString("0.000");
                    pt            = new CPoint3D(dXPos, dYPos, dZVal);
                    textObj       = this.m_app.ActiveDocument.DrawText(pt, strLine, dTextHeight);
                    textObj.Label = strHipLabel;
                }
            }

            this.m_app.ActiveDocument.RefreshDocument();
        }
Example #6
0
        private int AddPolyLineLayout(IHeadsApplication app, double x1, double y1, double x2, double y2, double x11, double y11, double x22, double y22)
        {
            IHdPolyline3D pLine;
            double        z1 = 0.0;

            List <CPoint3D> listPts = new List <CPoint3D>();

            listPts.Add(new CPoint3D(x1, y1, z1));
            listPts.Add(new CPoint3D(x2, y2, z1));
            pLine = app.ActiveDocument.DrawPolyline3D(listPts);

            pLine.RemoveVertex(1);

            CPoint3D pt = new CPoint3D(x2, y1, z1);

            pLine.AppendVertex(pt);

            pt = new CPoint3D(x2, y2, z1);
            pLine.AppendVertex(pt);
            pt = new CPoint3D(x1, y2, z1);
            pLine.AppendVertex(pt);
            pt = new CPoint3D(x1, y1, z1);
            pLine.AppendVertex(pt);
            pt = new CPoint3D(x11, y11, z1);
            pLine.AppendVertex(pt);
            pt = new CPoint3D(x22, y11, z1);
            pLine.AppendVertex(pt);
            pt = new CPoint3D(x22, y22, z1);
            pLine.AppendVertex(pt);
            pt = new CPoint3D(x11, y22, z1);
            pLine.AppendVertex(pt);
            pt = new CPoint3D(x11, y11, z1);
            pLine.AppendVertex(pt);

            return(pLine.ObjectID);
        }
Example #7
0
        void ShowItemEntities(List <CLabtype> entities, string strModelName, string stgLabel)
        {
            int           NumPts   = 0;
            CPoint3D      ptStart  = new CPoint3D();
            CPoint3D      ptEnd    = new CPoint3D();
            CPoint3D      ptLast   = new CPoint3D();
            CTXTtype      txt      = new CTXTtype();
            CLinetype     uline    = new CLinetype();
            IHdPolyline3D polyline = null;
            string        str1     = "";

            IHdPoint aPoint = null;
            CPTStype pts    = new CPTStype();

            this.App.ActiveDocument.ConfigParam.XMetric = 1.0;
            this.App.ActiveDocument.ConfigParam.YMetric = 1.0;

            CCfgtype cfg = this.App.ActiveDocument.ConfigParam;

            eHEADS_COLOR entitycolor = (stgLabel.StartsWith("member")) ? FormLoadDeflection.MemberColor : FormLoadDeflection.LoadColor;

            double dTextHeight = (this.App.ActiveDocument.ActiveTextHeight > 0) ? this.App.ActiveDocument.ActiveTextHeight : 1.0;

            for (int iIndex = 0; iIndex < entities.Count; iIndex++)
            {
                CLabtype labtype = entities[iIndex];

                if (labtype.attr == CLabtype.Type.Point)
                {
                    pts = (CPTStype)labtype.Tag;

                    ptEnd = new CPoint3D(pts.mx * cfg.XMetric, pts.my * cfg.YMetric, pts.mz);
                    NumPts++;

                    ptStart = ptLast;
                    ptLast  = ptEnd;

                    uline.StartPoint = new CPoint3D(ptStart);
                    uline.EndPoint   = new CPoint3D(ptEnd);

                    str1 = stgLabel;

                    if (NumPts == 1)
                    {
                        aPoint = this.App.ActiveDocument.DrawPoint(ptEnd);

                        aPoint.color = entitycolor;
                    }
                    else if (NumPts == 2)
                    {
                        uline.Layer  = this.App.ActiveDocument.GetActiveLayer().Name;
                        uline.elatt  = 1;
                        uline.laatt  = 1;
                        uline.Label  = strModelName;
                        uline.Label += ":";
                        uline.Label += stgLabel;
                        uline.scatt  = 1;

                        polyline = DrawingUtil.DrawPolyline3DDx(this.App.ActiveDocument, true, uline);

                        polyline.color = entitycolor;

                        aPoint.Erase();
                    }
                    else if (NumPts > 2)
                    {
                        polyline.AppendVertex(ptEnd);
                    }
                }
                else if (labtype.attr == CLabtype.Type.Text)
                {
                    txt = (CTXTtype)labtype.Tag;

                    ptEnd = new CPoint3D(txt.tx * cfg.XMetric, txt.ty * cfg.YMetric, txt.tz);
                    str1  = txt.tg;
                    IHdText textobj = this.App.ActiveDocument.DrawText(ptEnd, str1, dTextHeight);
                    textobj.color = entitycolor;
                    aPoint        = this.App.ActiveDocument.DrawPoint(ptEnd);
                    aPoint.color  = entitycolor;
                }
                else if (labtype.attr == CLabtype.Type.EndCode)
                {
                    NumPts = 0;
                }
            }
            this.App.ActiveDocument.RefreshDocument(true);
        }
Example #8
0
 public CPoint3D(CPoint3D point, CCell3D cell)
 {
     this.point = point;
     this.cell  = cell;
 }
Example #9
0
 public CPoint3D()
 {
     this.point = null;
     this.cell  = null;
 }
Example #10
0
 public CPoint3D(CCell3D cell)
 {
     this.point = null;
     this.cell  = cell;
 }
Example #11
0
            private double CalculateCurrentDistance()
            {
                // We always observer a segment's length
                // If its length is greater than the m_dCableLength, then we return true
                CPoint3D ptStartPoint = m_observingSegment.StartPoint;
                if (m_observingSegment.DriveStartPointAtRuntime)
                {
                    ptStartPoint = new CPoint3D(m_currentPipeTransform.TransformDoublePoint(ptStartPoint.Point));
                }

                CPoint3D ptEndPoint = m_observingSegment.EndPoint;
                if (m_observingSegment.DriveEndPointAtRuntime)
                {
                    ptEndPoint = new CPoint3D(m_currentPipeTransform.TransformDoublePoint(ptEndPoint.Point));
                }

                // Get the distance
                double dDeltaX = ptEndPoint.X - ptStartPoint.X;
                double dDeltaY = ptEndPoint.Y - ptStartPoint.Y;
                double dDeltaZ = ptEndPoint.Z - ptStartPoint.Z;

                double dDistance = IApp.theApp.DataModel.ModelingUnitToMeter * Math.Sqrt(dDeltaX * dDeltaX + dDeltaY * dDeltaY + dDeltaZ * dDeltaZ);
                return dDistance;
            }
Example #12
0
            public void ReadFromXMLNode(XmlNode node)
            {
                try
                {
                    // Read the start pos
                    XmlNode startNode = node.SelectSingleNode(ModelXMLDefinition.CableSegmentStartPosition);
                    m_ptStartPoint = new CPoint3D(CPoint3DSerializer.ReadPoint(startNode).Point);
                    m_bStartPointDrivenAtRuntime = bool.Parse(startNode.Attributes[ModelXMLDefinition.CableSegmentPositionDrivenByPipe].Value);

                    // Read the end pos
                    XmlNode endNode = node.SelectSingleNode(ModelXMLDefinition.CableSegmentEndPosition);
                    m_ptEndPoint = new CPoint3D(CPoint3DSerializer.ReadPoint(endNode).Point);
                    m_bEndPointDrivenAtRuntime = bool.Parse(endNode.Attributes[ModelXMLDefinition.CableSegmentPositionDrivenByPipe].Value);
                }
                catch (SystemException ex)
                {
                    string errMsg = ex.Message + "\n" + ex.StackTrace;
                    vtk.vtkOutputWindow.GetInstance().DisplayErrorText(errMsg);
                    throw;
                }
            }
Example #13
0
            public virtual void UpdateCablePosition(vtk.vtkTransform transform)
            {
                if (m_twoPointsIndicator == null) return;

                bool bShowCabling = ApplicationOptions.Instance().ViewOptions.ShowCablingSystem;
                m_twoPointsIndicator.Impl.Actor.SetVisibility(bShowCabling ? 1 : 0);

                // Drive the cable graphics
                IList<CTwoPoints> pointsList = m_twoPointsIndicator.PointsList;

                // Clear the points
                pointsList.Clear();

                foreach (CCableSegment segment in CableSegments)
                {
                    CPoint3D ptStartPoint = segment.StartPoint;
                    if (segment.DriveStartPointAtRuntime)
                    {
                        ptStartPoint = new CPoint3D(transform.TransformDoublePoint(ptStartPoint.Point));
                    }

                    CPoint3D ptEndPoint = segment.EndPoint;
                    if (segment.DriveEndPointAtRuntime)
                    {
                        ptEndPoint = new CPoint3D(transform.TransformDoublePoint(ptEndPoint.Point));
                    }

                    pointsList.Add(new CTwoPoints(ptStartPoint, ptEndPoint));
                }

                // Update
                m_twoPointsIndicator.Impl.UpatePoints();
            }
Example #14
0
 public static gPoint GetVDPoint(CPoint3D pt)
 {
     return(new gPoint(pt.X, pt.Y, pt.Z));
 }
Example #15
0
        public void ApplyLayout(IHeadsApplication app)
        {
            if (this.LastAppliedLayoutID != 0)
            {
                if (MessageBox.Show("Last applied layout not accepted.\nDo you want to cancel the last applied layout?"
                                    , "Layout", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }

            //this.LastAppliedLayout = null;
            if (this.LastAppliedLayoutID != 0)
            {
                IHdEntity entity = app.ActiveDocument.GetObjectById(this.LastAppliedLayoutID);
                if (entity != null)
                {
                    entity.Erase();
                    app.ActiveDocument.RefreshDocument();
                }
                this.LastAppliedLayoutID = 0;
            }



            Layout.FormLayout formlayout = new Layout.FormLayout();

            if (this.LastAppliedLayout != null)
            {
                formlayout.SelectedLayout = this.LastAppliedLayout;
            }
            if (formlayout.ShowDialog() == DialogResult.OK)
            {
                CPoint3D ptBottomLeft = app.ActiveDocument.GetUserPoint("Select the bottom-left edge to place the sheet");
                if (ptBottomLeft != null)
                {
                    this.LastAppliedLayout = formlayout.SelectedLayout;

                    CCfgtype cfg = app.ActiveDocument.ConfigParam;
                    double   ActualHeight;
                    double   ActualWidth;
                    double   x2, y2, x11, y11, x22, y22;
                    double   x = ptBottomLeft.X;
                    double   y = ptBottomLeft.Y;

                    double Xpos = x * cfg.XMetric;
                    double Ypos = y * cfg.YMetric;
                    ActualHeight = this.LastAppliedLayout.sheetLength * (this.LastAppliedLayout.layOutScale / 1000.00);
                    ActualWidth  = this.LastAppliedLayout.sheetWidth * (this.LastAppliedLayout.layOutScale / 1000.00);
                    x2           = Xpos + ActualWidth;
                    y2           = Ypos + ActualHeight;

                    x11 = Xpos + this.LastAppliedLayout.leftM * (this.LastAppliedLayout.layOutScale / 1000.00);
                    y11 = Ypos + this.LastAppliedLayout.bottomM * (this.LastAppliedLayout.layOutScale / 1000.00);
                    x22 = x2 - this.LastAppliedLayout.rightM * (this.LastAppliedLayout.layOutScale / 1000.00);
                    y22 = y2 - this.LastAppliedLayout.topM * (this.LastAppliedLayout.layOutScale / 1000.00);

                    this.LastAppliedLayoutID = AddPolyLineLayout(app, Xpos, Ypos, x2, y2, x11, y11, x22, y22);

                    app.ActiveDocument.RefreshDocument();
                }
            }
        }
Example #16
0
        private void ExecDrawString(BinaryReader br)
        {
            bool bIsModel = false;
            bool bIsLabel = false;

            CPoint3D ptStart      = new CPoint3D();
            CPoint3D ptEnd        = new CPoint3D();
            CPoint3D ptLast       = new CPoint3D();
            CPoint3D ptFirst3dFac = new CPoint3D();
            string   strSeleModel = GetSelectedModelName();

            CTXTtype        txt          = new CTXTtype();
            CLinetype       uline        = new CLinetype();
            string          strModelName = "";
            int             NumPts       = 0;
            string          str1         = "";
            string          stgLabel     = "";
            IHdPoint        aPoint       = null;
            IHdPolyline3D   polyline     = null;
            CPTStype        pts          = new CPTStype();
            List <CPoint3D> pFArray      = new List <CPoint3D>();

            this.m_app.ActiveDocument.ConfigParam.XMetric = 1.0;
            this.m_app.ActiveDocument.ConfigParam.YMetric = 1.0;

            CCfgtype cfg = this.m_app.ActiveDocument.ConfigParam;

            int iSelectedLineType = this.GetSelectedLineType();

            double dTextHeight = (this.m_app.ActiveDocument.ActiveTextHeight > 0) ? this.m_app.ActiveDocument.ActiveTextHeight : 1.0;


            string strFilePath = m_strpathfilfile;
            //if (File.Exists(strFilePath))
            {
                //BinaryReader br = new BinaryReader(new FileStream(strFilePath, FileMode.Open, FileAccess.Read), Encoding.Default);

                //set the progress bar max value
                SetProgressBarMaxValue(100);

                while (br.BaseStream.Position < br.BaseStream.Length)
                {
                    CLabtype labtype = CLabtype.FromStream(br);

                    if (labtype.attr == CLabtype.Type.Model) // Model Name
                    {
                        NumPts       = 0;
                        strModelName = ((CModType)labtype.Tag).Name;
                        bIsModel     = (strModelName == strSeleModel) ? true : false;
                    }
                    else if (labtype.attr == CLabtype.Type.String)// String Label
                    {
                        stgLabel = ((CStgType)labtype.Tag).label;
                        if (bIsModel)
                        {
                            bIsLabel = this.lbStringLebels_.CheckedItems.Contains(stgLabel);
                        }
                    }
                    else if (labtype.attr == CLabtype.Type.Point)
                    {
                        pts = (CPTStype)labtype.Tag;

                        ptEnd = new CPoint3D(pts.mx * cfg.XMetric, pts.my * cfg.YMetric, pts.mz);
                        NumPts++;

                        ptStart = ptLast;
                        ptLast  = ptEnd;

                        if (bIsModel && bIsLabel)
                        {
                            uline.StartPoint = new CPoint3D(ptStart);
                            uline.EndPoint   = new CPoint3D(ptEnd);

                            str1 = stgLabel;
                            if (str1.ToUpper().StartsWith("P") == true)
                            {
                                if (str1.ToUpper().StartsWith("P0") == true)
                                {
                                    txt.Point = ptEnd;
                                    //double[] res = ptEnd.GetCordArr();

                                    txt.tr = 0.0;

                                    str1 = ptEnd.Z.ToString("0.000");
                                    this.m_app.ActiveDocument.DrawText(new CPoint3D(ptEnd.X, ptEnd.Y, dTextHeight), str1, dTextHeight);

                                    this.m_app.ActiveDocument.DrawLine(new CPoint3D(ptEnd.X - 0.5, ptEnd.Y, ptEnd.Z), new CPoint3D(ptEnd.X + 0.5, ptEnd.Y, ptEnd.Z));
                                    this.m_app.ActiveDocument.DrawLine(new CPoint3D(ptEnd.X, ptEnd.Y - 0.5, ptEnd.Z), new CPoint3D(ptEnd.X, ptEnd.Y + 0.5, ptEnd.Z));
                                }
                                else
                                {
                                    txt.Point = ptEnd;
                                    txt.tr    = 0.0;
                                    double[] res = ptEnd.GetCordArr();

                                    this.m_app.ActiveDocument.DrawText(new CPoint3D(ptEnd.X, ptEnd.Y, dTextHeight), str1, dTextHeight);

                                    this.m_app.ActiveDocument.DrawLine(new CPoint3D(ptEnd.X - 0.5, ptEnd.Y, ptEnd.Z), new CPoint3D(ptEnd.X + 0.5, ptEnd.Y, ptEnd.Z));
                                    this.m_app.ActiveDocument.DrawLine(new CPoint3D(ptEnd.X, ptEnd.Y - 0.5, ptEnd.Z), new CPoint3D(ptEnd.X, ptEnd.Y + 0.5, ptEnd.Z));
                                }
                            }
                            else
                            {
                                if (NumPts == 1)
                                {
                                    aPoint = this.m_app.ActiveDocument.DrawPoint(ptEnd);
                                    if (iSelectedLineType == 4)
                                    {
                                        aPoint.Erase();
                                        ptFirst3dFac = new CPoint3D(ptEnd);
                                        pFArray.Add(ptEnd);
                                    }
                                }
                                else if (NumPts == 2)
                                {
                                    uline.Layer  = this.m_app.ActiveDocument.GetActiveLayer().Name;
                                    uline.elatt  = 1;
                                    uline.laatt  = 1;
                                    uline.Label  = strModelName;
                                    uline.Label += ":";
                                    uline.Label += stgLabel;
                                    uline.scatt  = 1;

                                    if (iSelectedLineType == 1)
                                    {
                                        polyline = DrawingUtil.DrawPolyline3DDx(this.m_app.ActiveDocument, true, uline);
                                    }
                                    else if (iSelectedLineType == 2)
                                    {
                                        polyline = DrawingUtil.DrawPolyline3DDx(this.m_app.ActiveDocument, true, uline);
                                    }
                                    else if (iSelectedLineType == 3)
                                    {
                                        aPoint = this.m_app.ActiveDocument.DrawPoint(ptEnd);
                                    }
                                    else if (iSelectedLineType == 4)
                                    {
                                        pFArray.Add(ptEnd);
                                    }

                                    aPoint.Erase();
                                }
                                else if (NumPts > 2)
                                {
                                    if (iSelectedLineType == 1)
                                    {
                                        polyline.AppendVertex(ptEnd);
                                    }
                                    else if (iSelectedLineType == 2)
                                    {
                                        polyline = DrawingUtil.DrawPolyline3DDx(this.m_app.ActiveDocument, true, uline);
                                    }
                                    else if (iSelectedLineType == 3)
                                    {
                                        aPoint = this.m_app.ActiveDocument.DrawPoint(ptEnd);
                                    }
                                    else if (iSelectedLineType == 4)
                                    {
                                        pFArray.Add(ptEnd);
                                    }
                                }
                            }
                        }
                    }
                    else if (labtype.attr == CLabtype.Type.Text)
                    {
                        txt = (CTXTtype)labtype.Tag;

                        ptEnd = new CPoint3D(txt.tx * cfg.XMetric, txt.ty * cfg.YMetric, txt.tz);
                        if (bIsLabel && bIsModel)
                        {
                            str1 = txt.tg;
                            //Display an Elevation
                            //TO DO:
                            this.m_app.ActiveDocument.DrawText(ptEnd, str1, dTextHeight);
                            aPoint = this.m_app.ActiveDocument.DrawPoint(ptEnd);
                        }
                    }
                    else if (labtype.attr == CLabtype.Type.EndCode)
                    {
                        if ((iSelectedLineType == 4) && (bIsLabel && bIsModel))
                        {
                            if ((System.Math.Abs(ptEnd.X - ptFirst3dFac.X) > 0.00001) || (System.Math.Abs(ptEnd.Y - ptFirst3dFac.Y) > 0.00001))
                            {
                                if (NumPts < 4)
                                {
                                    pFArray.Add(ptFirst3dFac);   //close the face
                                }
                            }

                            if (pFArray.Count > 3)
                            {
                                IHd3DFace face3d = this.m_app.ActiveDocument.Draw3DFace(pFArray[0], pFArray[1], pFArray[2], pFArray[3]);
                                face3d.Update();
                            }
                            pFArray.Clear();
                        }
                        NumPts = 0;
                    }
                    int iCurProgressInPercent = (int)(((double)br.BaseStream.Position / (double)br.BaseStream.Length) * 100.00);

                    SetProgressBarValue(iCurProgressInPercent);
                    Thread.Sleep(0);
                }
                //br.Close();
            }
        }