Esempio n. 1
0
            public GeomVue(View vue, Sketch esquisse)
            {
                MathUtility SwMath = App.Sw.GetMathUtility();

                gPoint ptCentreVue = new gPoint(vue.Position);
                gPoint ptMin       = new gPoint(Double.PositiveInfinity, Double.PositiveInfinity, 0);
                gPoint ptMax       = new gPoint(Double.NegativeInfinity, Double.NegativeInfinity, 0);

                foreach (SketchPoint s in esquisse.GetSketchPoints2())
                {
                    MathPoint swStartPoint = SwMath.CreatePoint(new Double[3] {
                        s.X, s.Y, s.Z
                    });
                    MathTransform SketchXform = esquisse.ModelToSketchTransform;
                    SketchXform  = SketchXform.Inverse();
                    swStartPoint = swStartPoint.MultiplyTransform(SketchXform);
                    MathTransform ViewXform = vue.ModelToViewTransform;
                    swStartPoint = swStartPoint.MultiplyTransform(ViewXform);
                    gPoint swViewStartPt = new gPoint(swStartPoint);
                    ptMin.Min(swViewStartPt);
                    ptMax.Max(swViewStartPt);
                }

                ptMinX = ptMin.X;
                ptMinY = ptMin.Y;
                ptMaxX = ptMax.X;
                ptMaxY = ptMax.Y;
                MajCentreRectangle();
                ptCentreVueX = ptCentreVue.X;
                ptCentreVueY = ptCentreVue.Y;
            }
Esempio n. 2
0
        public gPoints GetPoints(int div, double unitFactor)
        {
            gPoints gps = new gPoints();

            div = 10;
            double x, y, xIncr;

            x     = y = xIncr = 0.0d;
            xIncr = Length / div;

            UdlLoad = UdlLoad / unitFactor;
            for (int i = 0; i <= div; i++)
            {
                y = CalculateMomentWithConsLoad(x);
                if (i == 0)
                {
                    y = -(Math.Abs(StartMoment));
                }
                else if (i == div)
                {
                    y = -(Math.Abs(EndMoment));
                }
                gPoint gp = new gPoint(x, y);
                gps.Add(gp);
                x += xIncr;
            }
            return(gps);
        }
Esempio n. 3
0
        private vdBlock CreateBlock(BlockData blkData)
        {
            vdBlock block = vDraw.ActiveDocument.Blocks.FindName(blkData.Name);

            if (block != null)
            {
                //MessageBox.Show("存在同名块: " + blkData.Name + " 跳过!");
                return(null);
            }

            block = vDraw.ActiveDocument.Blocks.Add(blkData.Name);
            if (block == null)
            {
                //MessageBox.Show("添加块: " + blkData.Name + " 失败! 跳过!");
                return(null);
            }

            foreach (MeshData mesh in blkData.Meshs)
            {
                AddMeshToEntities(block.Entities, mesh);
            }

            foreach (InsertData ins in blkData.Inserts)
            {
                AddInsertToEntities(block.Entities, ins);
            }

            if (blkData.IsPipe)
            {
                var ptStart = new gPoint(blkData.PipeInfo.PtStart.X, blkData.PipeInfo.PtStart.Y, blkData.PipeInfo.PtStart.Z);
                ptStart = ptStart * Tools.Ft2MmScale;
                var ptEnd = new gPoint(blkData.PipeInfo.PtEnd.X, blkData.PipeInfo.PtEnd.Y, blkData.PipeInfo.PtEnd.Z);
                ptEnd = ptEnd * Tools.Ft2MmScale;
                AddPipeToEntities(block.Entities, blkData.PipeInfo.Diameter * Tools.Ft2MmScale, ptStart, ptEnd, blkData.PipeInfo.MaterialName);

                if (!blkData.DictProperties.ContainsKey("PipeInfo"))
                {
                    var pipeProps = new List <PropertyData>
                    {
                        new PropertyData {
                            GroupName = "PipeInfo", Name = "PipeStartPoint", Value = ptStart.ToSplitString()
                        },
                        new PropertyData {
                            GroupName = "PipeInfo", Name = "PipeEndPoint", Value = ptEnd.ToSplitString()
                        },
                        new PropertyData {
                            GroupName = "PipeInfo", Name = "PipeDiameter", Value = (blkData.PipeInfo.Diameter * Tools.Ft2MmScale).ToString()
                        }
                    };

                    blkData.DictProperties.Add("PipeInfo", pipeProps);
                }
            }

            AddXPropertiesToEntity(blkData.DictProperties, block);

            block.Update();

            return(block);
        }
Esempio n. 4
0
        public static ulong BuildCommonHorSolidLineByLayer(LJJSPoint pStart, double lineWidth, double penWidth, int horDirection)
        {
            gPoint pEnd   = new gPoint(pStart.XValue + horDirection * lineWidth, pStart.YValue);
            gPoint pstart = new gPoint(pStart.XValue, pStart.YValue);

            return(VectorDrawHelper.CommonLineByLayer(DrawCommonData.activeDocument, pstart, pEnd, penWidth, "", DrawCommonData.SolidLineTypeName));
        }
Esempio n. 5
0
        public static ulong CommonLine(vdDocument activeDocument, gPoint pStart, gPoint pEnd, double pWidth, int pColor, string lineTypeName, string pToolTip)
        {
            VectorDraw.Professional.vdFigures.vdLine oneline = new VectorDraw.Professional.vdFigures.vdLine();
            //We set the document where the line is going to be added.This is important for the vdLine in order to obtain initial properties with setDocumentDefaults.
            // oneline.SetUnRegisterDocument(DrawCommonData.activeDocument);
            oneline.SetUnRegisterDocument(activeDocument);
            oneline.setDocumentDefaults();
            //The two previus steps are important if a vdFigure object is going to be added to a document.
            //Now we will change some properties of the line.
            oneline.StartPoint = pStart;
            oneline.EndPoint   = pEnd;
            if (!string.IsNullOrEmpty(lineTypeName))
            {
                vdLineType linetype = GetLineTypeByName(activeDocument, lineTypeName);
                if (null != linetype)
                {
                    oneline.LineType = GetLineTypeByName(activeDocument, lineTypeName);
                }
            }

            oneline.PenColor.SystemColor = Color.FromArgb(pColor);
            //Pen width is depended from the zoom.See in the vdRect object about LineWeight.
            oneline.PenWidth = pWidth;
            oneline.ToolTip  = pToolTip;
            //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout).
            DrawCommonData.activeDocument.ActiveLayOut.Entities.AddItem(oneline);
            return(oneline.Handle.Value);
        }
Esempio n. 6
0
        public static ulong AddText(vdDocument activeDocument, string textContent, gPoint insertPoint, VdConstVerJust verJust, VdConstHorJust horJust, int TextColor, string fontFile, double textHeight, double widthFactor, VectorDraw.Render.grTextStyleExtra.TextLineFlags textLineFlags, double textRotation, bool ifBold)
        {
            //We will create a vdText object and add it to the Active Layout which is the basic Model Layout always existing in a Document.
            VectorDraw.Professional.vdFigures.vdText onetext = new VectorDraw.Professional.vdFigures.vdText();
            //We set the document where the text is going to be added.This is important for the vdText in order to obtain initial properties with setDocumentDefaults.
            onetext.SetUnRegisterDocument(activeDocument);
            onetext.setDocumentDefaults();

            //The two previus steps are important if a vdFigure object is going to be added to a document.
            //Now we will change some properties of the text.
            onetext.PenColor.SystemColor = Color.FromArgb(TextColor);
            onetext.TextString           = textContent;


            onetext.InsertionPoint = insertPoint;
            onetext.VerJustify     = verJust;
            onetext.HorJustify     = horJust;
            onetext.TextLine       = textLineFlags;
            onetext.Height         = textHeight;
            onetext.WidthFactor    = widthFactor;
            onetext.Rotation       = textRotation;
            onetext.Bold           = ifBold;
            onetext.Style.FontFile = fontFile;

            //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout).
            activeDocument.ActiveLayOut.Entities.AddItem(onetext);
            return(onetext.Handle.Value);
        }
