// Property sets public static bool AddStairPropertySetToSolid(Solid3d sol) { bool result = false; Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; ObjectId psdId = GetPropertySetDefinitionIdByName(MyPlugin.psdName); // Create property set definition if not existing if (psdId == ObjectId.Null) { MyFunctions.CreateStairPropertySetDefinition(MyPlugin.psdName); ed.WriteMessage("\n Property set defenition ALCStairSolid created"); } using (Transaction tr = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction()) { try { Autodesk.AutoCAD.DatabaseServices.DBObject dbobj = tr.GetObject(sol.Id, OpenMode.ForWrite); PropertyDataServices.AddPropertySet(dbobj, psdId); result = true; } catch { result = false; ed.WriteMessage("\n AddStairPropertySetToSolid function failed"); } tr.Commit(); return(result); } }
// private static DrawableOverruleStair overruleALCSolidStair = null; void IExtensionApplication.Initialize() { // Check StairParameterSetDefinition exist ObjectId psdId = MyFunctions.GetPropertySetDefinitionIdByName(psdName); if (psdId == ObjectId.Null) { MyFunctions.CreateStairPropertySetDefinition(MyPlugin.psdName); ed.WriteMessage("\n Property set defenition {0} created", psdName); } //if (overruleALCSolidStair == null) //{ // overruleALCSolidStair = new DrawableOverruleStair(); // Overrule.AddOverrule(RXClass.GetClass(typeof(Solid3d)), overruleALCSolidStair, false); // //This is required in order for IsApplicable() being used as custom overrule filter // overruleALCSolidStair.SetCustomFilter(); // Overrule.Overruling = true; //} //// Regen is required to update changes on screen //Application.DocumentManager.MdiActiveDocument.Editor.Regen(); }