XbimEssentials icon indicating copy to clipboard operation
XbimEssentials copied to clipboard

IfcTrimmedCurve problem

Open GoTryCatch opened this issue 4 years ago • 1 comments

Hi everyone! I faced the following problem! May be it is bug? I draw trimmed curve IFC4 (arc of ellipse from 0 to 15 degree (Math.Pi/12)) Initial data: Ellipse (40x20) in original point (0,0,0). I counted the desired point on the ellipse (15degree or Math.PI/12) and know its coordinates. But the result is not correct.. arc does not reach the desired point. Why is this happening?

Assemblies and versions affected:

Last version XBIM.Essentials

Steps (or code) to reproduce the issue:

var ellipse = CreateEllipse(model, 0, 0, 0, 0, 0, 1, 40, 20);
var trimmedEllipse = CreateTrimmedCurve(model, ellipse, 0, Math.PI/12);

private static IfcEllipse CreateEllipse(IfcStore model, double centerX, double centerY, double centerZ, double directionX, double directionY, double directionZ, double major, double minor)
        {
            using (var txn = model.BeginTransaction("Create Ellipse"))
            {
                var ifcEllipse = model.Instances.New<IfcEllipse>(p => { p.Position = model.Instances.New<IfcAxis2Placement3D>(a => { a.Location = model.Instances.New<IfcCartesianPoint>(c => c.SetXYZ(centerX, centerY, centerZ));a.RefDirection = model.Instances.New<IfcDirection>(d => d.SetXYZ(1, 0, 0)); a.Axis = model.Instances.New<IfcDirection>(d => d.SetXYZ(directionX, directionY, directionZ)); }); p.SemiAxis1 = major; p.SemiAxis2 = minor; });
                txn.Commit();
                return ifcEllipse;
            }
        }

 private static IfcTrimmedCurve CreateTrimmedCurve(IfcStore model, IfcEllipse ellipse, double start, double end)
        {
            using (var txn = model.BeginTransaction("Create TrimmedCurve"))
            {
                var ifcTrimmedCurve = model.Instances.New<IfcTrimmedCurve>(t => { t.BasisCurve = ellipse; t.Trim1.Add(new IfcParameterValue(start)); t.Trim2.Add(new IfcParameterValue(end)); t.MasterRepresentation = IfcTrimmingPreference.PARAMETER; t.SenseAgreement = true; });
                txn.Commit();
                return ifcTrimmedCurve;
            }
        }

144557605-087fe965-885d-41de-95f9-fcc7801ecbd9

GoTryCatch avatar Dec 03 '21 07:12 GoTryCatch

May be related to https://github.com/xBimTeam/XbimGeometry/issues/447

ChernyshevDS avatar Sep 20 '23 15:09 ChernyshevDS