Esempio n. 7
0
        public void DrawSupportFixed(vdDocument doc, gPoint pt)
        {
            supportFixedLay.Name = "SupportFixed";
            if (doc.Layers.FindName("SupportFixed") == null)
            {
                supportFixedLay      = new vdLayer();
                supportFixedLay.Name = "SupportFixed";
                supportFixedLay.SetUnRegisterDocument(doc);
                supportFixedLay.setDocumentDefaults();
                doc.Layers.AddItem(supportFixedLay);
            }
            else
            {
                supportFixedLay = doc.Layers.FindName("SupportFixed");
            }

            ASTRASupportFixed asFix = new ASTRASupportFixed();

            asFix.SetUnRegisterDocument(doc);
            asFix.setDocumentDefaults();

            asFix.Origin = pt;
            asFix.Radius = 0.1d;
            asFix.Layer  = supportFixedLay;
            doc.ActiveLayOut.Entities.AddItem(asFix);
        }
Esempio n. 8
0
        public static ulong BuildCommonSoldLine(LJJSPoint ptStart, LJJSPoint ptEnd, int lineColor, double penWidth)
        {
            gPoint pStart = FigureStrucConvert.ConvertLJJSPointToGPoint(ptStart);
            gPoint pEnd   = FigureStrucConvert.ConvertLJJSPointToGPoint(ptEnd);

            return(VectorDrawHelper.CommonLine(DrawCommonData.activeDocument, pStart, pEnd, penWidth, lineColor, DrawCommonData.SolidLineTypeName, ""));
        }
Esempio n. 9
0
        public override void FillShapeEntities(ref vdEntities entities)
        {
            vdCircle circle = new vdCircle();

            entities.AddItem(circle);
            circle.MatchProperties(this, Document);
            circle.Radius          = mRadius;
            circle.HatchProperties = mhatchprops;

            if (mShowLines)
            {
                gPoint cen = new gPoint();
                vdLine line1;
                double angle = 0.0;
                for (int i = 0; i < 4; i++)
                {
                    line1 = new vdLine();
                    line1.MatchProperties(this, Document);
                    if (mhatchprops.FillMode == VdConstFill.VdFillModeNone)
                    {
                        line1.LineType = Document.LineTypes.Invisible;
                    }
                    line1.StartPoint = new gPoint(gPoint.Polar(cen, angle + mAngle, 3.0d * mRadius / 2.0d));
                    line1.EndPoint   = new gPoint(gPoint.Polar(cen, angle + mAngle, 2.0d * mRadius));
                    angle           += VectorDraw.Geometry.Globals.HALF_PI;
                    entities.AddItem(line1);
                }
            }
        }
Esempio n. 10
0
        public static ulong BuildHorToRightSolidLine(LJJSPoint pStart, double lineWidth, double penWidth, int pColor, string pToolTip)
        {
            gPoint pEnd   = new gPoint(pStart.XValue + lineWidth, pStart.YValue);
            gPoint pstart = new gPoint(pStart.XValue, pStart.YValue);

            return(VectorDrawHelper.CommonLine(DrawCommonData.activeDocument, pstart, pEnd, penWidth, pColor, DrawCommonData.SolidLineTypeName, pToolTip));
        }
