Exemplo n.º 1
0
        public BeamData(double height, double width, double maxlength, _AcGe.Point3d p0, _AcGe.Point3d p1, _AcGe.Point3d pSide = new _AcGe.Point3d())
        {
            BeamStartPoint = p0;
            BeamEndPoint   = p1;
            BeamSidePoint  = pSide;
            Height         = height;
            Width          = width;
            Length         = BeamStartPoint.GetVectorTo(BeamEndPoint).Length;
            MaxLength      = maxlength;

            if (Length > MaxLength)
            {
                MessageBox.Show("WARNING! - picked beam length is greater than maximum length for selected beam type.");
            }

            //
            // We need to check the incoming pSide var to see if we need to offset our beam to one side
            // or draw it on the centre line (the picked points form the centre line).
            //
            if (pSide.GetAsVector().Length == 0)
            {
                OffsetFactor = 0.5;     // no offset so set offset factor to half width to draw on centre line
            }
            else
            {
                OffsetFactor = 1.0;     // full offset required
            }
        }
Exemplo n.º 2
0
        public static double GetProjectionOnLine(AcGe.Point3d startPointLine, AcGe.Point3d endPointLine, AcGe.Point3d point)
        {
            double dirAngleLine    = GetDirAngle(startPointLine, endPointLine);
            double dirAngleToPoint = GetDirAngle(startPointLine, point);
            double a = dirAngleToPoint - dirAngleLine;

            return(Math.Cos(a) * startPointLine.GetVectorTo(point).Convert2d(new AcGe.Plane()).Length);
        }