02-25-2021
06:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-25-2021
06:48 PM
@ThomasB44 , there does seem to be a problem. I'll look into it further.
Here's a way to work around it:
- set the center once
- read the new center value back from the view : the achieved center point might not be what we asked for.
- adjust our desired center point by the difference between the really desired and achieved
- set the view center to that new new adjusted point. The system will adjust it again, thus giving us what we asked for originally!
Here's code. This can replace your SetCenter rule.
Dim viewX As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a view :")
Dim sheetX = viewX.Parent
Dim sheetCenter = ThisApplication.TransientGeometry.CreatePoint2d(sheetX.Width / 2, sheetX.Height / 2)
Dim pointWanted = sheetCenter.Copy()
viewX.Center = pointWanted
Dim pointAchieved = viewX.Center
Dim diff = pointAchieved.VectorTo(sheetCenter)
Logger.Info("diff 1 = {0}, {1}", diff.X, diff.Y)
pointWanted.TranslateBy(diff)
viewX.Center = pointWanted
Dim pointAchieved2 = viewX.Center
Dim diff2 = pointAchieved2.VectorTo(sheetCenter)
Logger.Info("diff 2 = {0}, {1}", diff2.X, diff2.Y)
(This uses the iLogic Log window instead of a message box. This window (or rather pane) can be made visible on the View > Windows > User Interface dropdown.)

Mike Deck
Software Developer
Autodesk, Inc.