Esempio n. 11
0
        public override void MoveGripPointsAt(Int32Array Indexes, double dx, double dy, double dz)
        {
            if (Indexes == null || Indexes.Count == 0 || (dx == 0.0 && dy == 0.0 && dz == 0.0))
            {
                return;
            }
            gPoints grips = GetGripPoints();

            if (Indexes.Count == grips.Count)
            {
                Matrix mat = new Matrix();
                mat.TranslateMatrix(dx, dy, dz);
                Transformby(mat);
            }
            else
            {
                foreach (int index in Indexes)
                {
                    switch (index)
                    {
                    case 0:
                        StartPoint += new gPoint(dx, dy, dz);
                        break;

                    case 1:
                        EndPoint += new gPoint(dx, dy, dz);
                        break;

                    default:
                        break;
                    }
                }
            }
            Update();
        }
Esempio n. 12
0
                private void GetInfoExtrusion()
                {
                    if (Surface.IsSwept())
                    {
                        Double[] Param = Surface.GetExtrusionsurfParams();
                        Direction = new gVecteur(Param[0], Param[1], Param[2]);

                        Curve C = Surface.GetProfileCurve();
                        C = C.GetBaseCurve();

                        Double  StartParam = 0, EndParam = 0;
                        Boolean IsClosed = false, IsPeriodic = false;

                        if (C.GetEndParams(out StartParam, out EndParam, out IsClosed, out IsPeriodic))
                        {
                            Double[] Eval = C.Evaluate(StartParam);

                            Origine = new gPoint(Eval[0], Eval[1], Eval[2]);
                        }

                        var     UV      = (Double[])SwFace.GetUVBounds();
                        Boolean Reverse = SwFace.FaceInSurfaceSense();

                        var ev1 = (Double[])Surface.Evaluate((UV[0] + UV[1]) * 0.5, (UV[2] + UV[3]) * 0.5, 0, 0);
                        if (Reverse)
                        {
                            ev1[3] = -ev1[3];
                            ev1[4] = -ev1[4];
                            ev1[5] = -ev1[5];
                        }

                        Normale = new gVecteur(ev1[3], ev1[4], ev1[5]);
                    }
                }
Esempio n. 13
0
            private eOrientation Orientation(gPoint p1, gVecteur v1, gPoint p2, gVecteur v2)
            {
                if (p1.Distance(p2) < 1E-10)
                {
                    return(eOrientation.MemeOrigine);
                }

                gVecteur Vtmp = new gVecteur(p1, p2);

                if ((v1.Vectoriel(Vtmp).Norme < 1E-10) && (v2.Vectoriel(Vtmp).Norme < 1E-10))
                {
                    return(eOrientation.Colineaire);
                }

                gVecteur Vn1 = (new gVecteur(p1, p2)).Vectoriel(v1);
                gVecteur Vn2 = (new gVecteur(p2, p1)).Vectoriel(v2);

                gVecteur Vn = Vn1.Vectoriel(Vn2);

                if (Vn.Norme < 1E-10)
                {
                    return(eOrientation.Coplanaire);
                }

                return(eOrientation.Indefini);
            }
Esempio n. 14
0
        public static ulong BuildCommonLineByLayer(LJJSPoint ptStart, LJJSPoint ptEnd, double penWidth)
        {
            gPoint pStart = FigureStrucConvert.ConvertLJJSPointToGPoint(ptStart);
            gPoint pEnd   = FigureStrucConvert.ConvertLJJSPointToGPoint(ptEnd);

            return(VectorDrawHelper.CommonLineByLayer(DrawCommonData.activeDocument, pStart, pEnd, penWidth, "", ""));
        }
