RMS Posted June 7, 2010 Share Posted June 7, 2010 Anyone have the VB.net command to change the current plan view model space to any Isometric one; but still in the model space. I searched all over with no luck, I must not be using the right key words.....thanks for any help! Rob Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 8, 2010 Share Posted June 8, 2010 Vpoint 1,1,1 Quote Link to comment Share on other sites More sharing options...
SEANT Posted June 8, 2010 Share Posted June 8, 2010 And in .NET terms: A ViewportTableRecord object can be acquired from Database.CurrentViewportTableRecordId (via transaction). The view can be modified similar to the vpoint command: ViewportTableRecord.ViewDirection = New Vector3d(1.0, 1.0, 1.0) (commit transaction) Regen the view with: Editor.UpdateTiledViewportsFromDatabase() Quote Link to comment Share on other sites More sharing options...
RMS Posted June 9, 2010 Author Share Posted June 9, 2010 And in .NET terms: A ViewportTableRecord object can be acquired from Database.CurrentViewportTableRecordId (via transaction). The view can be modified similar to the vpoint command: ViewportTableRecord.ViewDirection = New Vector3d(1.0, 1.0, 1.0) (commit transaction) Regen the view with: Editor.UpdateTiledViewportsFromDatabase() Thanks for the tip, so I am getting close BUT I have this error, is it that I am not using AutoCAD 2011 and a newer .net framework? Or am I missing a reference? Thanks! Quote Link to comment Share on other sites More sharing options...
Kerry Brown Posted June 9, 2010 Share Posted June 9, 2010 Editor.ActiveViewportId property is only available for Acad2009 or later Quote Link to comment Share on other sites More sharing options...
SEANT Posted June 9, 2010 Share Posted June 9, 2010 The .NET API has changed quite a bit since AutoCAD 2005 (version listed in your profile). Consequently, the sample shown below may not work. Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.EditorInput Imports Autodesk.AutoCAD.Geometry Imports Autodesk.AutoCAD.ApplicationServices <CommandMethod("IV")> _ Public Sub IsoView() Dim Doc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = HostApplicationServices.WorkingDatabase If (db.TileMode = True) Then Using tran As Transaction = db.TransactionManager.StartTransaction() Dim vpr As ViewportTableRecord = DirectCast(tran.GetObject(db.CurrentViewportTableRecordId, OpenMode.ForWrite), ViewportTableRecord) If vpr IsNot Nothing Then Dim v3d As Vector3d = New Vector3d(1.0, -1.0, 1.0) vpr.ViewDirection = v3d End If tran.Commit() End Using Doc.Editor.UpdateTiledViewportsFromDatabase() End If End Sub Quote Link to comment Share on other sites More sharing options...
RMS Posted June 10, 2010 Author Share Posted June 10, 2010 Editor.ActiveViewportId property is only available for Acad2009 or later I was kinda thinking that too but was not sure....... plan b Quote Link to comment Share on other sites More sharing options...
RMS Posted June 12, 2010 Author Share Posted June 12, 2010 The .NET API has changed quite a bit since AutoCAD 2005 (version listed in your profile). Consequently, the sample shown below may not work. Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.EditorInput Imports Autodesk.AutoCAD.Geometry Imports Autodesk.AutoCAD.ApplicationServices <CommandMethod("IV")> _ Public Sub IsoView() Dim Doc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = HostApplicationServices.WorkingDatabase If (db.TileMode = True) Then Using tran As Transaction = db.TransactionManager.StartTransaction() Dim vpr As ViewportTableRecord = DirectCast(tran.GetObject(db.CurrentViewportTableRecordId, OpenMode.ForWrite), ViewportTableRecord) If vpr IsNot Nothing Then Dim v3d As Vector3d = New Vector3d(1.0, -1.0, 1.0) vpr.ViewDirection = v3d End If tran.Commit() End Using Doc.Editor.UpdateTiledViewportsFromDatabase() End If End Sub OK, I am using acad 2009 now and the above code is working. IF anyone is using acad 2006 - 2008 this will work to change current model view to an Isometric one. Got this from a site in China ' set iso mode Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor Dim vtr As ViewTableRecord = ed.GetCurrentView() Dim newVtr As ViewTableRecord = vtr newVtr.ViewDirection = New Vector3d(1, -1, 1) ed.SetCurrentView(newVtr) ' close Iso mode Quote Link to comment Share on other sites More sharing options...
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.