2011-02-07 10:56:39 +01:00
|
|
|
-- Symbol names
|
2011-02-11 18:37:00 +01:00
|
|
|
local names =
|
2011-01-09 05:05:31 +01:00
|
|
|
{
|
|
|
|
en = "Inductor",
|
|
|
|
cs = "Cívka"
|
|
|
|
}
|
|
|
|
|
2011-02-09 14:18:22 +01:00
|
|
|
local names_core =
|
2011-02-07 10:56:39 +01:00
|
|
|
{
|
|
|
|
en = "Inductor with magnetic core",
|
|
|
|
cs = "Cívka s magnetickým jádrem"
|
|
|
|
}
|
|
|
|
|
2011-01-09 05:05:31 +01:00
|
|
|
-- Render area in base units (X1, Y1, X2, Y2)
|
2011-02-09 14:18:22 +01:00
|
|
|
local area = {-2, -1, 2, 0}
|
2011-01-09 05:05:31 +01:00
|
|
|
|
2011-02-11 18:37:00 +01:00
|
|
|
-- Terminal points
|
2011-02-09 14:18:22 +01:00
|
|
|
local terminals = {{-2, 0}, {2, 0}}
|
2011-01-09 05:05:31 +01:00
|
|
|
|
|
|
|
-- Rendering
|
2011-02-11 18:37:00 +01:00
|
|
|
local render = function (cr)
|
2011-01-09 05:05:31 +01:00
|
|
|
-- The arcs
|
|
|
|
cr.arc (-1.5, 0, 0.5, math.pi, 0)
|
|
|
|
cr.arc (-0.5, 0, 0.5, math.pi, 0)
|
|
|
|
cr.arc (0.5, 0, 0.5, math.pi, 0)
|
|
|
|
cr.arc (1.5, 0, 0.5, math.pi, 0)
|
2011-02-11 18:37:00 +01:00
|
|
|
|
2011-02-07 10:56:39 +01:00
|
|
|
cr.stroke ()
|
|
|
|
end
|
|
|
|
|
2011-02-09 14:18:22 +01:00
|
|
|
local render_core = function (cr)
|
2011-02-11 18:37:00 +01:00
|
|
|
render (cr)
|
2011-01-09 05:05:31 +01:00
|
|
|
|
2011-02-07 10:56:39 +01:00
|
|
|
-- The core
|
|
|
|
cr.move_to (-2, -1)
|
|
|
|
cr.line_to (2, -1)
|
2011-02-11 18:37:00 +01:00
|
|
|
|
2011-01-09 05:05:31 +01:00
|
|
|
cr.stroke ()
|
|
|
|
end
|
|
|
|
|
2011-02-07 10:56:39 +01:00
|
|
|
-- Register the symbols
|
2011-02-11 18:37:00 +01:00
|
|
|
logdiag.register ("Inductor", names, area, terminals, render)
|
|
|
|
logdiag.register ("InductorWithCore", names_core, area, terminals, render_core)
|
2011-01-09 05:05:31 +01:00
|
|
|
|
|
|
|
|