I guess I'm putting the feelers out there to see what everyone else has done for this bug...
Has anyone figured out how to make Civil 3D 2014 reset with proper imperial scales? By default, with imperial units, we are getting architectural (inch) scales regardless of the "unit for length" selected.
If I modify the aecdwgunits to any different unit, it has no effect on the scalelist reset. The only way to switch from imperial to metric, or vise versa, is by switching the Toolspace->Drawing Settings->Drawing units dropdown. Unfortunately, the only 2 selections there are Feet and Meter.
So we have a choice of resetting Feet units to architectural scales, or Meter units to metric (mm per m) scales. And the aecdwgunits can be set to one of six choices, which will have no effect on the scales.
I've editted the registry keys to use correct scales with Feet, but if a user resets it from the Options dialog, it sets the registry back to architectural.
We used to force a reset of the scalelist at the opening of every dwg file - to get rid of the excess that autocad keeps in the dwg and to ensure we all use the same scale names and ratios. Now, it is pointless to reset to faulty scales, but I expect the scale numbers to start growing rapidly in all the shared drawings.....
Thanks.
Thanks Jeff,
I did see that in other posts....but I'm hoping to figure out a way to use "-scalelistedit" reset methods so we can put it in simple startup routines.
I'm working on .net code (amature as i am at it...) to reset the default scalelist after reading the drawing units (the aecdwgunits). So far I can get the aecdwgunits from the drawing and I can reset the scales based on feet or inch (yay), but I am trying to get it to work properly when metric units are applied. Oddly enough, my code will set the metric scales if I reset 'both Imperial & Metric'...so my code is like the opposite of autocad default (good for imperial, not good enough for metric). Still working on it though...
As long as my defaults are set, I only get those pre-defined scales when I reset to Imperial (plus any that can't be deleted because they are in use)
@rkmcswain wrote:
As long as my defaults are set, I only get those pre-defined scales when I reset to Imperial.
OK, I give up. I have tried to resolve this since C3D2012 without success. I've read all kinds of posts, edited things in the registry, and yet I still end up with the blasted architectural scales, every time. A step by step process to get this to work would be nice...and why, oh why, does it not 'just work' OOTB?
To answer your last questions first, I have no idea.
I really don't even understand how it was designed to work, or if it's even working as designed.
Having said that, I go to Options > User Preferences > Default Scale List -- and configure that as needed.
Then when I reset, I choose Imperial and voilà!
Sidebar: I made the mistake of xrefing a drawing of unknown origin into my main base drawing recently, and now every drawing in my project is infected with hundreds of bogus scale entries (that just happen to be architectural). Ugh.
OK, now I feel like a real NOOB....I have always assumed that editing that list would then make it so when hitting the Reset button on that same dialog would restore THAT list. Since it always resets it to the architectural I, again, assumed it was broken (it is, in the respect that it should be using the engineering scales, not the architectural. But that's a different story.) and investigated no further. However, if I just leave that one button alone and only reset the scalelist from scalelist edit, it works as described. Thanks for making me finally see the light!
haha, yeah those large numbers of bogus scales are why we used to force a scalelist reset when a drawing is opened.
And it works if we edit the default scales as you have shown, or edit the registry here: [HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.1\ACAD-D000:409\Scale List\Feet]. My biggest concern is that some departments in the company don't install a 'custom' set of scales, so a reset forced on them would be bad.
Also, if someone presses the scale 'reset' from within the options dialog, it will revert back to the original autocad scales. So for the forced scalelist reset to work, we would also need to verify that the default scalelist is not the actual 'autocad' default scalelist. Perhaps we can overwrite the registry each session to restore our corrected default scales....
Either way, I appreciate the input. Everything helps with brainstorming possible options to resolve the issue.
I wrote this script a couple years ago to combat this. It resets the default scale list for a user to a standard set. Now when the scales are reset, they get only the desired scales. Maybe others will find it useful.
(defun c:DefaultScaleList( / k n RegKey WriteKeys WriteStandardKeys )
(defun RegKey( n x / y )
(if (< n 10) (setq y " ") (setq y "") )
(cond
( (= x 4) (strcat y (itoa n) ".ScaleType") )
( (= x 1) (strcat y (itoa n) ".ScaleDrawingUnits") )
( (= x 2) (strcat y (itoa n) ".ScaleName") )
(T (strcat y (itoa n) ".ScalePaperUnits") )
)
)
(defun WriteKeys( k n v1 v2 v3 v4 / y )
(vl-registry-write k (RegKey n 1) v1)
(vl-registry-write k (RegKey n 2) v2)
(vl-registry-write k (RegKey n 3) v3)
(vl-registry-write k (RegKey n 4) v4)
(+ n 1)
)
(defun WriteStandardKeys( k n / o f tw wv )
(setq o "1.00000000" f "4" tw "2" wv "12.00000000")
; metric
(setq n (WriteKeys k n o "1:1_PageSetup" o "5") )
(setq n (WriteKeys k n "0.50000000" "1:500" o f) )
(setq n (WriteKeys k n o "1:1000" o f) )
(setq n (WriteKeys k n "0.00100000" "1:1" o f) )
(setq n (WriteKeys k n "0.00200000" "1:2" o f) )
(setq n (WriteKeys k n "0.00250000" "1:2.5" o f) )
(setq n (WriteKeys k n "0.00500000" "1:5" o f) )
(setq n (WriteKeys k n "0.00750000" "1:7.5" o f) )
(setq n (WriteKeys k n "0.01000000" "1:10" o f) )
(setq n (WriteKeys k n "0.02000000" "1:20" o f) )
(setq n (WriteKeys k n "0.02500000" "1:25" o f) )
(setq n (WriteKeys k n "0.05000000" "1:50" o f) )
(setq n (WriteKeys k n "0.07500000" "1:75" o f) )
(setq n (WriteKeys k n "0.10000000" "1:100" o f) )
(setq n (WriteKeys k n "0.15000000" "1:150" o f) )
(setq n (WriteKeys k n "0.20000000" "1:200" o f) )
(setq n (WriteKeys k n "0.25000000" "1:250" o f) )
(setq n (WriteKeys k n "0.75000000" "1:750" o f) )
(setq n (WriteKeys k n "1.25000000" "1:1250" o f) )
(setq n (WriteKeys k n "2.00000000" "1:2000" o f) )
(setq n (WriteKeys k n "2.50000000" "1:2500" o f) )
(setq n (WriteKeys k n "5.00000000" "1:5000" o f) )
; imperial
(setq n (WriteKeys k n o "1:1" o "3") )
(setq n (WriteKeys k n wv "1/128\" = 1'-0\"" "0.00781250" tw) )
(setq n (WriteKeys k n wv "1/64\" = 1'-0\"" "0.01562500" tw) )
(setq n (WriteKeys k n wv "1/32\" = 1'-0\"" "0.03125000" tw) )
(setq n (WriteKeys k n wv "1/16\" = 1'-0\"" "0.06250000" tw) )
(setq n (WriteKeys k n wv "3/32\" = 1'-0\"" "0.09375000" tw) )
(setq n (WriteKeys k n wv "1/8\" = 1'-0\"" "0.12500000" tw) )
(setq n (WriteKeys k n wv "3/16\" = 1'-0\"" "0.18750000" tw) )
(setq n (WriteKeys k n wv "1/4\" = 1'-0\"" "0.25000000" tw) )
(setq n (WriteKeys k n wv "3/8\" = 1'-0\"" "0.37500000" tw) )
(setq n (WriteKeys k n wv "1/2\" = 1'-0\"" "0.50000000" tw) )
(setq n (WriteKeys k n wv "3/4\" = 1'-0\"" "0.75000000" tw) )
(setq n (WriteKeys k n wv "1\" = 1'-0\"" o tw) )
(setq n (WriteKeys k n wv "1-1/2\" = 1'-0\"" "1.50000000" tw) )
(setq n (WriteKeys k n wv "3\" = 1'-0\"" "3.00000000" tw) )
(setq n (WriteKeys k n wv "6\" = 1'-0\"" "6.00000000" tw) )
(setq n (WriteKeys k n wv "1'-0\" = 1'-0\"" wv tw) )
)
(setq n 0 k (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Scale List") )
(if (vl-registry-read k) (vl-registry-delete k) )
(WriteStandardKeys k n)
(princ "\nDefault scale list applied.")
(princ)
)
(vl-load-com)
(princ)
Thanks to everyone for sharing info. I'll just add what I ended up with in vb.net for Civil 3d 2014, in case it helps anyone at all. Much of the code methods were originally shared by Kean Walmsley and BrentBurgess1980 (links shown below), so a big thank you to them. So far what I have is working very well to reset the scales. (I should note much of the code is just applying different scales for the various aecdwgunits as well as our different department preferences...most of that will rarely apply).
Thanks.
'purge scales and then add scales set by department preferences. 'NOTE: this is written for Civil 3D 2014! -aecdwgunits in autocad may differ. 'This function reads the aecdwgunit of the dwg and checks for a ' "department.scales" file to apply the correct scale list. ' note: actual content of the .scales file is irrelevant - scales are hard-coded here. 'If the .scales file is not found, "default" scales are applied. 'code examples provided by Kean Walmsley 'http://through-the-interface.typepad.com/through_the_interface/2008/05/deleting-unused.html 'http://through-the-interface.typepad.com/through_the_interface/2007/04/adding_a_new_an.html ' 'and BrentBurgess1980 on autodesk community forums 'https://forums.autodesk.com/t5/net/annotation-scale-sorting/td-p/3270357 ' Imports System Imports System.IO Imports System.Collections.Generic Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.ApplicationServices.Application Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.Geometry Imports Autodesk.AutoCAD.EditorInput Imports Autodesk.Civil.ApplicationServices <Assembly: CommandClass(GetType(Scales_ACDB.ScaleCommands))> Namespace Scales_ACDB Public Class ScaleCommands 'The main ScalesReset function works, but the scales in the .dwg are left unsorted. ' Running the function twice for some reason leaves them sorted in the ' order they are shown in this code. <CommandMethod("ScalesReset", CommandFlags.Modal)> _ Public Sub ScalesResetTwice() For i = 1 To 2 ScalesReset() Next End Sub Private Sub ScalesReset() 'check the user login support paths for any deparmental.scales file 'if not found, or path does not exist, default scales will apply. Dim users As String = "I:\lja-std\ACAD\2014\User_Customizations\" Dim userLogin As String = Environment.UserName Dim userPath As String = (users & userLogin & "\") Debug.WriteLine(userPath) 'set the department to default scales; otherwise set to departmental scales. 'the .scales file must reside in the user's customization file, or else the default will be applied. Dim userDepartment As String = "default" If File.Exists(userPath & "structural.scales") Then userDepartment = "structural" ElseIf File.Exists(userPath & "land.scales") Then userDepartment = "land" ElseIf File.Exists(userPath & "platting.scales") Then userDepartment = "platting" ElseIf File.Exists(userPath & "survey.scales") Then userDepartment = "survey" End If Dim acDoc As Document = DocumentManager.MdiActiveDocument Dim acDb As Database = acDoc.Database Dim acEd As Editor = acDoc.Editor 'the civil...drawingunits gives the integer of the -aecdwgunit selections!! yay!! 'note this integer is not the same as the command line selections. '4 of the 6 are undocumented in object browser, but will still return a specific integer. 'inch = 31 'feet = 30 'mm = 25 'cm = 24 'dm = 23 'm = 2 'tostring will return feet or meters; the others will only return the number regardless of .tostring Dim civilDoc As CivilDocument = CivilApplication.ActiveDocument Dim intDwgUnit As Integer = civilDoc.Settings.DrawingSettings.UnitZoneSettings.DrawingUnits Dim strDwgUnit As String = Nothing Select Case intDwgUnit Case 30 strDwgUnit = "Feet" Case 31 strDwgUnit = "Inches" Case 2 strDwgUnit = "Meters" Case 23 strDwgUnit = "Decimeters" Case 24 strDwgUnit = "Centimeters" Case 25 strDwgUnit = "Millimeters" End Select 'delete all unused scales if we recognize the aecdwgunits of the drawing. 'otherwise exit the sub. Select Case intDwgUnit Case 2, 23, 24, 25, 30, 31 ScalesPurge() Case Else 'if the aecdwgunits are not in the above list, exit the sub and notify the user. acEd.WriteMessage("-aecdwgunits unidentified by Scales-ACDB.dll. Scale reset aborted") Exit Sub End Select Dim divisor As Double = 1.0 Select Case intDwgUnit Case 2 'paper = mm; dwg = meters divisor = 1000.0 ScalesAdd("1:1", 1.0, 1.0 / divisor) ScalesAdd("1:2", 1.0, 2.0 / divisor) ScalesAdd("1:2.5", 1.0, 2.5 / divisor) ScalesAdd("1:5", 1.0, 5.0 / divisor) ScalesAdd("1:10", 1.0, 10.0 / divisor) ScalesAdd("1:20", 1.0, 20.0 / divisor) ScalesAdd("1:25", 1.0, 25.0 / divisor) ScalesAdd("1:50", 1.0, 50.0 / divisor) ScalesAdd("1:100", 1.0, 100.0 / divisor) ScalesAdd("1:200", 1.0, 200.0 / divisor) ScalesAdd("1:250", 1.0, 250.0 / divisor) ScalesAdd("1:500", 1.0, 500.0 / divisor) ScalesAdd("1:1000", 1.0, 1000.0 / divisor) ScalesAdd("1:2000", 1.0, 2000.0 / divisor) ScalesAdd("1:2500", 1.0, 2500.0 / divisor) ScalesAdd("1:5000", 1.0, 5000.0 / divisor) Case 23 'paper = mm; dwg = dm divisor = 100.0 ScalesAdd("1:1", 1.0, 1.0 / divisor) ScalesAdd("1:2", 1.0, 2.0 / divisor) ScalesAdd("1:2.5", 1.0, 2.5 / divisor) ScalesAdd("1:5", 1.0, 5.0 / divisor) ScalesAdd("1:10", 1.0, 10.0 / divisor) ScalesAdd("1:20", 1.0, 20.0 / divisor) ScalesAdd("1:25", 1.0, 25.0 / divisor) ScalesAdd("1:50", 1.0, 50.0 / divisor) ScalesAdd("1:100", 1.0, 100.0 / divisor) ScalesAdd("1:200", 1.0, 200.0 / divisor) ScalesAdd("1:250", 1.0, 250.0 / divisor) ScalesAdd("1:500", 1.0, 500.0 / divisor) ScalesAdd("1:1000", 1.0, 1000.0 / divisor) ScalesAdd("1:2000", 1.0, 2000.0 / divisor) ScalesAdd("1:2500", 1.0, 2500.0 / divisor) ScalesAdd("1:5000", 1.0, 5000.0 / divisor) Case 24 'paper = mm; dwg = cm divisor = 10.0 ScalesAdd("1:1", 1.0, 1.0 / divisor) ScalesAdd("1:2", 1.0, 2.0 / divisor) ScalesAdd("1:2.5", 1.0, 2.5 / divisor) ScalesAdd("1:5", 1.0, 5.0 / divisor) ScalesAdd("1:10", 1.0, 10.0 / divisor) ScalesAdd("1:20", 1.0, 20.0 / divisor) ScalesAdd("1:25", 1.0, 25.0 / divisor) ScalesAdd("1:50", 1.0, 50.0 / divisor) ScalesAdd("1:100", 1.0, 100.0 / divisor) ScalesAdd("1:200", 1.0, 200.0 / divisor) ScalesAdd("1:250", 1.0, 250.0 / divisor) ScalesAdd("1:500", 1.0, 500.0 / divisor) ScalesAdd("1:1000", 1.0, 1000.0 / divisor) ScalesAdd("1:2000", 1.0, 2000.0 / divisor) ScalesAdd("1:2500", 1.0, 2500.0 / divisor) ScalesAdd("1:5000", 1.0, 5000.0 / divisor) Case 25 'paper = mm; dwg = mm divisor = 1.0 ScalesAdd("1:1", 1.0, 1.0 / divisor) ScalesAdd("1:2", 1.0, 2.0 / divisor) ScalesAdd("1:2.5", 1.0, 2.5 / divisor) ScalesAdd("1:5", 1.0, 5.0 / divisor) ScalesAdd("1:10", 1.0, 10.0 / divisor) ScalesAdd("1:20", 1.0, 20.0 / divisor) ScalesAdd("1:25", 1.0, 25.0 / divisor) ScalesAdd("1:50", 1.0, 50.0 / divisor) ScalesAdd("1:100", 1.0, 100.0 / divisor) ScalesAdd("1:200", 1.0, 200.0 / divisor) ScalesAdd("1:250", 1.0, 250.0 / divisor) ScalesAdd("1:500", 1.0, 500.0 / divisor) ScalesAdd("1:1000", 1.0, 1000.0 / divisor) ScalesAdd("1:2000", 1.0, 2000.0 / divisor) ScalesAdd("1:2500", 1.0, 2500.0 / divisor) ScalesAdd("1:5000", 1.0, 5000.0 / divisor) Case 31 'paper = inch; dwg = inch ScalesAdd("1"" = 1""", 1.0, 1.0) ScalesAdd("1/64"" = 1""", 1.0 / 64.0, 12.0) ScalesAdd("1/32"" = 1'-0""", 1.0 / 32.0, 12.0) ScalesAdd("1/16"" = 1'-0""", 1.0 / 16.0, 12.0) ScalesAdd("1/8"" = 1'-0""", 1.0 / 8.0, 12.0) ScalesAdd("3/16"" = 1'-0""", 3.0 / 16.0, 12.0) ScalesAdd("1/4"" = 1'-0""", 1.0 / 4.0, 12.0) ScalesAdd("3/8"" = 1'-0""", 3.0 / 8.0, 12.0) ScalesAdd("1/2"" = 1'-0""", 1.0 / 2.0, 12.0) ScalesAdd("3/4"" = 1'-0""", 3.0 / 4.0, 12.0) ScalesAdd("1"" = 1'-0""", 1.0 / 1.0, 12.0) ScalesAdd("1 1/2"" = 1'-0""", 3.0 / 2.0, 12.0) ScalesAdd("3"" = 1'-0""", 3.0, 12.0) ScalesAdd("6"" = 1'-0""", 6.0, 12.0) ScalesAdd("1'-0"" = 1'-0""", 1.0 * 12.0, 12.0) Case 30 'paper = inch; dwg = feet Select Case userDepartment Case "default" ScalesAdd("1"" = 1""", 1.0, 1.0 / 12.0) ScalesAdd("1"" = 1'", 1.0, 1.0) ScalesAdd("1"" = 10'", 1.0, 10.0) ScalesAdd("1"" = 20'", 1.0, 20.0) ScalesAdd("1"" = 30'", 1.0, 30.0) ScalesAdd("1"" = 40'", 1.0, 40.0) ScalesAdd("1"" = 50'", 1.0, 50.0) ScalesAdd("1"" = 60'", 1.0, 60.0) ScalesAdd("1"" = 100'", 1.0, 100.0) ScalesAdd("1"" = 200'", 1.0, 200.0) ScalesAdd("1"" = 300'", 1.0, 300.0) ScalesAdd("1"" = 400'", 1.0, 400.0) ScalesAdd("1"" = 500'", 1.0, 500.0) ScalesAdd("1"" = 600'", 1.0, 600.0) ScalesAdd("1"" = 1000'", 1.0, 1000.0) ScalesAdd("1"" = 2000'", 1.0, 2000.0) ScalesAdd("1"" = 5000'", 1.0, 5000.0) Case "land" ScalesAdd("1"" = 1""", 1.0, 1.0 / 12.0) ScalesAdd("1"" = 1'", 1.0, 1.0) ScalesAdd("1"" = 10'", 1.0, 10.0) ScalesAdd("1"" = 20'", 1.0, 20.0) ScalesAdd("1"" = 30'", 1.0, 30.0) ScalesAdd("1"" = 40'", 1.0, 40.0) ScalesAdd("1"" = 50'", 1.0, 50.0) ScalesAdd("1"" = 60'", 1.0, 60.0) ScalesAdd("1"" = 100'", 1.0, 100.0) ScalesAdd("1"" = 200'", 1.0, 200.0) ScalesAdd("1"" = 300'", 1.0, 300.0) ScalesAdd("1"" = 400'", 1.0, 400.0) ScalesAdd("1"" = 500'", 1.0, 500.0) ScalesAdd("1"" = 600'", 1.0, 600.0) Case "survey" ScalesAdd("1"" = 10'", 1.0, 10.0) ScalesAdd("1"" = 20'", 1.0, 20.0) ScalesAdd("1"" = 30'", 1.0, 30.0) ScalesAdd("1"" = 40'", 1.0, 40.0) ScalesAdd("1"" = 50'", 1.0, 50.0) ScalesAdd("1"" = 60'", 1.0, 60.0) ScalesAdd("1"" = 100'", 1.0, 100.0) ScalesAdd("1"" = 200'", 1.0, 200.0) ScalesAdd("1"" = 300'", 1.0, 300.0) ScalesAdd("1"" = 400'", 1.0, 400.0) ScalesAdd("1"" = 500'", 1.0, 500.0) ScalesAdd("1"" = 600'", 1.0, 600.0) ScalesAdd("1"" = 1000'", 1.0, 1000.0) ScalesAdd("1"" = 2000'", 1.0, 2000.0) ScalesAdd("1"" = 3000'", 1.0, 3000.0) ScalesAdd("1"" = 4000'", 1.0, 4000.0) ScalesAdd("1"" = 5000'", 1.0, 5000.0) ScalesAdd("1"" = 6000'", 1.0, 6000.0) Case "structural" ScalesAdd("3"" = 1'-0""", 3.0, 1.0) ScalesAdd("1 1/2"" = 1'-0""", 3.0, 2.0) ScalesAdd("1"" = 1'", 1.0, 1.0) ScalesAdd("3/4"" = 1'-0""", 3.0, 4.0) ScalesAdd("1/2"" = 1'-0""", 1.0, 2.0) ScalesAdd("3/8"" = 1'-0""", 3.0, 8.0) ScalesAdd("1/4"" = 1'-0""", 1.0, 4.0) ScalesAdd("3/16"" = 1'-0""", 3.0, 16.0) ScalesAdd("1/8"" = 1'-0""", 1.0, 8.0) ScalesAdd("1"" = 10'", 1.0, 10.0) ScalesAdd("1/16"" = 1'-0""", 1.0, 16.0) ScalesAdd("1"" = 20'", 1.0, 20.0) ScalesAdd("1"" = 30'", 1.0, 30.0) ScalesAdd("1"" = 40'", 1.0, 40.0) ScalesAdd("1"" = 50'", 1.0, 50.0) ScalesAdd("1"" = 60'", 1.0, 60.0) ScalesAdd("1"" = 100'", 1.0, 100.0) ScalesAdd("1"" = 200'", 1.0, 200.0) ScalesAdd("1"" = 300'", 1.0, 300.0) ScalesAdd("1"" = 400'", 1.0, 400.0) ScalesAdd("1"" = 500'", 1.0, 500.0) ScalesAdd("1"" = 600'", 1.0, 600.0) Case "platting" ScalesAdd("1:1", 1.0, 1.0) ScalesAdd("1:2", 1.0, 2.0) ScalesAdd("1:4", 1.0, 4.0) ScalesAdd("1:5", 1.0, 5.0) ScalesAdd("1:8", 1.0, 8.0) ScalesAdd("1:10", 1.0, 10.0) ScalesAdd("1:16", 1.0, 16.0) ScalesAdd("1:20", 1.0, 20.0) ScalesAdd("1:30", 1.0, 30.0) ScalesAdd("1:40", 1.0, 40.0) ScalesAdd("1:50", 1.0, 50.0) ScalesAdd("1:60", 1.0, 60.0) ScalesAdd("1:100", 1.0, 100.0) ScalesAdd("2:1", 2.0, 1.0) ScalesAdd("4:1", 4.0, 1.0) ScalesAdd("8:1", 8.0, 1.0) ScalesAdd("10:1", 10.0, 1.0) ScalesAdd("100:1", 100.0, 1.0) End Select 'userDepartment End Select 'dwgunit Select Case intDwgUnit Case 30 'userDeparment applies to 30(feet) acEd.WriteMessage(vbCr & "Scalelist reset for {0} scales (aecdwgunits = {1})" & vbCr, userDepartment, strDwgUnit) Case Else acEd.WriteMessage(vbCr & "Scalelist reset (aecdwgunits = {0})" & vbCr, strDwgUnit) End Select End Sub <CommandMethod("ScalesPurge", CommandFlags.Modal)> _ Public Sub ScalesPurge() Dim acDoc As Document = DocumentManager.MdiActiveDocument Dim acDB As Database = acDoc.Database Dim acEd As Editor = acDoc.Editor Dim acOcm As ObjectContextManager = acDB.ObjectContextManager If (acOcm IsNot Nothing) Then Dim acOcc As ObjectContextCollection = acOcm.GetContextCollection("ACDB_ANNOTATIONSCALES") If (acOcc IsNot Nothing) Then Dim acOic As ObjectIdCollection = New ObjectIdCollection() For Each oc As ObjectContext In acOcc 'make the collection of annotationscales If (TypeOf (oc) Is AnnotationScale) Then acOic.Add(New ObjectId(oc.UniqueIdentifier)) End If Next 'filter the list to include purgeable items only acDB.Purge(acOic) Dim mytrans As Transaction = acDB.TransactionManager.StartTransaction() Using (mytrans) Dim count As Integer = acOic.Count For Each id As ObjectId In acOic Try Dim obj As DBObject = mytrans.GetObject(id, OpenMode.ForWrite) obj.Erase() Catch ex As System.Exception MsgBox("Scales-ACDB-Delete dll Error: " & ex.Message) mytrans.Dispose() End Try Next mytrans.Commit() End Using End If End If End Sub Private Sub ScalesAdd(ByVal strName As String, ByVal dblPaperUnits As Double, ByVal dblDwgUnits As Double) Dim acDoc As Document = DocumentManager.MdiActiveDocument Dim acDB As Database = acDoc.Database Dim acEd As Editor = acDoc.Editor Try Dim acOcm As ObjectContextManager = acDB.ObjectContextManager If (acOcm IsNot Nothing) Then Dim acOcc As ObjectContextCollection = acOcm.GetContextCollection("ACDB_ANNOTATIONSCALES") If (acOcc IsNot Nothing) Then Dim annoScale As AnnotationScale = New AnnotationScale() annoScale.Name = strName annoScale.PaperUnits = dblPaperUnits annoScale.DrawingUnits = dblDwgUnits 'if the scale name does not already exist, add it If (Not acOcc.HasContext(annoScale.Name)) Then acOcc.AddContext(annoScale) End If End If End If Catch ex As System.Exception MsgBox("Scales-ACDB-Add dll Error: " & ex.Message) End Try End Sub End Class End Namespace