public void BeantBeamCutPlate()
{
UserInteraction.PrintMess("请选取梁:");
ObjectId asObjectId = UserInteraction.SelectObject();
UserInteraction.PrintMess("请选取板:");
ObjectId asObjectIdPlate = UserInteraction.SelectObject();
Polyline3d polyline = new Polyline3d();
List<Point3d> arraylist = new List<Point3d>();
List<Point3d> resP = new List<Point3d>();
using (DocumentAccess documentAccess = new DocumentAccess())
{
if (asObjectId != null)
{
Plate plate = DatabaseManager.Open(asObjectIdPlate) as Plate;
Matrix3d matrix = new Matrix3d(plate.CS);
matrix.GetCoordSystem(out Point3d ptOrt, out Vector3d vx, out Vector3d vy, out Vector3d vz);
FilerObject filerObject = DatabaseManager.Open(asObjectId);
if (filerObject != null && filerObject.IsKindOf(FilerObject.eObjectType.kBeam))
{
Beam beam = filerObject as Beam;
ModelerBody modelerBody1 = beam.GetModeler(BodyContext.eBodyContext.kNormal);
modelerBody1.IntersectWith(plate.DefinitionPlane, out LineSeg3d[] lineSeg3s);
int n = 0;
foreach (var item in lineSeg3s)
{
if (n < lineSeg3s.Length / 2)
{
arraylist.Add(item.MidPoint);
n++;
}
}
getPath(arraylist, resP, arraylist[0]);
for (int i = 0; i < resP.Count; i++)
{
polyline.Append(resP[i]);
}
PlateContourNotch plateContour = new PlateContourNotch(plate, 1, polyline, vz, vx);
plate.AddFeature(plateContour);
}
}
documentAccess.Commit();
}
}