- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
In my dwg I have blockrefrences entities that contains n nested blockreferences. For example a chair block and its nested blocks: arms, legs, back, etc.
My program cycles over each nestest block and change the scale factors.
The problem is that I need to change view to see the changes.
I try to use QueueForGraphicsFlush with no result.
Thank you
This is my sample code:
[CommandMethod("scalanestedblocks", CommandFlags.Transparent)] public void scalanestedblocks() { Document d = ACAP.Application.DocumentManager.MdiActiveDocument; Editor ed = d.Editor; var per = ed.GetEntity("Select blockreference:"); if (per.Status == PromptStatus.OK) { using (Transaction tr = d.TransactionManager.StartTransaction()) { BlockReference mainBlockRef = tr.GetObject(per.ObjectId, OpenMode.ForWrite) as BlockReference; if (mainBlockRef == null) return; BlockTableRecord mainBTR = tr.GetObject(mainBlockRef.BlockTableRecord, OpenMode.ForWrite) as BlockTableRecord; if (mainBTR == null) return; ed.WriteMessage("Main block ref: " + mainBTR.Name + Environment.NewLine); foreach (ObjectId nestedBlokRefId in mainBTR) { BlockReference nestedBlockRef = tr.GetObject(nestedBlokRefId, OpenMode.ForWrite) as BlockReference; if (nestedBlockRef == null) continue; ed.WriteMessage(" +--- Nested block ref: " + nestedBlockRef.Name + Environment.NewLine); if (nestedBlockRef.ScaleFactors.X < 1.5) nestedBlockRef.ScaleFactors = new Scale3d(2, 2, 2); else nestedBlockRef.ScaleFactors = new Scale3d(1, 1, 1); } d.TransactionManager.QueueForGraphicsFlush(); d.TransactionManager.FlushGraphics(); tr.Commit(); } } }
Solved! Go to Solution.
Link copied