Esempio n. 15
0
        public static ulong AddRectImageHatch(LJJSPoint leftBottomInsertPt, double rectHeigh, double rectWidth, string imagePath, double hatchScale, List <StrValueProperty> additionImageLst)
        {
            vdXProperties tmppro        = new vdXProperties();
            gPoint        leftBottomPt  = new gPoint(leftBottomInsertPt.XValue, leftBottomInsertPt.YValue);
            gPoint        leftTopPt     = new gPoint(leftBottomInsertPt.XValue, leftBottomInsertPt.YValue + DrawCommonData.DirectionUp * rectHeigh);
            gPoint        rightBottomPt = new gPoint(leftBottomInsertPt.XValue + rectWidth * DrawCommonData.DirectionRight, leftBottomInsertPt.YValue);
            gPoint        rightTopPt    = new gPoint(leftBottomInsertPt.XValue + rectWidth * DrawCommonData.DirectionRight, leftBottomInsertPt.YValue + DrawCommonData.DirectionUp * rectHeigh);

            Vertexes hatchRect = new Vertexes();

            hatchRect.Add(leftBottomPt);
            hatchRect.Add(leftTopPt);
            hatchRect.Add(rightTopPt);
            hatchRect.Add(rightBottomPt);
            if (null != additionImageLst && additionImageLst.Count > 0)
            {
                for (int i = 0; i < additionImageLst.Count; i++)
                {
                    StrValueProperty tmp = additionImageLst[i];
                    if (!string.IsNullOrEmpty(tmp.PropertyName) && !string.IsNullOrEmpty(tmp.PropertyValue))
                    {
                        vdXProperty tmpproperty = new vdXProperty();
                        tmpproperty.Name      = tmp.PropertyName;
                        tmpproperty.PropValue = tmp.PropertyValue;
                        tmppro.AddItem(tmpproperty);
                    }
                }
            }
            return(VectorDrawHelper.AddHatchImageToFigure(DrawCommonData.activeDocument, hatchRect, "", imagePath, hatchScale, tmppro));
        }
Esempio n. 16
0
        public static void CmdBlink(vdDocument doc)
        {
            gPoint cen = new gPoint();

            doc.Prompt("Origin-Center Point : ");
            object ret = doc.ActionUtility.getUserPoint();

            doc.Prompt(null);
            if (ret == null || !(ret is gPoint))
            {
                goto error;
            }
            cen = ret as gPoint;
            doc.Prompt("Radius : ");
            ActionBlink aFig = new ActionBlink(cen, doc.ActiveLayOut);

            doc.ActionAdd(aFig);
            StatusCode scode = aFig.WaitToFinish();

            doc.Prompt(null);
            if (scode != VectorDraw.Actions.StatusCode.Success)
            {
                goto error;
            }
            aFig.Entity.Transformby(doc.User2WorldMatrix);
            doc.ActionLayout.Entities.AddItem(aFig.Entity);
            doc.ActionDrawFigure(aFig.Entity);
            return;

error:
            return;
        }
Esempio n. 17
0
        public gPoint getCircleCenFrom3Pts(gPoint p1, gPoint p2, gPoint p3)
        {
            gPoint pt  = gPoint.MidPoint(p1, p2);
            gPoint gp1 = new gPoint();

            int ret = Globals.Intersection3DSegmentPlane(p2, p3, new Vector(p2, p1), pt, out gp1);

            if (ret == 0)  //预防有平行的情况
            {
                ret = Globals.Intersection3DSegmentPlane(p1, p3, new Vector(p2, p1), pt, out gp1);
            }

            gPoint point2 = gPoint.MidPoint(p2, p3);

            gPoint gp2 = new gPoint();

            ret = Globals.Intersection3DSegmentPlane(p1, p2, new Vector(p2, p3), point2, out gp2);
            if (ret == 0) //预防有平行的情况
            {
                ret = Globals.Intersection3DSegmentPlane(p1, p3, new Vector(p2, p3), point2, out gp2);
            }

            gPoint retpt = new gPoint();

            Globals.IntersectionLL3D(pt, gp1, point2, gp2, retpt);
            return(retpt);
        }
Esempio n. 18
0
 public DisNetPipe()
 {
     iNo          = 0;
     dLength      = 0.0;
     dDiameter    = 0.0;
     gpStartPoint = new gPoint();
     gpEndPoint   = new gPoint();
 }
