I use the scripting language of pulsonix to generate specific partlists. Therefore the script runs well. Now I want generate datasheets from each part of my partlist. Each part might have different attributes. For example a capacitor has a ESR-Value and a resistor doesn’t. So I want to get a list of all attributes of a component in my partlist.
Here is a code example (VB Script) :
set Design = OpenDocument(„xxxxxxx.sch“) set PartsInList = Design.Components() set Writer = NewReportWriter() strFullName = Design.BasePathName() + ".html" Writer.Open strFullName, "", false Writer.ISHtml = true
for each Comp in PartsInList
- Code to catch all Attributes and their values - Loop to plot the attribute name and value
Writer.EndTable() Writer.Close() Writer.View()
I don't know how get all attributes from a component. The GetAttribute() function only gives one, which i know that it exists.
The Report-Maker is able to do that, but I have to use the script….
You can access the Attributes collection for most design items, simply by using the 'Attributes' function. If you open the Scripting Help file and find Component in the index, you will see in the shaded bar at the top that Component is derived from DesignItem. Click on DesignItem, and this takes you to the page that lists all the properties and methods for the base class. This includes Attributes, so you could write an inner loop in your code that goes something like:
for each Comp in PartsInList set CompAttr = Comp.Attributes for each Attr in CompAttr Writer.Write (Attr.Name & "=" & Attr.Value) next next
Of course, if you want to produce a table of attributes with the attribute names across the top and the values filled in where they exist for each component, you will have to do a bit more work. You can access the list of attribute names from the design itself, perhaps doing something like this:
set AttrNames = Design.AttributeNames for each AttrName in AttrNames if not AttrName.Predefined then Writer.Write(AttrName.Name) end if next
Hopefully that will be enough to get you moving towards what you are trying to do!