Ejemplo n.º 1
0
 public void SetEndPoint(int objectId, PointD endPoint)
 {
     if (!this.Set <double[]>(objectId, "終点設定", endPoint.ToArray()))
     {
         throw new AutoCadException("Failed to set end point of line.");
     }
 }
Ejemplo n.º 2
0
 public void SetPosition(int blockRefId, PointD position)
 {
     if (!Set <double[]>(blockRefId, "基点設定", position.ToArray()))
     {
         throw new AutoCadException("Failed to set position.");
     }
 }
Ejemplo n.º 3
0
        public void SetVertex(int polylineId, int vertexIndex, PointD vertexPoint)
        {
            List <object> args = new List <object>();

            args.Add(vertexIndex);
            args.Add(vertexPoint.ToArray());

            if (!this.Set <object[]>(polylineId, "頂点順番指定設定", args.ToArray()))
            {
                throw new AutoCadException("Failed to set vertex of polyline.");
            }
        }
Ejemplo n.º 4
0
        public int Make(PointD startPoint, PointD endPoint)
        {
            var args = new List <object>();

            args.Add(startPoint.ToArray());
            args.Add(endPoint.ToArray());

            var result = this.Make <object>(args.ToArray());

            if (!result.Success)
            {
                throw new AutoCadException("Failed to make line.");
            }

            return(result.Value);
        }
Ejemplo n.º 5
0
        public int Make(PointD point, double radius)
        {
            var args = new List <object>();

            args.Add(point.ToArray());
            args.Add(radius);

            var result = this.Make <object>(args.ToArray());

            if (!result.Success)
            {
                throw new AutoCadException("Failed to make circle.");
            }

            return(result.Value);
        }
Ejemplo n.º 6
0
        /// <summary>始点から、指定する図形上の位置(点)までの図形に沿った距離を取得する</summary>
        public double GetLength(int objectId, PointD point)
        {
            Result <double> result = this.Get <double, double[]>(objectId, "点から距離取得", point.ToArray());

            if (!result.Success)
            {
                throw new AutoCadException("Failed to get length of polyline.");
            }

            return(result.Value);
        }
Ejemplo n.º 7
0
        public virtual double GetLength(int objectId)
        {
            PointD start = this.GetStartPoint(objectId);
            PointD end   = this.GetEndPoint(objectId);

            if (start.Equals(end))
            {
                return(0d); //長さが0の線に対して距離取得すると失敗するので、回避だ!
            }
            Result <double> result = this.Get <double, double[]>(objectId, "点から距離取得", end.ToArray());

            if (!result.Success)
            {
                throw new AutoCadException("Failed to get length of curve.");
            }

            return(result.Value);
        }