Esempio n. 19
0
 public DisNetNode()
 {
     nodeNo    = 0;
     elevation = 0.0d;
     head      = 0.0d;
     pts       = new gPoint();
     bIsPump   = false;
 }
Esempio n. 20
0
        private Double AngleCubeDeVisualisation(View vue, Sketch esquisse)
        {
            MathUtility SwMath = App.Sw.GetMathUtility();

            List <gPoint> LstPt = new List <gPoint>();

            foreach (SketchPoint s in esquisse.GetSketchPoints2())
            {
                MathPoint point = SwMath.CreatePoint(new Double[3] {
                    s.X, s.Y, s.Z
                });
                MathTransform SketchXform = esquisse.ModelToSketchTransform;
                SketchXform = SketchXform.Inverse();
                point       = point.MultiplyTransform(SketchXform);
                MathTransform ViewXform = vue.ModelToViewTransform;
                point = point.MultiplyTransform(ViewXform);
                gPoint swViewStartPt = new gPoint(point);
                LstPt.Add(swViewStartPt);
            }

            // On recherche le point le point le plus à droite puis le plus haut
            LstPt.Sort(new gPointComparer(ListSortDirection.Descending, p => p.X));
            LstPt.Sort(new gPointComparer(ListSortDirection.Descending, p => p.Y));

            // On le supprime
            LstPt.RemoveAt(0);

            // On recherche le point le point le plus à gauche puis le plus bas
            LstPt.Sort(new gPointComparer(ListSortDirection.Ascending, p => p.X));
            LstPt.Sort(new gPointComparer(ListSortDirection.Ascending, p => p.Y));


            // C'est le point de rotation
            gPoint pt1 = LstPt[0];

            // On recherche le plus loin
            gPoint pt2;
            Double d1 = pt1.Distance(LstPt[1]);
            Double d2 = pt1.Distance(LstPt[2]);

            if (d1 > d2)
            {
                pt2 = LstPt[1];
            }
            // En cas d'égalité, on renvoi le point le plus à gauche
            else if (d1 == d2)
            {
                pt2 = (LstPt[1].X < LstPt[2].X) ? LstPt[1] : LstPt[2];
            }
            else
            {
                pt2 = LstPt[2];
            }

            gVecteur v = new gVecteur(pt1, pt2);

            return(Math.Atan2(v.Y, v.X));
        }
Esempio n. 21
0
        public override gPoints GetGripPoints()
        {
            gPoints ret = new gPoints();
            gPoint  cen = new gPoint();

            ret.Add(cen);
            ECSMatrix.Transform(ret);
            return(ret);
        }
Esempio n. 22
0
 public ActionASTRAMemberLoad(gPoint reference, vdLayout layout)
     : base(reference, layout)
 {
     line = new ASTRAMemberLoad();
     line.SetUnRegisterDocument(layout.Document);
     line.setDocumentDefaults();
     line.StartPoint = reference;
     line.EndPoint   = reference;
 }
Esempio n. 23
0
        public ASTRAMemberLoad_UDL()
        {
            mhatchprops = new vdHatchProperties();
            mhatchprops.SetUnRegisterDocument(Document);
            mhatchprops.FillMode = VdConstFill.VdFillModeSolid;

            gpEndPoint   = new gPoint();
            gpStartPoint = new gPoint();
        }
Esempio n. 24
0
 public ActionBlink(gPoint reference, vdLayout layout)
     : base(reference, layout)
 {
     ValueTypeProp |= valueType.DISTANCE;
     figure         = new VectorDrawBlink();
     figure.SetUnRegisterDocument(layout.Document);
     figure.setDocumentDefaults();
     figure.Origin = reference;
 }
