本文整理汇总了C#中Section.GetBoundingBoxOfElementType方法的典型用法代码示例。如果您正苦于以下问题:C# Section.GetBoundingBoxOfElementType方法的具体用法?C# Section.GetBoundingBoxOfElementType怎么用?C# Section.GetBoundingBoxOfElementType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section.GetBoundingBoxOfElementType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSketch
public List<string> CreateSketch(Section section, CampaignReport campaignReport, List<SteelThicknessGaugingPoint> steelThicknessGaugingPoints, out SortedList<int, List<SteelThicknessGaugingPoint>> pointsPerSketch)
{
try
{
if (section == null)
{
throw new ArgumentNullException("section");
}
if (campaignReport == null)
{
throw new ArgumentNullException("campaignReport");
}
int index = 0;
pointsPerSketch = new SortedList<int, List<SteelThicknessGaugingPoint>>();
SortedList<string, IList> elementsInCampaign = section.GetPermanentElementsInCampaignReport(campaignReport);
if (!elementsInCampaign.ContainsKey("SteelThicknessGaugingPoint") || elementsInCampaign["SteelThicknessGaugingPoint"].Count == 0)
{
return null;
}
Document document = campaignReport.Vessel.Document as Document;
Vessel vessel = document.Vessel;
List<string> bitmaps = new List<string>();
string sectionDrawerCurrentViewModeName = section.SectionDrawer.CurrentViewModeName;
section.SectionDrawer.CurrentViewModeName = "SketchFormat";
if (!this.sectionThumbnails.ContainsKey(vessel.GUID))
{
this.sectionThumbnails.Add(vessel.GUID, new Dictionary<int, Bitmap>());
}
if (!this.sectionThumbnails[vessel.GUID].ContainsKey(section.ID))
{
this.sectionThumbnails[vessel.GUID].Add(section.ID, null);
}
if (this.sectionThumbnails[vessel.GUID][section.ID] == null)
{
CaptionsModel.Instance.SetCaptionPropertySelection("Plate", "IACSSketchDescription", false);
section.SectionDrawer.CurrentViewModeName = "Wireframe";
section.SectionDrawer.ConfigureView(this.glPanel, section.GetDefaultView(), true);
section.SectionDrawer.UpdateLastCamera(this.glPanel);
section.SectionDrawer.DrawAxis = false;
bool isWireframeVisible = ViewModesData.Instance.IsVisible(section.SectionDrawer.CurrentViewModeName, "Wireframe");
if (!isWireframeVisible)
{
ViewModesData.Instance.SetVisibility(section.SectionDrawer.CurrentViewModeName, "Wireframe", true, true);
}
Bitmap bitmap = section.SectionDrawer.DrawModelImmediateMode(this.glPanel);
if (!isWireframeVisible)
{
ViewModesData.Instance.SetVisibility(section.SectionDrawer.CurrentViewModeName, "Wireframe", false, true);
}
section.SectionDrawer.DrawAxis = true;
this.sectionThumbnails[vessel.GUID][section.ID] = bitmap;
section.SectionDrawer.CurrentViewModeName = "SketchFormat";
CaptionsModel.Instance.SetCaptionPropertySelection("Plate", "IACSSketchDescription", true);
}
Bitmap originalThumbnail = this.sectionThumbnails[vessel.GUID][section.ID];
if (section.SectionType.Name.Equals("WebFrames") ||
section.SectionType.Name.Equals("TransverseBulkheads") ||
section.SectionType.Name.Equals("TransverseCentralBulkheads") ||
section.SectionType.Name.Equals("SwashBulkheads")
)
{
#region Non Longitudinal
pointsPerSketch.Add(index, steelThicknessGaugingPoints);
index++;
BoundingBox boundingBox = section.GetBoundingBoxOfElementType("Plate");
Vector3D planeNormal = section.Normal * section.Up;
Point3D planePoint = boundingBox.Center;
Plane plane = new Plane(planeNormal, planePoint);
List<SteelThicknessGaugingPoint> backGaugingPoints = null;
List<SteelThicknessGaugingPoint> frontGaugingPoints = null;
this.averageGaugingsCreator.SeparateGaugingPoints(steelThicknessGaugingPoints, plane, out backGaugingPoints, out frontGaugingPoints);
SortedList<int, List<SteelThicknessGaugingPoint>> backOrganizedGaugingPoints = this.OrganizeIACSGaugingPointsByID(backGaugingPoints);
SortedList<int, List<SteelThicknessGaugingPoint>> frontOrganizedGaugingPoints = this.OrganizeIACSGaugingPointsByID(frontGaugingPoints);
#region Clone gauging points that only exists in source side, and copy to target side
List<SteelThicknessGaugingPoint> pointsToBeDeleted = new List<SteelThicknessGaugingPoint>();
//.........这里部分代码省略.........
示例2: GetSectionElementsVisibleInSketch
private List<SectionElement> GetSectionElementsVisibleInSketch(Section section, List<SteelThicknessGaugingPoint> steelThicknessGaugingPoints)
{
try
{
Vector3D planeNormal = section.Normal * section.Up;
List<SectionElement> sectionElements = new List<SectionElement>();
if (section.SectionType.Name.Equals("WebFrames") ||
section.SectionType.Name.Equals("TransverseBulkheads") ||
section.SectionType.Name.Equals("TransverseCentralBulkheads") ||
section.SectionType.Name.Equals("SwashBulkheads"))
{
BoundingBox boundingBox = section.GetBoundingBoxOfElementType("Plate");
Plane plane = new Plane(planeNormal, boundingBox.Center);
int pointsSignal = plane.Signal(steelThicknessGaugingPoints[0].PointGeometry.Position);
pointsSignal = (pointsSignal == 1) ? pointsSignal : -1; // Avoid zero signal
SectionElementsSet sectionElementsSet = section.GetPermanentSectionElementsSet("Plate");
foreach (Plate plate in sectionElementsSet.Elements.Values)
{
int plateSignal = plane.Signal(plate.Design.Geometry.Primitive(0).Centroid);
if (plateSignal == pointsSignal)
{
sectionElements.Add(plate);
}
}
}
//else if (section.SectionType.Name.Equals("MainDeck") ||
// section.SectionType.Name.Equals("OtherDecks") ||
// section.SectionType.Name.Equals("InnerBottom") ||
// section.SectionType.Name.Equals("Bottom")
// )
//{
//}
//else if (section.SectionType.Name.Equals("Shell") ||
// section.SectionType.Name.Equals("Longitudinal") ||
// section.SectionType.Name.Equals("LongitudinalBulkheads") ||
// section.SectionType.Name.Equals("LongitudinalCentralBulkheads")
// )
//{
//}
//else if (section.SectionType.Name.Equals("AnyOtherSection"))
else
{
float xMin = float.MaxValue, xMax = float.MinValue;
float yMin = float.MaxValue, yMax = float.MinValue;
float zMin = float.MaxValue, zMax = float.MinValue;
float increase = 0;
BoundingBox sectionBoundingBox = section.GetBoundingBoxOfElementType("Plate");
char[] sortAxisLabels = sectionBoundingBox.GetSizeOrderedAxisLabels();
if (sortAxisLabels[0] == 'X')
{
increase = sectionBoundingBox.Width / 10;
}
else if (sortAxisLabels[0] == 'Y')
{
increase = sectionBoundingBox.Height / 10;
}
else if (sortAxisLabels[0] == 'Z')
{
increase = sectionBoundingBox.Depth / 10;
}
foreach (SteelThicknessGaugingPoint steelThicknessGaugingPoint in steelThicknessGaugingPoints)
{
Point3D point = steelThicknessGaugingPoint.PointGeometry.Position;
xMin = ((point.X - increase) < xMin) ? (point.X - increase) : xMin;
xMax = ((point.X + increase) > xMax) ? (point.X + increase) : xMax;
yMin = ((point.Y - increase) < yMin) ? (point.Y - increase) : yMin;
yMax = ((point.Y + increase) > yMax) ? (point.Y + increase) : yMax;
zMin = ((point.Z - increase) < zMin) ? (point.Z - increase) : zMin;
zMax = ((point.Z + increase) > zMax) ? (point.Z + increase) : zMax;
}
Point3D minPoint = new Point3D(xMin, yMin, zMin);
Point3D maxPoint = new Point3D(xMax, yMax, zMax);
Plane minPlane = new Plane(planeNormal, minPoint);
Plane maxPlane = new Plane(planeNormal, maxPoint);
return this.GetSectionElementsVisibleInSketch(section, minPlane, maxPlane);
//SectionElementsSet sectionElementsSet = section.GetSectionElementsSet("Plate");
//foreach (Plate plate in sectionElementsSet.Elements.Values)
//{
// Point3D point = plate.Design.Geometry.Primitive(0).Centroid;
// if (minPlane.Signal(point) == 1 && maxPlane.Signal(point) == -1)
// {
// sectionElements.Add(plate);
// }
//}
}
//.........这里部分代码省略.........