colmguckian Posted September 27, 2011 Posted September 27, 2011 I have a vbdotnet code to create a command which scales the drawing Please see attached a print screen of the code You will see that I am getting two errors. How do I fix these errors. How do I tweek the code so that it scales all objects in the drawing by 25.4. cscaleall.doc Quote
Jeff H Posted September 27, 2011 Posted September 27, 2011 (edited) I am not familiar with VBA for AutoCAD but that is what it looks like, but From AutoCAD .NET Developer's Guide in help You move, scale, rotate and mirror an object using a 4 by 4 transformation matrix represented by a Matrix3d object and the TransformBy method LINK This LINK shows an example. Here is scaling all objects in model space 25.4 using the origin as the base point <CommandMethod("ScaletoMetric")> _ Public Sub ScaletoMetric() Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim ed As Editor = doc.Editor Dim db As Database = doc.Database Using trx As Transaction = db.TransactionManager.StartTransaction() Dim bt As BlockTable = trx.GetObject(db.BlockTableId, OpenMode.ForRead) Dim modelBtr As BlockTableRecord = trx.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForRead) For Each objId As ObjectId In modelBtr Dim ent As Entity = trx.GetObject(objId, OpenMode.ForWrite) ent.TransformBy(Matrix3d.Scaling(25.4, Point3d.Origin)) Next trx.Commit() End Using End Sub Edited September 27, 2011 by Jeff H Quote
colmguckian Posted September 28, 2011 Author Posted September 28, 2011 Thats perfect Jeff. Thanks for the code and the links 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.