Polyline3dから領域を作成しようとしていますが、メソッドRegion.CreateFromCurves(curvesSegments)が無効な入力エラーを返します。私は3日間近く頭を撫でていましたが、この問題について合理的な説明は見つかりませんでした。ここでエラーを発生させるコードのスニップのセットです:autocad .net CreateFromCurves()無効な入力
Point3dCollection _border = new Point3dCollection();
double _radius;
Vector3d _normal
// some codes to input value to _radius, _normal
// creating a hexagon border here that contains 6 coplanar points
public void CreateBorder()
{
_border.Clear();
Vector3d vect = new Vector3d(_radius, 0, 0);
for (int index = 0; index < _count; index++)
{
_border.Add (_center + vect);
vect = vect.RotateBy(_angle, _normal);
}
}
public Region CreateTopBottom(bool isBottom)
{
Polyline3d poly = new Polyline3d(Poly3dType.SimplePoly, _border, true);
DBObjectCollection curves = new DBObjectCollection();
curves.Add(poly);
DBObjectCollection regions = Region.CreateFromCurves(curves);
regions Region region = regions[0] as Region;
if (!isBottom) region.TransformBy(Matrix3d.Displacement(_normal * _height));
return region;
}
私は、このように、それはエラーとなり、(Point3dCollection)コンパイラが_borderで私の点を考慮している疑いが同一平面上にありません。しかし、私のポイントは、あなたが見ることができるように、完全に同一平面上にありますが、私はコンパイラに「知らせる」方法を知らないのです。容疑者は正しいのですか?これをどうすれば解決できますか?すべて前もってありがとうございます
IはPoint3dCollectionを使用する理由は、他のコードは、この私は動的法線ベクトルとジギングプロセスにこれを適用する2からの利益とすることができる1です。 Point3dCollectionを使用する方法がありますか、それともPoint2dCollectionを使用し、それに応じてリージョンを変換する必要がありますか(他のコードに対して多くの作業を行う必要があります) –
私はPoint3dCollectionの構築方法に何が間違っていたのか説明しようと私の返信を編集しました。以前のコードで修正されたCreateBorder()メソッドを使用して、Polyline3dから領域を作成することができます。また、各Point3dをPoint2dに変換してポリラインを作成することもできます。 – gileCAD
法線ベクトルの問題を説明していただきありがとうございます。それはまさに私のコードをいつかクラッシュさせる原因になります。私が気づかないと予期せぬ結果が生じることがあります。 –