We do that also with attributes comming out from SAP.
But we do that with "COMMON PROPERTY" Attributes. This is the only way to access attributes on symbols.
We have two attributes
MAPPING_GEPRUEFT (pin & pad mapping checked)
CELL_COMMENT (means PCB cell verified)
These attributes are updated via DxDatabook and can be reported in DxDesigner or Expedition. In the attachment you can find the DxDesigner version.
It only logs to the output console - I did not do it for a file.
In my opinion you should always check if there is an attribute you are searching for ....
Set Device = objComp.FindAttribute("Part Number")
if Device is Nothing then
>>>> found a device with attribute "Part Number"
if you don't do that you will end up with errors .....
So that is why I check each attribute and make flags out of it ....
CAD_Check_DX.vbs.zip 1.1 KB
thanks for your reply.
SYMSTATUS is a common property, We have this defined in netlist.prp file. It doesn't pass through DxDatabook though. Are you saying there is something in your code that should be able to extract this?
You can get the symbol attributes by calling comp.SymbolBlock.FindAttribute, or loop over the comp.SymbolBlock.Attributes collection.
To avoid the error if an attribute is not available, set a variable, and check if the object is Nothing, like this:
Dim attr, sAttrVal
Set attr = comp.FindAttribute(sAttrName)
If attr Is Nothing Then
Set attr = comp.SymbolBlock.FindAttribute(sAttrName)
If Not attr Is Nothing Then
sAttrVal = attr.Value
Another way to avoid errors is to use the statement "On Error Resume Next", and check the Err object after statements that might fail. Use this carefully, and restore the default error handling by issuing the "On Error Goto 0" statement. Google this for more info.
You can use the Scripting.FileSystemObject to access the file system, and write a recursive function that looks for files matching a name or wildcard. Here's a response to a similar question:
I'm making amateur progress thanks to you I was able to get the symbol level attribute, cool.
Now I'm a bit stumped on the syntax of your code for error checking.
Are sAttValue and sAttName just placeholders for whatever string variable I Set? Or are they actual DxDesigner known variables?
sAttrVal and sAttrName are variables, the code assumes that sAttrName is set before looking for the attribute, and sAttrVal will be read later in the script.
It might be clearer to think of this as a function that takestwo arguments, the component object and the attribute name, and returns the attribute value:
Function GetAttrValue(objComp, sAttrName)
Dim sAttrVal : sAttrVal = ""
Set objAttr = objComp.FindAttribute(sAttrName)
If objAttr Is Nothing Then
Set objAttr = objComp.SymbolBlock.FindAttribute(sAttrName)
If Not objAttr Is Nothing Then
sAttrVal = objAttr.Value
GetAttrValue = sAttrVal
The "s" and "obj" prefixes give readers of your script a clue as to the variable type, since VBScript is a typeless language.
Thanks John, with your help and a couple other resources, I've managed to complete the script and report what we want.
Also, thanks to Roger McNeil at mentor and the suggestion from wolfgang that was reiterated by all.
I have one more task and will be done for now.
I want to get the Partition name (library alias) where the component symbol resides.
The only thing I can find is the following method from the Automation and Scripting Reference.
SymbolPartitions.GetSymbolPartition(ByVal Index As Long, ByVal siCDBDesign As String) As String
There aren't any examples to help me decipher the stuff in parenthesis or "As String"?
This is what I have so far:
Set oPartition = SymbolPartiions.GetSymbolPartition()
which gives me a run-time error, Object required: "SymbolPartitions".
1 of 1 people found this helpful
You can get the symbol partition from the component using this statement:
sPartition = objComp.SymbolBlock.LibraryName
The SymbolPartitions object is a collection of the partition names defined for the project.
The "As String" terminology shows the types, in Visual Basic parlance.
dube, you're the man! Thanks.
this worked great, just had to change syntax objComp to Comp.
Could you recommend a good online tutorial or book to learn from? I find the automation material provided by Mentor very thourugh and definitive, but I need to get inside the meaning and understand how to apply with examples and such?
How did you wrap your brain around all this? Just ask for help like I'm doing or is there a book or online tutorial you found helpful?
Definitely check out http://supportnet.mentor.com/reference/tutorials/index.cfm?id=10393
It is based on the Expedition PCB automation model, but there is a ton of good information about VBScript and general automation techniques.