Author Topic: Created Clipped Model Space View from Extent of object  (Read 1128 times)

0 Members and 1 Guest are viewing this topic.

GumbyCAD

  • Newt
  • Posts: 84
Created Clipped Model Space View from Extent of object
« on: April 14, 2016, 08:12:51 AM »
Hi Team,

I am trying to adopt this sample code to set my view to a selected object in my model.
(Created a clipped view in the current model viewport)

Sample:
https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-NET/files/GUID-FAC1A5EB-2D9E-497B-8FD9-E11D2FF87B93-htm.html

The objects has extents (Lower left and Upper Right), it has a centre point too.  (Bascially a cube in space representing the volume I want to See)

I have never created a view so I am not familiar with this object. Nor am i convinced I am heading down the correct path.
Can anyone give any guidance (as I have the feeling I have miss read the sample)

Thanks Stephan

 :uglystupid2:

GumbyCAD

  • Newt
  • Posts: 84
Re: Created Clipped Model Space View from Extent of object
« Reply #1 on: April 14, 2016, 11:51:16 AM »


I got something working but still not sure what is right.

Why is the CentrePoint a 2D Point???
From where is the Clipping distances taking from?


Code - Visual Basic: [Select]
  1.         Public Sub ZoomZoom(ByVal pLookAt As Point3d, ByVal pLookFrom As Point3d, ByVal dWidth As Double, ByVal dHeight As Double)
  2.  
  3.             Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
  4.             Dim acCurDb As Database = acDoc.Database
  5.  
  6.             Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
  7.                 '' Get the current view
  8.                Using acView As ViewTableRecord = acDoc.Editor.GetCurrentView()
  9.  
  10.  
  11.                     acView.Width = dWidth
  12.                     acView.Height = dHeight
  13.                     acView.CenterPoint = Point2d.Origin
  14.                     acView.ViewDirection = pLookAt.GetVectorTo(pLookFrom)
  15.                     acView.Target = pLookAt
  16.  
  17.                     'acView.FrontClipAtEye = True
  18.                    acView.BackClipDistance = -500
  19.                     acView.BackClipEnabled = True
  20.                     acView.FrontClipDistance = 500
  21.                     acView.FrontClipEnabled = True
  22.  
  23.                     '' Set the current view
  24.                    acDoc.Editor.SetCurrentView(acView)
  25.                 End Using
  26.  
  27.                 '' Commit the changes
  28.                acTrans.Commit()
  29.             End Using
  30.  
  31.         End Sub
  32.