How to Access Placed Device Views by using Script ??
P1#2 From P1
Was this Helpful?
-
use the Device method GetViewIds(). example below in pseudo-vbscript. won't run but shows the basics
Set dev = CreateObject("CT.Device")
dev.SetId (id of the device you have selected)
Dim intViewCount, viewIds
intViewCount = dev.GetViewIds(viewIds) '<<< access device views
For j = 1 to intViewCount
dev.SetId viewIds(j)
Dim msg
msg = "Dev: " & dev.GetName() & " #" & dev.GetViewNumber()
e3.PutMessage msg
NextWas this Helpful?
1 -
thank you so much.
Can i Set attributes to respective View.???
Was this Helpful?
0 -
i am not sure that it is possible to set a view with an attribute. try it for yourself.
i've had issues where if i need to read an attribute off of a device and the device happens to be a view, the attribute will not be returned. this is why i don't think its possible to set the view with an attribute.
if it is necessary to store an attribute related to a view, i would store it as an attribute of the view symbol.
FWIW... in order to access the attribute of a device, script needs to check if the device object has a parent using GetOriginald(). If parent exists then need to set the ID to the OriginaId.
Dim intOrginalId
intOriginalId = dev.GetOriginalId()
If intOrginalId <> 0 Then
dev.SetId intOrginalId
End IfWas this Helpful?
1 -
Here am trying to assign attribute (UNIT OF MEASURE) in Existing View P1#2.
i tried but am not able to assign attribute to device.
but i can assign attribute to OriginalId() and not to the View(P1#2)
Was this Helpful?
0 -
i am not sure i understand your need to set Unit of Measure on a device view. this doesn't sound right.
if a component like a connector has an Unit of Measure set to "EACH", then the unit of measure for all devices of the connector should be "EACH".
if you had multiple views of the same device AND each device had the Unit of Measure BUT different values, then this would introduce conflicts within the data model.
therefore it should not be possible for a representation of a parent device to have attribute values different than its parent.
i recommend accessing Unit of Measure using the Component interface but you'd likely need to update your library so Unit of Measure is defined in the component.
if you have to apply Unit of Measure to a device, you'll need to set it at the parent device, not the view.
Was this Helpful?
0 -
Thank you bob.
In case of BoM Position attribute , i want to show BoM Position Value only in Particular View.
Was this Helpful?
0 -
If the connector symbol has the following:
- A TextType to show BoM Position
- BoM Position TextType is initially set to "Invisible" (check marked is set)
- BoM Position TextType is mapped to an attribute of BoM Position
Then either the user or a script could set the text type to be visible so that the value of BoM position appears in a particular view.
Was this Helpful?
0 -
through the script can i set the text type attribute(BoM Position) for DeviceView??
Was this Helpful?
0 -
the TextType belongs to the symbol.
i haven't tried this but presumably you would need to get a list of symbol Ids that belong to the device view. initialize the symbol object to the first ID found, then get a list of TextTypeIds and find the one that matches TextType. then set the text type visibility.
Was this Helpful?
0 -
(User Manual Process)
when ever we assign a BOM Postion in Device Properties (parent device ),
is it visible in all device Views???
Was this Helpful?
0 -
should be visible if your symbols have the BOM Position text type.
Was this Helpful?
0
Please sign in to leave a comment.
Comments
11 comments