The Contour object represents a contour in a field picture window that is used for
calculating integrals, drawing xy-plots and viewing field values tabulated along the it. Each FieldWindow owns exactly one Contour. When the
FieldWindow is first created the Contour is empty. You access the Contour by the Contour property of the FieldWindow object.
The Contour object provides some methods for adding and deleting lines, edges or blocks to the
contour. They are almost similar to the corresponding commands in the QuickField graphic user
interface. In addition a Contour objects provides some read-only properties to get information
about the contour: starting and ending point, contour length and square, number of contour parts
and others.
Adds a line (segment or arc) to the contour. p parameter is an ending point of the created line. If p is
omitted, the line is drawing to the contour starting point, so the contour becomes
closed. angle parameter if omitted is defaulted as zero.
If the contour is empty, the first call of the AddLineTo method does nothing
but remembering p as a starting point of the contour. The line will be
created by the next call of AddLineTo.
Adds a model edge to the contour. The same rules as with interactive editing are
applied to the edge adding. The desired edge might be pointed by its labelName,
by the nearest point near, or both.
If no parameters is given or there is some ambiguity, the first suitable edge is
used.
Adds a model block to the contour. The same rules as with interactive editing are
applied to the block adding. The desired block might be pointed by its labelName,
by the nearest point near, or both.
If no parameters is given or there is some ambiguity, the first suitable block is
used
Unlike the interactive editing, adding the block that is already included to contour
does nothing. To exclude a block from the contour a special method DeleteBlock
should be used.
Returns the number of connectivity component of the contour, considered as a graph.
An empty contour has Connectivity = 0. Connectivity can be great than one
only if the contour is built by adding some several non-adjacent blocks.
The example below builds two contours for the model, representing a synchronous electric motor.
The first contour consists of all the blocks represents the left sides of the pole winding.
They are labeled as Winding+. This contour is used to calculate the magnetic flux of
the pole.
The second contour is a circle consisting of two semicircular arcs in the air gap between
the rotor and stator. It is used for the mechanical torque calculation.
Dim Wnd As QuickField.FieldWindow 'Result field window object
' Get FieldWindow object
Set Wnd = Res.Windows(1)
' Get new Contour object
Dim Cnt as QuickField.Contour
Set Cnt = Wnd.Contour
Cnt.Delete True ' Delete an old contour (if any)
Cnt.AddBlock "Winding+"
Dim Flux as Double
Flux = Res.GetIntegral(qfInt_FluxLinkage, Cnt).Abs
Const PI as Double = 3.1415926 ' The PI constant
Dim Ra As Double ' Air Gap Diameter
Ra = 74.5
Cnt.Delete True ' Delete an old contour
Cnt.AddLineTo PointXY(Ra, 0), 0
Cnt.AddLineTo PointXY(-Ra, 0), 3.1415926
Cnt.AddLineTo PointXY(Ra, 0), 3.1415926
Dim Torque as Double
Torque = Res.GetIntegral(qfInt_MaxwellTorque, Cnt).Abs