/// <summary> /// Replaces existing macro feature with a new one preserving the parameters /// </summary> /// <typeparam name="TMacroFeature">Type of macro feature</typeparam> /// <param name="featMgr">Pointer to feature manager</param> /// <param name="feat">Pointer to feature to replace</param> /// <returns>Ne replaced feature</returns> public static IFeature ReplaceComFeature <TMacroFeature>(this IFeatureManager featMgr, IFeature feat) where TMacroFeature : MacroFeatureEx { if (feat == null) { throw new ArgumentNullException(nameof(feat)); } var featData = feat.GetDefinition() as IMacroFeatureData; if (featData == null) { throw new NullReferenceException("Specified feature not a macro feature"); } var model = featMgr.Document; object parameters = null; if (typeof(TMacroFeature).IsAssignableToGenericType(typeof(MacroFeatureEx <>))) { featData.AccessSelections(model, null); var paramsType = typeof(TMacroFeature).GetArgumentsOfGenericType(typeof(MacroFeatureEx <>)).First(); IDisplayDimension[] dispDims; IBody2[] editBodies; MacroFeatureOutdateState_e state; string[] dispDimParams; parameters = m_ParamsParser.GetParameters(feat, featData, model, paramsType, out dispDims, out dispDimParams, out editBodies, out state); MacroFeatureParametersParser.ReleaseDisplayDimensions(dispDims); } return(featMgr.ReplaceComFeatureBase <TMacroFeature>(feat, parameters)); }
private SwMacroFeature <TParams> ToParameters <TParams>(MacroFeatureParametersParser paramsParser) where TParams : class, new() { return(new SwMacroFeature <TParams>(m_Doc, m_FeatMgr, Feature, paramsParser, IsCommitted)); }
/// <summary> /// Base constructor. Should be called from the derived class as it contains required initialization /// </summary> public MacroFeatureEx() { m_ParamsParser = new MacroFeatureParametersParser(this.GetType()); }
internal SwFeatureManager(SwDocument doc) { Document = doc; m_ParamsParser = new MacroFeatureParametersParser(doc.App.Sw); }
internal SwMacroFeature <TParams> ToParameters <TParams>(MacroFeatureParametersParser paramsParser) where TParams : class, new() { return(new SwMacroFeature <TParams>(m_Model, m_FeatMgr, Feature, paramsParser, IsCreated)); }
internal SwFeatureManager(SwDocument model, IFeatureManager featMgr, ISldWorks app) { m_Model = model; m_ParamsParser = new MacroFeatureParametersParser(app); m_FeatMgr = featMgr; }
static FeatureManagerEx() { m_ParamsParser = new MacroFeatureParametersParser(); m_App = Context.CurrentApp; }
internal SwFeatureManager(SwDocument doc, ISwApplication app) { m_App = app; Document = doc; m_ParamsParser = new MacroFeatureParametersParser(app); }
static MacroFeatureDataEx() { m_ParamsParser = new MacroFeatureParametersParser(); }