public void Initialize() { // Register custom osnap on initialize _mode = new CustomObjectSnapMode( "Quarter", "Quarter", "Quarter of length", _glyph ); // Which kind of entity will use the osnap _mode.ApplyToEntityType( RXObject.GetClass(typeof(Polyline)), new AddObjectSnapInfo(_info.SnapInfoPolyline) ); _mode.ApplyToEntityType( RXObject.GetClass(typeof(Curve)), new AddObjectSnapInfo(_info.SnapInfoCurve) ); _mode.ApplyToEntityType( RXObject.GetClass(typeof(Entity)), new AddObjectSnapInfo(_info.SnapInfoEntity) ); // Activate the osnap CustomObjectSnapMode.Activate("_Quarter"); }
public void StartSnap() { //创建自定义对象捕捉模式 CustomObjectSnapMode mode = new CustomObjectSnapMode("third", "_third", "三分之一", new ThirdGlyph()); //捕捉模式的实体类型为曲线 mode.ApplyToEntityType(RXClass.GetClass(typeof(Curve)), CurveSnap); //开启自定义对象捕捉模式 CustomObjectSnapMode.Activate("_third"); }
public void Initialize() { _mode = new CustomObjectSnapMode("Quarter", "Quarter", "Quarter of length", _glyph); _mode.ApplyToEntityType(RXObject.GetClass(typeof(Polyline)), new AddObjectSnapInfo(_info.SnapInfoPolyline)); _mode.ApplyToEntityType(RXObject.GetClass(typeof(Curve)), new AddObjectSnapInfo(_info.SnapInfoCurve)); _mode.ApplyToEntityType(RXObject.GetClass(typeof(Entity)), new AddObjectSnapInfo(_info.SnapInfoEntity)); CustomObjectSnapMode.Activate("_Quarter"); }