XCAD.NET
XCAD.NET
Framework for .NET (C# and VB.NET) to create modern application for CAD systems (SOLIDWORKS)
Get technical support Access source code Explore code and application examples

Handling the SOLIDWORKS macro feature state update in xCAD framework


This handler is called every time state of the feature is changed. It should be used to provide additional security for macro feature.

using System.Runtime.InteropServices;
using Xarial.XCad.Features.CustomFeature.Enums;
using Xarial.XCad.SolidWorks;
using Xarial.XCad.SolidWorks.Documents;
using Xarial.XCad.SolidWorks.Features.CustomFeature;

namespace Xarial.XCad.Documentation
{
    [ComVisible(true)]
    public class UpdateStateMacroFeature : SwMacroFeatureDefinition
    {
        public override CustomFeatureState_e OnUpdateState(ISwApplication app, ISwDocument model, ISwMacroFeature feature)
        {
            //disallow editing or suppressing of the feature
            return CustomFeatureState_e.CannotBeDeleted 
                | CustomFeatureState_e.CannotBeSuppressed;
        }
    }
}


Powered by Docify