Esempio n. 25
0
            private void Run(Face2 dessus, Face2 devant, Component2 contreMarche, Feature esquisse)
            {
                if ((dessus == null) || (devant == null))
                {
                    this.LogMethode(new String[] { "Une reference à un objet a été perdue dessus | devant :", dessus.IsRefToString(), "|", devant.IsRefToString() });
                    return;
                }
                try
                {
                    Edge E_Face = dessus.eListeDesArretesCommunes(devant)[0];

                    List <Edge> ListeArrete = dessus.eListeDesArretesContigues(E_Face);

                    // On assigne les cotes de façon arbitraire pour eviter une assignation suplémentaire
                    Edge E_Gauche = ListeArrete[0];
                    Edge E_Droit  = ListeArrete[1];

                    // Création des segements
                    gSegment S1 = new gSegment(E_Gauche);
                    gSegment Sf = new gSegment(E_Face);

                    // Orientation des segements
                    S1.OrienterDe(Sf);
                    Sf.OrienterVers(S1);

                    gVecteur Normal = new gVecteur((Double[])dessus.Normal);

                    // Verification du sens de rotation et modification des cotes si nécessaire
                    if (Sf.Vecteur.RotationTrigo(S1.Vecteur, Normal))
                    {
                        E_Gauche = ListeArrete[1];
                        E_Droit  = ListeArrete[0];
                    }

                    gSegment F = new gSegment(E_Face);
                    gSegment G = new gSegment(E_Gauche);
                    gSegment D = new gSegment(E_Droit);

                    G.OrienterDe(F);
                    D.OrienterDe(F);
                    F.OrienterDe(G);

                    Double gAg1 = G.Vecteur.Angle(F.Vecteur);
                    Double gAg2 = D.Vecteur.Angle(F.Vecteur.Inverse());

                    Double gLg1 = new gPoint(0, 0, 0).Distance(F.Start);
                    Double gLg2 = new gPoint(0, 0, 0).Distance(F.End);
                    Double gLc1 = G.Lg;
                    Double gLc2 = D.Lg;

                    Configurer(contreMarche, gAg1, gAg2, gLg1, gLg2, gLc1, gLc2, esquisse);
                }
                catch (Exception e)
                {
                    this.LogErreur(new Object[] { e });
                }
            }
Esempio n. 26
0
 public ActionASTRASupportFixed(gPoint reference, vdLayout layout)
     : base(reference, layout)
 {
     ValueTypeProp |= valueType.DISTANCE;
     figure         = new ASTRASupportFixed();
     figure.SetUnRegisterDocument(layout.Document);
     figure.setDocumentDefaults();
     figure.Origin = reference;
 }
Esempio n. 27
0
            public void Agrandir(gPoint p)
            {
                ptMinX = Math.Min(ptMinX, p.X);
                ptMinY = Math.Min(ptMinY, p.Y);

                ptMaxX = Math.Max(ptMaxX, p.X);
                ptMaxY = Math.Max(ptMaxY, p.Y);

                MajCentreRectangle();
            }
Esempio n. 28
0
        void BaseControl_MouseMove(object sender, MouseEventArgs e)
        {
            gPoint ccspt = VDoc.CCS_CursorPos();

            double x = ccspt.x;
            double y = ccspt.y;
            double z = ccspt.z;

            tsb_coordinate.Text = string.Format("{0:f4}, {1:f4}, {2:f4}", x, y, z);
        }
