//Shows the beam's extremes in the coordinates of the reference model object private void ShowExtremesInOtherObjectCoordinates(ModelObject ReferenceObject, Beam Beam) { //Set the transformation plane to use the beam's coordinate system in order to get the beam's extremes in the local coordinate system TransformationPlane CurrentTP = _Model.GetWorkPlaneHandler().GetCurrentTransformationPlane(); _Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(Beam.GetCoordinateSystem())); //Update the beam's extremes to the new transformation plane Beam.Select(); T3D.Point LocalStartPoint = Beam.StartPoint; T3D.Point LocalEndPoint = Beam.EndPoint; //Get the beam's extremes in the reference object's coordinates Matrix TransformationMatrix = MatrixFactory.ByCoordinateSystems(Beam.GetCoordinateSystem(), ReferenceObject.GetCoordinateSystem()); //Transform the extreme points to the new coordinate system T3D.Point BeamStartPoint = TransformationMatrix.Transform(LocalStartPoint); T3D.Point BeamEndPoint = TransformationMatrix.Transform(LocalEndPoint); _Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(CurrentTP); //Transform the points where to show the texts to current work plane coordinate system Matrix TransformationToCurrent = MatrixFactory.FromCoordinateSystem(ReferenceObject.GetCoordinateSystem()); T3D.Point BeamStartPointInCurrent = TransformationToCurrent.Transform(BeamStartPoint); T3D.Point BeamEndPointInCurrent = TransformationToCurrent.Transform(BeamEndPoint); //Display results DrawCoordinateSytem(ReferenceObject.GetCoordinateSystem()); GraphicsDrawer.DrawText(BeamStartPointInCurrent, FormatPointCoordinates(BeamStartPoint), TextColor); GraphicsDrawer.DrawText(BeamEndPointInCurrent, FormatPointCoordinates(BeamEndPoint), TextColor); }
public void CK07_Column() { // Create Column after Pick a Point of this column T3D.Point FirstPoint = null; Picker Picker = new Picker(); try { ArrayList PickedPoints = Picker.PickPoints(Picker.PickPointEnum.PICK_ONE_POINT); FirstPoint = PickedPoints[0] as T3D.Point; } catch { FirstPoint = null; } if (FirstPoint != null) { T3D.Point SecondPoint = new T3D.Point(FirstPoint.X, FirstPoint.Y, FirstPoint.Z + 8000); Beam ThisBeam = CreateBeam("MyColumn", mw.prfStr, FirstPoint, SecondPoint); ThisBeam.Finish = "D"; ThisBeam.Class = "7"; ThisBeam.AssemblyNumber.Prefix = "C"; ThisBeam.AssemblyNumber.StartNumber = 1; ThisBeam.Position.Depth = Position.DepthEnum.MIDDLE; ThisBeam.Position.Plane = Position.PlaneEnum.MIDDLE; ThisBeam.Position.Rotation = Position.RotationEnum.TOP; ThisBeam.Modify(); //ThisBeam.SetUserProperty("USER_FIELD_1", "PEOPLE"); //string UserField = ""; //ThisBeam.GetUserProperty("USER_FIELD_1", ref UserField); //Solid BeamSolid = ThisBeam.GetSolid(); T3D.CoordinateSystem BeamCoordinateSystem = ThisBeam.GetCoordinateSystem(); Assembly BeamAssembly = ThisBeam.GetAssembly(); ModelObjectEnumerator BeamsBolt = ThisBeam.GetBolts(); ReperShow(BeamCoordinateSystem); Model.CommitChanges(); Matrix FromColumnSystem = MatrixFactory.FromCoordinateSystem(ThisBeam.GetCoordinateSystem()); T3D.Point FrontFacePoint = FromColumnSystem.Transform(new T3D.Point(50, 50, 500)); GraphicsDrawer Drawer = new GraphicsDrawer(); // Label for Front Face var label = new Color(0, 0, 0); Drawer.DrawLineSegment(new LineSegment(FirstPoint, FrontFacePoint), label); Drawer.DrawText(FrontFacePoint, "THIS IS FRONT FACE", label); mw.Msg("В выбранной точке создается колонна с осью Х ПСК, направленой вверх." + " Профиль колонны как в поле TextBox выше. Черная надпись показывает" + " переднюю грань. [ОК]"); MessageBox.Show("Создал колонну и вывел репер, указал переднюю грань"); mw.Msg(); } }
/// <summary> /// Transforms a given polycurve in the local coordsys to global. /// </summary> /// <param name="curveInLocal">Curve in local coordinates.</param> /// <returns>The transformed polycurve in global coordinates.</returns> private Polycurve TransformToGlobal(Polycurve curveInLocal) { var coordSys = GetBaseCoordsys(this.BaseCentroid, this.Normal); var toGlobal = MatrixFactory.FromCoordinateSystem(coordSys); var transformedCurves = curveInLocal.Select(c => TransformGeometryByMatrix(c, toGlobal)); var builder = new PolycurveGeometryBuilder(); foreach (var curve in transformedCurves) { if (curve is Arc arc) { builder.Append(arc); } else if (curve is LineSegment segment) { builder.Append(segment); } } return(builder.GetPolycurve()); }
public static Matrix MatrixToGlobal(this CoordinateSystem cs) { return(MatrixFactory.FromCoordinateSystem(cs)); }