Plotting: Scale Bar does not update

Plotting: Scale Bar does not update

trindelhaven
Participant Participant
332 Views
1 Reply
Message 1 of 2

Plotting: Scale Bar does not update

trindelhaven
Participant
Participant

Hallo everyone,

 

I'm stuck with my plotting routine - it's working fine beside the fact, that the scale bar does not update according to the size of shown features. I have code as following:

 

 

    Private Sub UpdateBoundViewPort(pDocument As Document, pViewport As Viewport, currentPlot As PlottingGeometry)
      pViewport.UpgradeOpen()
      pViewport.TwistAngle = -((currentPlot.Orientation / 180) * Math.PI)

      Dim minPoint2d = currentPlot.Point - New Vector2d(currentPlot.Size.Width / 2, currentPlot.Size.Height / 2)
      Dim maxPoint2d = currentPlot.Point + New Vector2d(currentPlot.Size.Width / 2, currentPlot.Size.Height / 2)
      Dim vExtents = New Extents3d(New Point3d(minPoint2d.X, minPoint2d.Y, 0), New Point3d(maxPoint2d.X, maxPoint2d.Y, 0))
      vExtents.TransformBy(GetRotationMatrix(pViewport))

      Dim viewportRatio = pViewport.Width / pViewport.Height
      Dim vWidth = If(currentPlot.Size.Width <= 0, 1, currentPlot.Size.Width)
      Dim viewHeight = If(currentPlot.Size.Height <= 0, 1, currentPlot.Size.Height)
      If vWidth > viewHeight * viewportRatio Then
        viewHeight = vWidth / viewportRatio
      End If

      pViewport.ViewCenter = New Point2d((vExtents.MaxPoint.X + vExtents.MinPoint.X) * 0.5, (vExtents.MaxPoint.Y + vExtents.MinPoint.Y) * 0.5)
      pViewport.ViewHeight = viewHeight
      pViewport.UpdateDisplay()
    End Sub

 

So i change ViewCenter and ViewHeight on the Viewport. Even thought the ViewHeight is different using different geometries, the Scale Bar does not change, it keeps static. And i checked that the scale bas is linked to the view port.

So, what's wrong here? Does anyone know?

Thank you! 🙂

 

Greetings,

Alex

0 Likes
333 Views
1 Reply
Reply (1)
Message 2 of 2

trindelhaven
Participant
Participant

Can anyone tell me, how i might be able to access the scale bar, so i can manually adjust the displayed numbers?

0 Likes