Circular State indicator

Hi
I am trying to create a Circular indicator for Pivot display.
Following is what i want to achieve:

  1. Circular or configurable circle ( 180deg or 270deg or 360 deg) to display the pivot actual boundary. color animation to display the sprayed area.
  2. Line or something similar to display the current position of the pivot arm.( it is coming as Angle from the PLC which is 0-360deg) It has to move from center point along above circle.
  3. Arrow indicating which way pivot is moving forward or reverse direction.

i will see if i can attach pictures of our other SCADA which is reflecting this functionality.


Irrigration Pic2

You didn’t specify Vision or Perspective. Perspective’s simple gauge should be able to do what you want for the circle. Vision’s gauge should also be suitable when you turn off some of the options. The arrow you’ll have to create, position where you want it and move the pivot to the centre of the gauge.

I am currently developing in ignition Vision 8.1

I looked at Gauges or pi indicator… But there could be instance where arm carry on moving without spray which become trick for Pi and gauge indicator.

Is there any examples or documentation which can be referred ?

Did you try the Vision - Meter page in the manual?

Yes, i have tried combining Meter and Pi chart. Both of this can give you basic functionality but doesn’t indicate the spray status( Which area is sprayed and which is not) which have to be combination of Digital signal(Spray ON/Off) and Analogue signal ( Angle in degree). Arrow indication is other one which unable to find how to do this…

It looks like something you could do with the Paintable Canvas.

I programmed a paintable canvas to do this. Didn’t have time to do an arrow. Here you go:

Paste this code into a paintable canvas repaint script and then setup the custom properties to match.

from java.awt import Color
from java.awt import BasicStroke
from java.awt.geom import Rectangle2D
import math

g = event.graphics

armAngle = event.source.armAngle
circleStartAngle = event.source.boundaryStartAngle
circleArcSize = event.source.boundaryArcSize
rotation = event.source.rotationAdjustment
clockwise = event.source.degreesDirectionCW
diameter = min([event.width,event.height])
dx = event.width - diameter
dy = event.height - diameter
area = Rectangle2D.Float(0+dx/2.,0+dy/2.,diameter,diameter)

if clockwise:
	c1_startAngle = -(circleStartAngle + rotation)
	c1_arcAngle = -(armAngle-circleStartAngle)
	c2_startAngle = -circleStartAngle-(armAngle-circleStartAngle)-rotation
	c2_arcAngle = -(circleArcSize-(armAngle-circleStartAngle))
	theta = -circleStartAngle-(armAngle-circleStartAngle)-rotation

else:
	c1_startAngle = circleStartAngle + rotation
	c1_arcAngle = armAngle-circleStartAngle
	c2_startAngle = circleStartAngle+armAngle-circleStartAngle + rotation
	c2_arcAngle = circleArcSize-(armAngle-circleStartAngle)
	theta = circleStartAngle+armAngle-circleStartAngle + rotation

# Draw Arcs
g.setColor(event.source.primaryColor)
g.fillArc(int(area.x), int(area.y), int(area.width), int(area.height), int(c1_startAngle), int(c1_arcAngle))
g.setColor(event.source.secondaryColor)
g.fillArc(int(area.x), int(area.y), int(area.width), int(area.height), int(c2_startAngle), int(c2_arcAngle))

# Draw Arm
centerX = event.width/2.
centerY = event.height/2.
x = centerX + diameter/2. * math.cos(-theta * math.pi / 180.0)
y = centerY + diameter/2. * math.sin(-theta * math.pi / 180.0)
g.setStroke(BasicStroke(diameter*0.01,BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER))
g.setColor(event.source.armColor)
g.drawLine(int(centerX),int(centerY), int(x), int(y))

Custom Properties:
image

6 Likes

Hi alexraymond,
Thanks a lot… This has saved me lot of time to invent the wheel…
Thanks Again.

1 Like