Community
Hello experts. How can I set customscale or standardscale on a clipped view port. Code below used to work properly when it was a rectangular view port. by the time I changed it to a clipped non rectangular view port scale doesn't set . Any help ?
Thanks , Janet
Sub clippedVports() Dim Mydwg As Document = Application.DocumentManager.MdiActiveDocument Dim Mydb As Database = Mydwg.Database Dim Myed As Editor = Mydwg.Editor Dim tr As Transaction = Mydb.TransactionManager.StartTransaction() Using tr Dim bt As BlockTable = DirectCast(tr.GetObject(Mydb.BlockTableId, OpenMode.ForRead), BlockTable) Dim ps As BlockTableRecord = DirectCast(tr.GetObject(bt(BlockTableRecord.PaperSpace), OpenMode.ForWrite), BlockTableRecord) Dim dbobjs As New DBObjectCollection() Dim pl As New Autodesk.AutoCAD.DatabaseServices.Polyline(6) pl.AddVertexAt(0, New Point2d(4.92, 5.29), 0, 0, 0) pl.AddVertexAt(1, New Point2d(5.16, 6.02), 0, 0, 0) pl.AddVertexAt(2, New Point2d(6.12, 6.49), 0, 0, 0) pl.AddVertexAt(3, New Point2d(7.29, 6.26), -0.27, 0, 0) pl.AddVertexAt(4, New Point2d(8.11, 5.53), -0.47, 0, 0) pl.AddVertexAt(5, New Point2d(7.75, 5.41), 0, 0, 0) pl.Closed = True dbobjs.Add(pl) For Each dbobj As DBObject In dbobjs Dim ent As Entity = TryCast(dbobj, Entity) If ent IsNot Nothing Then Dim myobjid As ObjectId = ps.AppendEntity(ent) tr.AddNewlyCreatedDBObject(dbobj, True) Dim vp As New Autodesk.AutoCAD.DatabaseServices.Viewport ps.AppendEntity(vp) tr.AddNewlyCreatedDBObject(vp, True) vp.NonRectClipEntityId = myobjid vp.NonRectClipOn = True vp.CustomScale = 0.003 vp.[On] = True End If Next tr.Commit() End Using End Sub