private bool rotateOrg(bool openDraw) { if (selectedObjectsList == null || selectedObjectsList.Count == 0) { return(false); } IGeoObject selectedObject = null; blk = Block.Construct(); // as feedback object if (base.ActiveObject != null) { blk.CopyAttributes(base.ActiveObject); } // der block wird das neue aktive Objekt, er muss die Attribute tragen, weil sie später // wieder von ihm verlangt werden Boolean success = false; GeoPoint axisPointSav = axisPoint; GeoVector axisVectorSav = axisVector; updateOptional(); if (selectedObjectsList.Count > 1) { // maybe there are several curves in the list, then we try to make a path // and use only this path. No mixture of faces and paths possible List <ICurve> crvs = new List <ICurve>(); for (int i = 0; i < selectedObjectsList.Count; i++) { if (selectedObjectsList[i] is ICurve crv) { crvs.Add(crv); } } if (crvs.Count > 1) { Path path = Path.FromSegments(crvs, false); if (path != null) { selectedObjectsList.Clear(); selectedObjectsList.Add(path); } } } for (int i = 0; i < selectedObjectsList.Count; i++) { IGeoObject objectToRotate = null; // lokaler Merker geoObjectOrgList[i] = selectedObject; // zum Weglöschen des Originals in onDone selectedObject = selectedObjectsList[i]; ownerList[i] = selectedObject.Owner; // owner merken für löschen pathCreatedFromModelList[i] = null; shapeList[i] = null; if ((selectedObject is Face) || (selectedObject is Shell)) { // nur kopieren objectToRotate = selectedObject.Clone(); } else { if (selectedObject is ICurve selCurve) { Path p = null; if (!selCurve.IsClosed) { // trying to rotate an open curve: if the axis and the curve have a commonn plane close a path with the perpendicular foot points and axis segment Line axisLine = Line.TwoPoints(axisPoint, axisPoint + axisVector); if (Curves.GetCommonPlane(new ICurve[] { selCurve, axisLine }, out Plane commonPlane)) { Line l1 = Line.TwoPoints(selCurve.EndPoint, Geometry.DropPL(selCurve.EndPoint, axisPoint, axisVector)); Line l2 = Line.TwoPoints(Geometry.DropPL(selCurve.StartPoint, axisPoint, axisVector), selCurve.StartPoint); Line l3 = Line.TwoPoints(l1.EndPoint, l2.StartPoint); List <ICurve> closedPath = new List <ICurve>(); closedPath.Add(selCurve); if (l1.Length > Precision.eps) { closedPath.Add(l1); } if (l3.Length > Precision.eps) { closedPath.Add(l3); } if (l2.Length > Precision.eps) { closedPath.Add(l2); } p = Path.FromSegments(closedPath, true); // should always work p.Flatten(); } } else { p = Path.FromSegments(new ICurve[] { selCurve }, true); } if (p == null) { continue; // no path constructed } if ((p as ICurve).GetSelfIntersections().Length > 0) { continue; // not possible } if (!p.IsClosed) { continue; } // make a face from the closed pathe objectToRotate = Make3D.MakeFace(p, Frame.Project, true); } } if (objectToRotate != null) { // also was geeignetes dabei //if (angleOffsetRotation != 0.0) //{ // ModOp m = ModOp.Rotate(axisPoint, axisVector, new SweepAngle(angleOffsetRotation)); // iGeoObjectTemp.Modify(m); //} double sw = angleRotation; if (sw == 0.0) { sw = Math.PI * 2.0; } // IGeoObject shape = Make3D.MakeRevolution(iGeoObjectTemp, axisPoint, axisVector, sw, Frame.Project); IGeoObject shape = Make3D.Rotate(objectToRotate, new Axis(axisPoint, axisVector), sw, angleOffsetRotation, Frame.Project); if (shape != null) { shape.CopyAttributes(blk); shapeList[i] = shape; // fertiger Körper in shapeList blk.Add(shape); // resulting object base.FeedBack.AddSelected(objectToRotate); // zum Markieren des Ursprungsobjekts success = true; } } } axisPoint = axisPointSav; // im Fall nicht geschlossener Pfad und nichts bestimmt, werden diese Parameter oben verstellt axisVector = axisVectorSav; if (success) { base.ActiveObject = blk; // darstellen base.ShowActiveObject = true; return(true); } else { updateOptional(); base.ShowActiveObject = false; base.FeedBack.ClearSelected(); return(false); } }