Esempio n. 29
0
        private void dgvNodeGrid_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            gPoint joint = new gPoint();

            joint.x = (double)dgvNodeGrid[1, e.RowIndex].Value;
            joint.y = (double)dgvNodeGrid[2, e.RowIndex].Value;
            joint.z = (double)dgvNodeGrid[3, e.RowIndex].Value;

            VectorDraw.Professional.vdPrimaries.vdFigure fg = null;
            if (lastId != -1)
            {
                for (int i = vdoc.ActiveLayOut.Entities.Count - 1; i >= 0; i--)
                {
                    fg = vdoc.ActiveLayOut.Entities[i];
                    if (fg.Id == lastId)
                    {
                        vdoc.ActiveLayOut.Entities.RemoveAt(i);
                        break;
                    }
                }
            }
            vdoc.CommandAction.CmdSphere(joint, 0.039, 10, 10);

            lastId      = vdoc.ActiveLayOut.Entities.Count - 1;
            fg          = vdoc.ActiveLayOut.Entities[lastId];
            lastId      = fg.Id;
            fg.PenColor = new vdColor(Color.DarkViolet);

            if ((tssl_zoom.Text == "Zoom On"))
            {
                vdoc.CommandAction.Zoom("W", new gPoint(joint.x + 2.0, joint.y + 2.0, joint.z + 1.0),
                                        new gPoint(joint.x - 1.0, joint.y - 2.0, joint.z - 1.0));
            }
            vdoc.Redraw(true);

            //if (lastId != -1)
            //{
            //    vdoc.ActiveLayOut.Entities.RemoveAt(lastId);
            //}
            //vdoc.CommandAction.CmdSphere(joint, 0.09, 10, 10);


            //lastId = vdoc.ActiveLayOut.Entities.Count - 1;
            //VectorDraw.Professional.vdPrimaries.vdFigure fg = vdoc.ActiveLayOut.Entities[lastId];
            //fg.PenColor = new vdColor(Color.DarkViolet);

            //if (tsbtn_zoom.Checked)
            //    vdoc.CommandAction.Zoom("W", new gPoint(joint.x + 2.0, joint.y + 2.0, joint.z + 1.0),
            //     new gPoint(joint.x - 1.0, joint.y - 2.0, joint.z - 1.0));
            //vdoc.Redraw(true);
        }
Esempio n. 30
0
        ///判断是个边是否符合圆柱体标准
        bool IS4SideCyln(gPoints gEndSide1, gPoints gEndSide2, gPoints gParaSide1, gPoints gParaSide2, ref gPoint center1, ref gPoint center2, out double radius)
        {
            int half = gEndSide1.Count / 2;

            radius = 0.0;
            gPoint gp1 = gEndSide1[half];
            gPoint gp2 = Globals.LineNearestTo(gParaSide1[0], gParaSide1[1], gp1, false);
            gPoint gp3 = Globals.LineNearestTo(gParaSide2[0], gParaSide2[1], gp1, false);

            gPoints gps1 = new gPoints();

            if (gp1.AreEqual(gp2) || gp1.AreEqual(gp3) || gp2.AreEqual(gp3))
            {
                return(false);
            }

            center1 = getCircleCenFrom3Pts(gp1, gp2, gp3);
            double dist = gp1.Distance3D(center1);

            gp1 = gEndSide2[half];
            gp2 = Globals.LineNearestTo(gParaSide1[0], gParaSide1[1], gp1, false);
            gp3 = Globals.LineNearestTo(gParaSide2[0], gParaSide2[1], gp1, false);

            if (gp1.AreEqual(gp2) || gp1.AreEqual(gp3) || gp2.AreEqual(gp3))
            {
                return(false);
            }

            center2 = getCircleCenFrom3Pts(gp1, gp2, gp3);

            //上边的距离是否满足半径要求
            for (int i = 0; i < gEndSide1.Count; i++)
            {
                double ddd = Globals.distPointFromLine(gEndSide1[i], center1, center2);
                if (Math.Abs((ddd - dist)) > Globals.VD_ZERO2)
                {
                    radius = 0;
                    return(false);
                }
            }
            //下边的距离是否满足半径要求
            for (int i = 0; i < gEndSide2.Count; i++)
            {
                double ddd = Globals.distPointFromLine(gEndSide2[i], center1, center2);
                if (Math.Abs((ddd - dist)) > Globals.VD_ZERO2)
                {
                    radius = 0;
                    return(false);
                }
            }

            radius = dist;

            return(true);
        }