I am developing using VB.NET at IJCAD 2018.
With the source code below, I created a function to turn on and off the front clip and set the clip distance for the current view, but there is no error when I call it, but there is no change in the screen.
After the processing, when I looked at the front clip and distance settings in the view management dialog on the GCAD side, the processing was not reflected.
Could you tell me how to do this correctly?
On the other hand, as above, I can get the current view in GetCurrentView, edit the view (center of view, camera target) and update the screen, so I don't think it's a misguided way to write it.
code:
Turning on or off the front clip of the current view or specifying the clip distance is not working.
Private Sub SetFrontClipOnOf (ByVal blnEnabled As Boolean)
DimicdDoc As Document = IJCADApplication.DocumentManager.MdiActiveDocument
Using icdTransAsTransaction=icdDoc.TransactionManager.StartTransaction
Using acView As ViewTableRecord=icdDoc.Editor.GetCurrentView
acView.FrontClipEnabled=blnEnabled
icdDoc.Editor.SetCurrentView (acView)
End Using
icdTrans.Commit()
End Using
icdDoc.Editor.UpdateScreen()
End Sub
Private Sub SetFrontClipDist (byval dblDist as Double)
DimicdDoc As Document = IJCADApplication.DocumentManager.MdiActiveDocument
Using icdTransAsTransaction=icdDoc.TransactionManager.StartTransaction
Using acView As ViewTableRecord=icdDoc.Editor.GetCurrentView
acView.FrontClipDistance=dblDist
icdDoc.Editor.SetCurrentView (acView)
End Using
icdTrans.Commit()
End Using
icdDoc.Editor.UpdateScreen()
End Sub
On the other hand, the process of retrieving the CurrentView and zooming it to the designated position in exactly the same way and aligning the camera target with the zoom position is well done.
Public Sub ZoomRangeByAcView (CenPnt As Point 3d, icdDoc As Document, ByValdblRad As Double)
Using icdTransAsTransaction=icdDoc.TransactionManager.StartTransaction
Using acView As ViewTableRecord=icdDoc.Editor.GetCurrentView
acView.Target=CenPnt
DimatWCS2 DCS As Matrix 3d
matWCS2DCS=Matrix3d.PlaneToWorld (acView.ViewDirection)
matWCS2DCS=Matrix3d.Displacement(acView.Target-Point3d.Origin)*matWCS2DCS
matWCS2DCS=Matrix3d.Rotation (-acView.ViewTwist,_
acView.ViewDirection,_
acView.Target)*matWCS2DCS
matWCS2DCS = matWCS2DCS.Inverse()
Dim CenPntConv As Point 3d = CenPnt.TransformBy (matWCS2DCS)
acView.CenterPoint = New Point 2d (CenPntConv.X, CenPntConv.Y)
acView.Height=dblRad*2
acView.Width=dblRad*2
icdDoc.Editor.SetCurrentView (acView)
End Using
icdTrans.Commit()
End Using
icdDoc.Editor.UpdateScreen()
End Sub
IJCAD's .NET API does not seem to reflect changes to the FrontClipDistance or FrontClipEnabled properties of ViewTableRecord objects.
If you used ObjectARX's setFrontClipDistance method, you were able to change the clip clip distance without any problems, so it is probably a .NET API bug.
I think it would be better to report to IJCAD support as an API defect.
© 2024 OneMinuteCode. All rights reserved.