/// <summary> /// Making a monitor screen in Inventor 2018 /// </summary> /// <param name="createBackFlag">Flag for back building. /// If true - create back of monitor with perforation</param> private void CreateScreen(bool createBackFlag) { // Create screen _api.MakeNewSketch(2, _modelParameters.StandParam.Height + _modelParameters.LegParam.Height); _api.DrawRectangle(-(_modelParameters.ScreenParam.Width / 2), _modelParameters.ScreenParam.Thikness / 2, _modelParameters.ScreenParam.Width / 2, -(_modelParameters.ScreenParam.Thikness / 2)); _api.Extrude(_modelParameters.ScreenParam.Height); // Matrix cutting _api.MakeNewSketch(3, _modelParameters.ScreenParam.Thikness / 2); double frameThikness = 10; _api.DrawRectangle(-(_modelParameters.ScreenParam.Width / 2) + frameThikness, _modelParameters.StandParam.Height + _modelParameters.LegParam.Height + _modelParameters.ScreenParam.Height - frameThikness, (_modelParameters.ScreenParam.Width / 2) - frameThikness, _modelParameters.StandParam.Height + _modelParameters.LegParam.Height + frameThikness); _api.CutOut(5, PartFeatureExtentDirectionEnum.kNegativeExtentDirection); //Сreate some buttons _api.MakeNewSketch(3, _modelParameters.ScreenParam.Thikness / 2); for (int i = 0; i <= 2; i++) { // Variables for buttons create double distanceFromBorderSide = 15; double distanceFromDownSide = 5; double distanceBetweenButtons = 5; double buttonsDiameter = 3; _api.DrawCircle(_modelParameters.ScreenParam.Width / 2 - (distanceFromBorderSide + distanceBetweenButtons * i), _modelParameters.StandParam.Height + _modelParameters.LegParam.Height + distanceFromDownSide, buttonsDiameter); } double buttonsThikness = 1; _api.Extrude(buttonsThikness); // Create back if (createBackFlag) { _api.MakeNewSketch(3, -(_modelParameters.ScreenParam.Thikness / 2)); _api.DrawRectangle(-(_modelParameters.ScreenParam.Width / 2), _modelParameters.StandParam.Height + _modelParameters.LegParam.Height + _modelParameters.ScreenParam.Height, _modelParameters.ScreenParam.Width / 2, _modelParameters.StandParam.Height + _modelParameters.LegParam.Height); _objCollection.Add(_api.CurrentSketch.Profiles.AddForSolid()); double backWidthAccess = 20; _api.MakeNewSketch(3, -(_modelParameters.ScreenParam.Thikness / 2) - backWidthAccess); _api.DrawRectangle(-(_modelParameters.ScreenParam.Width / 2) + frameThikness, _modelParameters.StandParam.Height + _modelParameters.LegParam.Height + _modelParameters.ScreenParam.Height - frameThikness, _modelParameters.ScreenParam.Width / 2 - frameThikness, _modelParameters.StandParam.Height + _modelParameters.LegParam.Height + frameThikness); _objCollection.Add(_api.CurrentSketch.Profiles.AddForSolid()); _api.Loft(_objCollection); _objCollection.Clear(); // Perforation cells width double cellsWidth = 2; // Distance between perforation cells double cellDistance = 2; // Number of perforation cells of perforation double backPerforationCount = Math.Floor((_modelParameters.ScreenParam.Width - backWidthAccess) / (cellsWidth + cellDistance)); //Create perforation cells _api.MakeNewSketch(3, -(_modelParameters.ScreenParam.Thikness / 2) - frameThikness * 2); for (int i = 0; i < backPerforationCount; i++) { _api.DrawRectangle(-(_modelParameters.ScreenParam.Width / 2) + frameThikness + 2 + i * 4, _modelParameters.StandParam.Height + _modelParameters.LegParam.Height + _modelParameters.ScreenParam.Height, -(_modelParameters.ScreenParam.Width / 2) + frameThikness + 4 + i * 4, _modelParameters.StandParam.Height + _modelParameters.LegParam.Height + _modelParameters.ScreenParam.Height - (0.3 * _modelParameters.ScreenParam.Height)); } _api.CutOut(9); } }