オフセット アセンブリを追加する

オフセット アセンブリは、Assembly オブジェクトの OffsetAssemblies コレクションに含まれ、Add() メソッドを使用して追加することができます。このメソッドには、新しいオフセット アセンブリの名前と、Vector2d オブジェクトとして Assembly オブジェクトからのオフセットを指定します。

次の例では、新しいオフセット アセンブリが作成され、Assembly オブジェクトの OffsetAssemblies コレクションに追加されます。

// Add offset assembly
Point3d offsetLocation = _editor.GetPoint("Select offset assembly location").Value;
Point2d location2d = new Point2d(location.X, location.Y);
Point2d offsetLocation2d = new Point2d(offsetLocation.X, offsetLocation.Y);
Vector2d offset = offsetLocation2d - location2d;
assembly.OffsetAssemblies.Add("New Offset Assembly", offset);