You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Friends, I broke my brain. How do I draw the surface of the cylinder (like in picture 1)?
I only succeed (Figure 2). The code is simple, but I don’t understand what doesn’t work. Maybe there are working examples of how to do this for IFC4 C # ?
static void Main(string[] args)
{
var db = new DatabaseIfc(ModelView.Ifc4DesignTransfer);
var site = new IfcSite(db, "Simple Site");
var project = new IfcProject(site, "Simple Project", IfcUnitAssignment.Length.Metre) { };
var building = new IfcBuilding(site, "Simple Building") { };
var buildingStorey = new IfcBuildingStorey(building, "Simple Storey", 0);
var material = new IfcMaterial(db, "Steel");
var relAssMaterial = new IfcRelAssociatesMaterial(material);
var geometricRepresentationContext = new IfcGeometricRepresentationContext(3, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0)));
IfcCircleProfileDef circle = new IfcCircleProfileDef(db, "Cone", 40);
IfcExtrudedAreaSolid extrudedAreaSolid = new IfcExtrudedAreaSolid(circle, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0 )), new IfcDirection(db, 0, 0, 1), 20);
IfcSurfaceOfLinearExtrusion surfaceLinearExtrusion = new IfcSurfaceOfLinearExtrusion(extrudedAreaSolid.SweptArea, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0)), 20);
// boundaries
IfcEllipse arc1 = new IfcEllipse(new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0)), 40, 40);
IfcTrimmedCurve trimmedArc1 = new IfcTrimmedCurve(arc1, new IfcTrimmingSelect(new IfcCartesianPoint(db, 40,0, 0)), new IfcTrimmingSelect(new IfcCartesianPoint(db, -40, 0, 0)), true, IfcTrimmingPreference.CARTESIAN);
IfcLine line1 = new IfcLine(new IfcCartesianPoint(db, -40,0,0), new IfcVector(new IfcDirection(db, 0, 0, 1), 0));
IfcTrimmedCurve trimmedLine1 = new IfcTrimmedCurve(line1, new IfcTrimmingSelect(0), new IfcTrimmingSelect(20), true, IfcTrimmingPreference.PARAMETER);
IfcEllipse arc2 = new IfcEllipse(new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 20)), 40, 40);
IfcTrimmedCurve trimmedArc2 = new IfcTrimmedCurve(arc2, new IfcTrimmingSelect(new IfcCartesianPoint(db, -40, 0, 20)), new IfcTrimmingSelect(new IfcCartesianPoint(db, 40, 0, 20)), false, IfcTrimmingPreference.CARTESIAN);
IfcLine line2 = new IfcLine(new IfcCartesianPoint(db, 40, 0, 20), new IfcVector(new IfcDirection(db, 0, 0, -1), 0));
IfcTrimmedCurve trimmedLine2 = new IfcTrimmedCurve(line2, new IfcTrimmingSelect(0), new IfcTrimmingSelect(20), true, IfcTrimmingPreference.PARAMETER);
var segments = new List<IfcCompositeCurveSegment>();
segments.Add(new IfcCompositeCurveSegment(IfcTransitionCode.CONTINUOUS, true, trimmedArc1));
segments.Add(new IfcCompositeCurveSegment(IfcTransitionCode.CONTINUOUS, true, trimmedLine1));
segments.Add(new IfcCompositeCurveSegment(IfcTransitionCode.CONTINUOUS, true, trimmedArc2));
segments.Add(new IfcCompositeCurveSegment(IfcTransitionCode.CONTINUOUS, true, trimmedLine2));
IfcCompositeCurve finalCurve = new IfcCompositeCurve(segments);
List<IfcFaceBound> bounds = new List<IfcFaceBound>();
IfcEdgeCurve edgeCurve = new IfcEdgeCurve(new IfcVertexPoint(new IfcCartesianPoint(db, 0, 0, 0)),
new IfcVertexPoint(new IfcCartesianPoint(db, 0, 0, 0)),
finalCurve,
true);
bounds.Add(new IfcFaceBound(new IfcEdgeLoop(new IfcOrientedEdge(edgeCurve, true)), true));
IfcFaceSurface faceSurface = new IfcFaceSurface(bounds, surfaceLinearExtrusion, true);
var brep = new IfcFacetedBrep(new IfcClosedShell(new List<IfcFace> { faceSurface }));
IfcProductDefinitionShape rep = new IfcProductDefinitionShape(new List<IfcShapeRepresentation>() { new IfcShapeRepresentation(brep),new IfcShapeRepresentation(finalCurve) });
IfcBuildingElementProxy buildingElementProxy = new IfcBuildingElementProxy(buildingStorey, new IfcLocalPlacement(new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0))), rep);
db.WriteFile("C:\\testoBrep.ifc");static void Main(string[] args);
}
The text was updated successfully, but these errors were encountered:
Friends, I broke my brain. How do I draw the surface of the cylinder (like in picture 1)?
I only succeed (Figure 2). The code is simple, but I don’t understand what doesn’t work. Maybe there are working examples of how to do this for IFC4 C # ?
The text was updated successfully, but these errors were encountered: