Jozi68 Posted July 16, 2009 Posted July 16, 2009 Hi All, I'm using vb.net to write a DLL that I can load with netload. How can I set the drawing's Units to meters? I would also like to change the precision from the default 0.0000 to 0.000. All suggestions are appreciated. Jozi68 Quote
SEANT Posted July 16, 2009 Posted July 16, 2009 The Database.Aunits (via DistanceUnitFormat enum) and Database.Auprec Properties allow for that type of modification Quote
Jozi68 Posted July 16, 2009 Author Posted July 16, 2009 Thanx SEANT, could you please show me how to do it? I am a complete beginner with VB.net Quote
SEANT Posted July 16, 2009 Posted July 16, 2009 For the most part I would use C# for .NET programming. I will use this example request as an opportunity to practice a bit of VB, but I will need a day or two. Same goes for your post regarding World UCS. I didn’t have time to respond this morning, but I’ll look into it that over the next few days. Quote
SEANT Posted July 17, 2009 Posted July 17, 2009 Here is a basic routine to modify the unit format and display precision for a drawing. With the header: Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.EditorInput And within a Public Class: <CommandMethod("Test")> _ Public Sub TestUnitsAndUcsMod() Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database Dim intInsLUnit As UnitsValue = db.Insunits Dim intLPrec As Integer = db.Luprec DisplayInfo(intInsLUnit, intLPrec, False) db.Insunits = UnitsValue.Meters db.Luprec = 3 intInsLUnit = db.Insunits intLPrec = db.Luprec DisplayInfo(intInsLUnit, intLPrec, True) End Sub Private Sub DisplayInfo(ByVal UnitsFormat As UnitsValue, ByVal Precision As Integer, ByVal Changed As Boolean) Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor Dim strUnitsFormat = UnitsFormat.ToString() Dim strPrec = Precision.ToString() Dim strChanged As String = "Former units were " If Changed Then strChanged = "New units are " ed.WriteMessage(strChanged & strUnitsFormat & " with a display precision to " & strPrec & " decimal places." & vbLf) End Sub Quote
Jozi68 Posted July 19, 2009 Author Posted July 19, 2009 Thank you so much SEANT! It works beautifully. I really appreciate your help. regards, Jozi68 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.