private WorkspaceTypes_e GetWorkspace(MacroScope_e scope) { WorkspaceTypes_e workspace = 0; if (scope.HasFlag(MacroScope_e.Application)) { workspace |= WorkspaceTypes_e.NoDocuments; } if (scope.HasFlag(MacroScope_e.Part)) { workspace |= WorkspaceTypes_e.Part; } if (scope.HasFlag(MacroScope_e.Assembly)) { workspace |= WorkspaceTypes_e.Assembly; } if (scope.HasFlag(MacroScope_e.Drawing)) { workspace |= WorkspaceTypes_e.Drawing; } return(workspace); }
public static bool IsInScope(this MacroScope_e scope, IXApplication app) { if (app.Documents.Active == null && scope.HasFlag(MacroScope_e.Application)) { return(true); } else if (app.Documents.Active is IXPart && scope.HasFlag(MacroScope_e.Part)) { return(true); } else if (app.Documents.Active is IXAssembly && scope.HasFlag(MacroScope_e.Assembly)) { return(true); } else if (app.Documents.Active is IXDrawing && scope.HasFlag(MacroScope_e.Drawing)) { return(true); } return(false); }
public static bool IsInScope(this MacroScope_e scope, ISldWorks app) { if (app.IActiveDoc2 == null && scope.HasFlag(MacroScope_e.Application)) { return(true); } else if (app.IActiveDoc2 is IPartDoc && scope.HasFlag(MacroScope_e.Part)) { return(true); } else if (app.IActiveDoc2 is IAssemblyDoc && scope.HasFlag(MacroScope_e.Assembly)) { return(true); } else if (app.IActiveDoc2 is IDrawingDoc && scope.HasFlag(MacroScope_e.Drawing)) { return(true); } return(false); }