Method: addLine
Add a visible line to this signal
DWSignal addLine(p1x, p1y, p2x, p2y);
DWSignal addLine(p1x, p1y, p2x, p2y, hitCheck);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
p1x | integer | X coordinate of first point of line |
p1y | integer | Y coordinate of first point of line |
hitCheck | bool | true to check for connections to other signals at both ends of the line. Defaults to false. WARNING: If this test results in connections to other signals, this signal may cease to exist, with unpredictable consequences if you make further references to thos object! |
p2y | integer | Y coordinate of second point of line |
p2x | integer | X coordinate of second point of line |
Returns the signal object remaining after the add line operation. If hitCheck is false, this will always be this object. If hitCheck is true and the add line results in a merge with another signal, this object may cease to exist and this method returns the new object.
The order of points is of no consequence. All coordinates should normally be multiples of the standard grid spacing of 70 units.
NOTE: If you use hitCheck == true, then you should always make sure that this object still exists if you plan to keep using it.
Property: allInstances
Gets a string array containing the instance locators for all possible physical instances of this object
SPArray allInstances();
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
Property: bundle
Get the bundle that this signal is contained in, if any.
DWSignal = bundle
Returns a DWSignal object reprenting the bundle containing this signal, or null if the signal is not in a bundle.
Method: bundleSignals
Returns an list of the signals contained in this bundle
SPArray = bundleSignals
Returns NULL if this signal is not a bundle, otherwise returns an SPArray of SPSignal objects representing the signals in the bundle.
Property: circuit
Gets the circuit containing this object. Read-only
DWCircuit circuit();
Method: connectByName
Connects another signal segment to this one by changing the other signal's name to match this one, making it visible if necessary, and disconnecting the other segment from others it may be attached to.
void connectByName(pin);
void connectByName(sig);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
sig | DWSignal | Any other signal. IMPORTANT: If this target signal has multiple segments connected by name, this method will rename only one of them, and it cannot be reliably predicted which segment it will be as it depends on construction order and can change due to editing operations. |
pin | DWPin | Any device pin that is connected to the target signal segment. The pin itself is not significant, it is only used as a way of identifying the attached signal segment. |
Returns true if the connection was changed successfully, false otherwise.
Method: connectTo
Connects this signal to a specified pin or signal, including optionally adding visible lines. This will result in this signal being merged with the other signal.
DWSignal = connectTo(pin);
DWSignal = connectTo(pin, visible);
DWSignal = connectTo(pin, xml);
DWSignal = connectTo(signal);
DWSignal = connectTo(signal, visible);
DWSignal = connectTo(signal, xml);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
signal | DWSignal | the signal to connect to. |
pin | DWPin | the pin to connect to. |
xml | String | An XML-format string providing more information on the connection. See below. |
visible | bool | true to add visible lines as needed to show the connection on the diagram. |
Returns a DWSignal object for the resulting signal (which may be this one) if the connection succeeded, null if not. This can fail if the source and destination are not compatible (e.g. are in different busses) or if visible is specified and the pins are not on the same page.
If visible is not specified, the source and destination will be logically connected (i.e. for simulation and netlisting purposes) but will not appear connected on the diagram. This may be more efficient for example if creating a circuit only for internal use and not for future editing.
IMPORTANT: This operation may result in this signal ceasing to exist after this operation! If you intend to keep accessing this signal for future operations, then replace it with the returned value from this method.
This method accepts an optional XML-format string which provides more detailed connection instruction. This string may specify the graphical routing information, new name for the completed signal, and, in the case of bundles, specific internal connections to make in the internal pins or signals of the bundle.
The following example illustrates connecting two bundle signals:
<ConnInfo newName="newBundle">
<SegPath>
<Point x="140" y="700"/>
<Point x="140" y="560"/>
<Point x="840" y="560"/>
</SegPath>
<Conns>
<Conn srcName="a" dstName="x" newName="ctrlA"/>
<Conn srcName="b" dstName="y" newName="ctrlB"/>
</Conns>\
</ConnInfo>
The keywords used in the string are described in the following table:
ConnInfo | A required outmost form containg the collection info. May have an optional attribute newName which specifies a signal name to be applied to the connected signals after all other connections are applied |
SegPath | A collection of points representing the graphical line routing for the connection |
Point | A single point in the SegPath routing info. Must have attributes x and y specified, which must be integer values aligned with the internal grdi (i.e. multiples of 70) |
Conns | A collection of connection items specifying bundle internal connections. Ignored for non-bundle connections |
Conn | An item specifying a single bundle internal connection. Has three attributes: srcName specifies the item in the source. If the source is a bundle signal, this is a signal name, if the source is a bundle pin, this is a pin name; dstName is the corresponding information in the destination. newName is an optional signal name to be applied to the joined internal signal. |
Property: emtpPhase
Get or set the phase of the signal, if any.
String = emtpPhase
emtpPhase = String
Returns a string which may be one of "0", "1", "3", "a", "b", "c".
The values allowed when when setting the phase are slightly different than the possible values when getting an existing phase. The value can be one of the following.
0 or 1 | Sets the line to "general" which will adapt to the attached devices, normally 1-phase for power pins |
3 | Set all the signal lines to 3-phase signal |
B | Set the signal lines to be 3-phase bus |
a | Sets the signal to phase A |
b | Sets the signal to phase B |
c | Sets the signal to phase C |
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
Method: getEMTPPhases
Gets the number of phases for this signal.
int getEMTPPhases();
Returns 3 for a 3-phase signal, 1 for a 1-phase power signal, 0 for a non-power signal, -1 for an error or conflict (shouldn't normally occur).
Property: instanceHierName
Gets or sets the selected physical instance of the circuit using its hierarchical name to identify it
String instanceHierName();
instanceHierName = String
The instance locator string identifies the currently selected unique physical instance of an object within a hierarchical circuit structure. Setting the instance locator does not change the locator of the definition object, it only selects one of the possible physical instances that can be represented by this definition. If the given instance locator is not valid for this definition, it is ignored. If it is valid and is different than the current selected instance and if the instance is in a displayed circuit, the display will be updated to reflect the change.
Property: instanceLocator
Gets or sets the selected physical instance of the circuit using its locator to identify it
String instanceLocator();
instanceLocator = String
The instance locator string identifies the currently selected unique physical instance of this object within a hierarchical circuit structure. Setting the instance locator does not change the locator of the definition object, it only selects one of the possible physical instances that can be represented by this definition. If the given instance locator is not valid for this definition, it is ignored. If it is valid and is different than the current selected instance and if the instance is in a displayed circuit, the display will be updated to reflect the change.
Property: isBundle
Returns true if this signal is a bundle.
bool = isBundle
This property is read-only.
Property: isSelected
Gets or sets the "selected" status of the signal
bool isSelected();
isSelected = bool
Setting this value to true is equivalent to calling select(false, false);
Property: lineColor
Gets or sets the line color for this signal.
int lineColor();
lineColor = int
Returns an integer representing the signal color. Zero means no color (i.e. the default), 1 - 20 are the built-in system colors, any 32-bit number with the top bit set (0x80bbggrr) will be used as a 24-bit RGB color.
Method: lines
Returns an array of DWLineSegment objects representing all the lines connected to this signal
SPArray lines();
Returns an SPArray object containing a DWLineSegment object for each line associated with this signal
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: lineStyle
Gets or sets the line style for this signal.
DWLineStyle lineStyle();
lineStyle = DWLineStyle
lineStyle = String
Returns a DWLineStyle object or null if none is set on this signal
If assigning a string value to this property, the string can be a style name or a GUID (Globally Unique Identifier) which specifies a style. If a name is used, line style definitions in the design will be checked first, then other locally-defined or hardwired styles.
Property: lineWidth
Gets or sets the line width for this signal.
int lineWidth();
lineWidth = int
Returns an integer representing the signal width. 1 means 1 pixel width at normal scale.
Property: locator
Gets the locator string of the circuit
String locator();
The locator string identifies an object within a hierarchical circuit structure and provides a unique way of identifying this object despite duplicate or non-existant names.
Property: name
Gets the name of the signal
String name();
This is a read-only property.
Property: objType
Returns a string with the name of this object class "DWSignal".
String = objType
Method: pins
Returns an array of DWPin objects representing all the pins connected to this signal
SPArray pins();
Returns an SPArray object containing a DWPin object for each pin attached to this signal
WARNING: This array becomes invalid if any subsequent script commands cause 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 the circuit containing this object is marked "read only". Note that this status primarily affects the user interface and does not prevent script methods from making changes to the circuit.
bool = readOnly
Method: remove
Removes (deletes) the associated signal from its circuit.
void remove();
Any subsequent references to this DWSignal object will fail with an exception since the associated circuit signal is gone.
Method: rotateAttribute
Rotates the attribute text on the diagram
void rotateAttribute(fieldName, rotation);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
fieldName | String | The name of the field to rotate |
rotation | int | The absolute orientation or relative rotation desired, in degrees, see comments below. This parameter is optional and defaults to -90 (rotate left 90) if not specified |
Method: select
Sets the associated signal to be selected, as if the user had clicked on it.
void select();
void select(show);
void select(show, deselOthers);
Parameters | ||
---|---|---|
Name | Expected Type | Description |
deselOthers | bool | Pass true to deselect all other circuit objects before selecting this one. Defaults to false. |
show | bool | Pass true to have the page containing the object opened and scrolled as needed to display it. Defaults to false. |
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.
If the given field name is not defined in the design's attribute table, it is added automatically. It is preferable to ensure that any fields used are already defined in the target design to make sure the settings are appropriate.
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 |