public static void ProfileInsertionPointSet(this IfcParameterizedProfileDef prof, IfcStore model, IfcCartesianPoint insertionPt) { IfcCartesianPoint insertionPoint = model.Instances.New <IfcCartesianPoint>(); insertionPoint.SetXYZ(insertionPt.X, insertionPt.Y, insertionPt.Z); prof.Position = model.Instances.New <IfcAxis2Placement2D>(); prof.Position.Location = insertionPoint; }
/// <summary> /// Convert an IfcParameterizedProfileDef to an ICurve /// </summary> /// <param name="profile"></param> /// <returns></returns> public static ICurve ToICurve(this IfcParameterizedProfileDef profile) { if (profile is IfcRectangleProfileDef) { var rect = (IfcRectangleProfileDef)profile; return(Polygon.Rectangle((IfcLengthMeasure)rect.XDim, (IfcLengthMeasure)rect.YDim, rect.Position.Location.ToVector3())); } else if (profile is IfcCircleProfileDef) { var circle = (IfcCircleProfileDef)profile; return(Polygon.Circle((IfcLengthMeasure)circle.Radius)); } else { throw new Exception($"The IfcParameterizedProfileDef type, {profile.GetType().Name}, is not supported."); } }
private static ICurve ToCurve(this IfcParameterizedProfileDef profile) { if (profile is IfcRectangleProfileDef) { var rect = (IfcRectangleProfileDef)profile; var p = Polygon.Rectangle((IfcLengthMeasure)rect.XDim, (IfcLengthMeasure)rect.YDim); var t = new Transform(rect.Position.Location.ToVector3()); return(t.OfPolygon(p)); } else if (profile is IfcCircleProfileDef) { var circle = (IfcCircleProfileDef)profile; return(new Circle((IfcLengthMeasure)circle.Radius)); } else { throw new Exception($"The IfcParameterizedProfileDef type, {profile.GetType().Name}, is not supported."); } }
public static devDept.Eyeshot.Entities.Region getRegionFromIfcProfileDef(IfcProfileDef ipd, ViewportLayout viewportLayout1) { devDept.Eyeshot.Entities.Region region = null; if (ipd is IfcCircleProfileDef) { IfcCircleProfileDef crProfDef = (IfcCircleProfileDef)ipd; region = new CircularRegion(crProfDef.Radius); } else if (ipd is IfcIShapeProfileDef) // IfcIShapeProfileDef and all derived from { IfcIShapeProfileDef shProfDef = (IfcIShapeProfileDef)ipd; double halfWidth = shProfDef.OverallWidth / 2; double halfDepth = shProfDef.OverallDepth / 2; LinearPath lp = new LinearPath(Plane.XY, new Point2D(-halfWidth, -halfDepth), new Point2D(halfWidth, -halfDepth), new Point2D(halfWidth, -halfDepth + shProfDef.FlangeThickness), new Point2D(shProfDef.WebThickness / 2, -halfDepth + shProfDef.FlangeThickness), new Point2D(shProfDef.WebThickness / 2, +halfDepth - shProfDef.FlangeThickness), new Point2D(halfWidth, +halfDepth - shProfDef.FlangeThickness), new Point2D(halfWidth, halfDepth), new Point2D(-halfWidth, halfDepth), new Point2D(-halfWidth, halfDepth - shProfDef.FlangeThickness), new Point2D(-shProfDef.WebThickness / 2, halfDepth - shProfDef.FlangeThickness), new Point2D(-shProfDef.WebThickness / 2, -halfDepth + shProfDef.FlangeThickness), new Point2D(-halfWidth, -halfDepth + shProfDef.FlangeThickness), new Point2D(-halfWidth, -halfDepth) ); region = new devDept.Eyeshot.Entities.Region(lp); } else if (ipd is IfcRectangleProfileDef) { IfcRectangleProfileDef recProfDef = (IfcRectangleProfileDef)ipd; region = new RectangularRegion(recProfDef.XDim, recProfDef.YDim, true); } else if (ipd is IfcArbitraryClosedProfileDef) { IfcArbitraryClosedProfileDef arProfDef = (IfcArbitraryClosedProfileDef)ipd; ICurve cc = getICurveFromIfcCurve(arProfDef.OuterCurve); if (cc != null) { //foreach(Entity xx in cc.CurveList) // viewportLayout1.Entities.Add((Entity)xx.Clone(), 1); //viewportLayout1.Entities.Add((Entity)cc.Clone(), 2); region = new devDept.Eyeshot.Entities.Region(cc); } } else { if (!debug.Contains("IfcProfileDef not supported: " + ipd.KeyWord)) { debug += "IfcProfileDef not supported: " + ipd.KeyWord + "\n"; } } if (ipd is IfcParameterizedProfileDef) { IfcParameterizedProfileDef parProfDef = (IfcParameterizedProfileDef)ipd; if (parProfDef.Position != null && region != null) { Plane plane = getPlaneFromPosition(parProfDef.Position); Align3D algn = new Align3D(Plane.XY, plane); region.TransformBy(algn); //region.Translate(parProfDef.Position.Location.Coordinates.Item1, parProfDef.Position.Location.Coordinates.Item2, parProfDef.Position.Location.Coordinates.Item3); } } return(region); }