Method: addAltPic
Add an alternate symbol picture to this type
void addAltPic(pic, name);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
pic | DWPic | The picture to be added as an alternate symbol |
name | String | The name to be associated with this picture |
Types that are already instantiated in a circuit cannot be modified. I.E. This method can only be called for types that have been created in the script or read from a library and not yet used in a schematic.
A type can have any number of alternate symbols associated with it. Each alternate symbol has a picture and a name. Whenever the device is drawn on the screen, the AltPicName.Dev attribute field for the device is checked. If this field contains a name that corresponds to the name of one of the alternate pictures, that picture is used instead of the standard one.
The images are aligned at the top left corner. No checking is done of the size or alignment of the picture. It is the responsibility of the creator of the images to make sure they match in size and align correctly with the device pins.
Property: attributeList
Gets or sets the attribute list (i.e. the collection of all attribute values) associated with this object.
SPArray attributeList();
attributeList = SPArray
Returns or accepts an SPArray of DWAttribute objects
You can always get this property, but you cannot set it on a type that is already instantiated in a circuit, or was loaded from a library. This can only be set for a DWType object that was created within the script.
Method: autoSymbol
Generate a symbol image and pin definitions from a text description
void autoSymbol(left, right, top, bottom, name, nameFont, pinFont);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
bottom | String | A string defining the pins to appear on the bottom side of the symbol (see description below) |
left | String | A string defining the pins to appear on the lefthand side of the symbol (see description below) |
right | String | A string defining the pins to appear on the righthand side of the symbol (see description below) |
nameFont | String | The name, size and attributes of the font used to draw the name in the symbol (see description below) |
top | String | A string defining the pins to appear on the top side of the symbol (see description below) |
pinFont | String | The name, size and attributes of the font used to draw the pin labels in the symbol (see description below) |
name | String | The name to be displayed in the center of the symbol |
All parameters are optional
This method completely rebuilds the type and any previous settings or attributes will be replaced.
Types that are already instantiated in a circuit cannot be modified. I.E. This method can only be called for types that have been created in the script or read from a library and not yet used in a schematic.
The left, top, right and bottom strings must contain a comma-separated list of pin names, with the following additional options
The font strings can contain a font name, size and attributes
Method: copyProtectionData
Copies the type protection password info from another type
void copyProtectionData(srcType);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
srcType | DWType | The type whose data will be copied to this type. The source is not modified. |
Types that are already instantiated in a circuit cannot be modified.
Property: frame
Gets a rectangle bounding the symbol.
Rect frame();
Method: getAttribute
Gets an attribute value from this object
String getAttribute(fieldName);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
fieldName | String | The name of the field to retrieve |
Returns a string representing the value of the specified attribute field. This string will be empty (zero length) if the field does not exist.
Method: getAttributeVis
Gets the visibility of an attribute on this object
bool getAttributeVis(fieldName);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
fieldName | String | The name of the field to retrieve |
Returns true if the field is displayed on the schematic, false otherwise
Property: getProperties
Gets a properties object associated with this object.
Method: insertPins
Adds 1 or more pins to the type
void insertPins(startIndex);
void insertPins(startIndex, numToInsert);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
numToInsert | int | The number of pins to insert. If not specified, defaults to 1 |
startIndex | int | The index (zero-based) of the first pin to insert. If -1 is specified, they are added at the end of the pin list |
No return value
Pins are created with default attributes, direction, function and name properties. These values can be set for the new pins after this call any time before the type is used to instantiate devices
You cannot use this method on a type that is already instantiated in a circuit, or was loaded from a library. This can only be set for a DWType object that was created within the script or obtained using the DWDevice.detachedType property
Property: libID
Gets the libID (a unique integer identifier used to select a symbol from a library). If this is zero, this type has no libID, i.e. it was not read from a library.
int libID();
The lib ID is determined by the library manager at runtime and is not a permanent property of this type.
Property: library
Gets the library object that this type was read from, if any
DWLibrary library();
The library cannot be set. May return NULL if this type was constructed internally and is not associated with a library.
Method: markAsChanged
Marks this type as changed so it will be recognized as a new version when loaded into a design
Property: name
Gets or sets the name of the type
String name();
name = String
No changes can be made to a type that is instantiated in a circuit.
Property: numPins
Gets or sets the number of pins on this device type.
int numPins();
numPins = int
You can always get this property, but you cannot set it on a type that is already instantiated in a circuit, or was loaded from a library. This can only be set for a DWType object that was created within the script.
Property: objType
Returns a string with the name of this object class "DWType".
String = objType
Property: pic
Gets or sets the picture (symbol) of the type
DWPic pic();
pic = DWPic
No changes can be made to a type that is instantiated in a circuit.
Property: pinInterface
Gets a string representing the pin interface on this device. Read only.
String = pinInterface
Method: pins
Returns an array of DWTypePin objects representing all the pins connected to this type
SPArray pins();
Returns an SPArray object containing a DWTypePin object for each pin attached to this type
WARNING: This array becomes invalid if any subsequent script commands causes elements to be added or destroyed. Not much checking is done for this and bad things could happen if you aren't careful!
Property: readOnly
Returns true if this type has been instantiated in a circuit. No changes can be made to type definitions that are in use in a circuit.
bool = readOnly
Method: removePins
Removes pins from the type by either pin range or attribute value
void removePins(startIndex);
void removePins(startIndex, numToRemove);
void removePins(attrFieldName);
void removePins(attrFieldName, attrFieldValue);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
attrFieldName | string | Name of an attribute field to check. If this is specified, each pin in the type is queried for the value of this field. If a value is specified, then only pins exactly matching the value will be removed. If no value is specified, any pin with any non-empty value in this field will be removed |
attrFieldValue | string | Value to match in order to remove each pin. See above. |
numToRemove | int | The number of pins to remove. If not specified, defaults to 1 |
startIndex | int | The index (zero-based) of the first pin to be removed. If -1 is specified, they are removed from the end of the pin list |
No return value
You cannot use this method on a type that is already instantiated in a circuit, or was loaded from a library. This can only be set for a DWType object that was created within the script or obtained using the DWDevice.detachedType property
Method: setAttribute
Sets an attribute value in this object
void setAttribute(fieldName, value);
void setAttribute(fieldName, value, visibility);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
value | String | The new value for the specified field |
fieldName | String | The name of the field to set |
visibility | int | How to set visibility of resulting attribute text. 0 (false) = hide, 1 (true) = show, 2 = use default setting in design's attribute table, -1 = leave current visibility. If this parameter is not supplied, 2 is assumed. |
Null.
Method: setAttributeVis
Sets the visibility of an attribute value in this object
void setAttributeVis(fieldName, visibility);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
fieldName | String | The name of the field to set |
visibility | bool | true to make the attribute visible, false to hide it |
Method: subCircuit
Gets a DWCircuit object representing the subcircuit of the type or sets the subcircuit attached to the type
DWCircuit subCircuit();
subCircuit = DWCircuit
Returns a DWCircuit object or null if the type has no subcircuit. The returned object represents the actual circuit in use in the design and should be modified with care.
If the second form is used to set the subcircuit, this assignment actually makes an internal, independent copy of the given circuit, so it doesn't matter if the circuit provided is an open document or already attached to something else.