mirror of https://github.com/KLayout/klayout.git
Doc updates
This commit is contained in:
parent
03c5a29682
commit
0efdbd4ebe
|
|
@ -306,7 +306,7 @@ gsi::Class<db::Technology> technology_decl ("db", "Technology",
|
|||
"specifying its name in \\Layout#technology_name. While \\create_technology already registers "
|
||||
"the technology, this method allows registering a Technology object that has created in other ways.\n"
|
||||
"\n"
|
||||
"This method returns a reference to the new technology object which is a copy of the argument. "
|
||||
"This method returns a reference to the new technology object, which is a copy of the argument. "
|
||||
"\\remove_technology can be used to remove a technology registered by this method.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.28.14."
|
||||
|
|
@ -365,7 +365,7 @@ gsi::Class<db::Technology> technology_decl ("db", "Technology",
|
|||
"@code\n"
|
||||
"tech = RBA::Technology::new\n"
|
||||
"tech.load(\"mytech.lyt\")\n"
|
||||
"RBA::Technology::register(tech)\n"
|
||||
"RBA::Technology::register_technology(tech)\n"
|
||||
"@/code\n"
|
||||
"\n"
|
||||
"Note that in the latter example, an exception will be thrown if a technology with the same "
|
||||
|
|
|
|||
|
|
@ -408,6 +408,61 @@ A::new.f(x)
|
|||
omitted, the default value is used instead.
|
||||
</p>
|
||||
|
||||
<h2>Implicit conversions</h2>
|
||||
|
||||
<h3>String arguments</h3>
|
||||
|
||||
<p>
|
||||
If a method expects a string argument, other types are converted to strings
|
||||
using the "to_s" method. In Python, the equivalent is "str(...)".
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Example:
|
||||
</p>
|
||||
|
||||
<pre># Also accepts a float value for the first string argument -
|
||||
# it is converted to "2.5"
|
||||
t = RBA::Text::new(2.5, RBA::Trans::new)</pre>
|
||||
|
||||
<h3>Conversion constructors</h3>
|
||||
|
||||
<p>Conversion constructors are constructors that take an object of a
|
||||
different class and convert it to the target class.
|
||||
Conversion constructors are used implicitly in applicable cases
|
||||
to convert one type to the type requested by the argument.</p>
|
||||
|
||||
<p>
|
||||
For example, in the following code, the Region object's "+" operator
|
||||
is used. This expects a Region object as the second parameter, but as
|
||||
there is conversion constructor available which converts a Box to
|
||||
a Region, it is possible to use a Box directly:
|
||||
</p>
|
||||
|
||||
<pre>r = RBA::Region::new(RBA::Box::new(0, 0, 1000, 2000))
|
||||
r += RBA::Box::new(3000, 0, 4000, 2000)</pre>
|
||||
|
||||
<h3>Implicit constructor from lists</h3>
|
||||
|
||||
<p>
|
||||
When an object is expected for an argument and a list is given,
|
||||
the object constructor is called with the arguments from the list.
|
||||
This specifically allows using size-2 lists instead of Point or
|
||||
Vector arguments. In Python, a "list" can also be a tuple.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In the following example, this mechanism is used for
|
||||
the polygon point list which is expected to be an array
|
||||
of Point objects, but can use size-2 arrays instead.
|
||||
Also, the "moved" method expects a Vector, but here
|
||||
as well, size-2 arrays can be used instead:
|
||||
</p>
|
||||
|
||||
<pre>pts = [ [ 0, 0 ], [ 0, 1000 ], [ 1000, 0 ] ]
|
||||
poly = RBA::Polygon::new(pts)
|
||||
poly = poly.moved([ 100, 200 ])</pre>
|
||||
|
||||
<h2>Constness</h2>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
Loading…
Reference in New Issue