0 Members and 1 Guest are viewing this topic.
Add the line ' (vl-load-com) ' as the first line under the defun. That will load the ActiveX Arx, so that lisp can interact with ActiveX ( no matter how many times you call it, the arx will only be loaded once ). Sorry about that.
that works for the blocks IN the drawing, but what about the drawing itself? meaning, the file that gets inserted as a block needs the property set
Quote from: CmdrDuh on January 17, 2011, 08:23:53 AMthat works for the blocks IN the drawing, but what about the drawing itself? meaning, the file that gets inserted as a block needs the property setI tried it on drawing inserted and it worked.
what about setting the currentDrawing to explodable? I have hundreds of blocks I just inherited that need that property changed
[CommandMethod("ChangeCurrentDrawingExplodableProperty")] public void ChangeCurrentDrawingExplodableProperty() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; using (Transaction trx = db.TransactionManager.StartTransaction()) { BlockTableRecord msBtr = SymbolUtilityServices.GetBlockModelSpaceId(db).GetObject(OpenMode.ForWrite) as BlockTableRecord; msBtr.Explodable = !msBtr.Explodable; trx.Commit(); } doc.SendStringToExecute("QSAVE ", true, false, false); }
[CommandMethod("CEP")] public static void ChangeExplodableProperty() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; using (Transaction trx = db.TransactionManager.StartTransaction()) { BlockTable bt = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable; foreach (ObjectId objId in bt) { BlockTableRecord btr = (BlockTableRecord)objId.GetObject(OpenMode.ForRead); if (btr.Name == "*Model_Space") { ed.WriteMessage("\n" + btr.Name + " Explodable property is set to " + btr.Explodable.ToString()); btr.UpgradeOpen(); btr.Explodable = !btr.Explodable; ed.WriteMessage("\n" + btr.Name + " Explodable property has changed to " + btr.Explodable.ToString()); } } trx.Commit(); } }