protected override MacroFeatureRebuildResult OnRebuild(ISldWorks app, IModelDoc2 model, IFeature feature) { var body = app.IGetModeler().CreateBox(new Point(0.1, 0.2, 0.3), new Vector(0, 0, 1), 0.1, 0.2, 0.3); return(MacroFeatureRebuildResult.FromBody(body, feature.GetDefinition() as IMacroFeatureData)); }
protected override MacroFeatureRebuildResult OnRebuild(ISldWorks app, IModelDoc2 model, IFeature feature, RoundStockFeatureParameters parameters) { var cylParams = GetCylinderParams(model, parameters); //temp SetProperties(model, parameters, cylParams); // parameters.Height = cylParams.Height; parameters.Radius = cylParams.Radius; var featData = feature.GetDefinition() as IMacroFeatureData; MacroFeatureOutdateState_e state; SetParameters(model, feature, featData, parameters, out state); if (state != MacroFeatureOutdateState_e.UpToDate) { app.ShowBubbleTooltip("Stock Master", $"'{feature.Name}' feature is outdated. Edit definition of the feature to update", BubbleTooltipPosition_e.TopLeft, Resources.warning_icon); } if (parameters.CreateSolidBody) { var body = m_StockModel.CreateCylindricalStock(cylParams); return(MacroFeatureRebuildResult.FromBody(body, feature.GetDefinition() as IMacroFeatureData)); } else { return(MacroFeatureRebuildResult.FromStatus(true)); } }
protected override MacroFeatureRebuildResult OnRebuild(ISldWorks app, IModelDoc2 model, IFeature feature) { //use extension methods of IModeler to create a box body IBody2 tempBody = app.IGetModeler().CreateBox(new Point(0, 0, 0), new Vector(1, 0, 0), 0.1, 0.1, 0.1); return(MacroFeatureRebuildResult.FromBody(tempBody, feature.GetDefinition() as IMacroFeatureData, false)); }
protected override MacroFeatureRebuildResult OnRebuild(ISldWorks app, IModelDoc2 model, IFeature feature, BoundingCylinderMacroFeatureParams parameters) { var modeler = app.IGetModeler(); Point center; Vector axis; double radius; double height; double extraHeight; GetCylinderParameters(parameters, out center, out axis, out radius, out height, out extraHeight); var cyl = modeler.CreateCylinder(center, axis, radius, height + extraHeight); return(MacroFeatureRebuildResult.FromBody(cyl, feature.GetDefinition() as IMacroFeatureData)); }