What is the fastest way to select all components in DxDesigner by part number using automation?
Do I need to go through each component on each sheet in the design and then look for the desired attribute?
It's an easy code.
Set pats = pcbDoc.Parts("ABC")
pats.Selected = True
Hi Satoru. Thanks for the suggestion. However, I updated my question to be specific to DxDesigner.
Please refer to this code.
Dim cmp, attr
Const pNo = "ABCD"
For Each cmp In dxdView.Query(VDM_COMP, VD_ALL)
Set attr = cmp.FindAttribute("Part Number")
If Not attr Is Nothing Then
If attr.Value = pNo Then
cmp.Selected = True
Thanks for the suggestions. The basics answer to my question is that you cannot select all components by part number in a design with automation, you must open each sheet of the design and then select them. I have my code working now.
The parts number of all the sheets can be checked by a DesignComponents method.
Next, The SelectPath method can open and select the sheet with which the symbol was placed using UID.
But, selection is unmaintainable...
schName = dxdApp.GetProjectData.GetiCDBDesignRootBlock(dxdApp.GetActiveDesign)
For Each cmp In dxdApp.DesignComponents("", schName, -1, "STD", True)
If attr.EitherValue = pNo Then
Call dxdApp.SelectPath(schName, cmp.UID, "", 0, True, False)
Hello Satoru. This information is helpful and is similar to the approach my colleague and I discussed. Using this methodology, I can quickly find the pages that have the part numbers that I want to replace. I can then open those pages only, instead of all pages, and make my selection and subsitution.
Look in your release tree for ExcelCompList.xls it is a factory example that deals with parts and is crossprobable with Excel. It should be in this directory: SDD_HOME\standard\examples\pcb\Automation\Excel
When it comes up It should be on the Introduction tab. Mash the Start button and it will populate the Components tab with the parts from your design (Only have one expedition open becasue it is running out of process and will only talk to the first Expedition session you have open)
Now the component tab willhave all the part numbers in your design:
Oh by the way, if your parts and not locked and have no fixed/locked traces/vias on them you can edit the location and rotation in the Excel spreadsheet and watch the part move in your design.
It will run a little slow, it is an out of process script and writing a lot of data to Excel.
Now that you have the really cool basic script under your belt, there are other examples of this theme in the AATK/vbs/Excel directory. The one that may interst you is bom_test.xls. It will package all the parts by part number and let you select all them at one time. AATK can be downloaded from: http://sourceforge.net/projects/uwtoolbox/
Hi Kendall. I mistakenly left of a minor detail of my question... I am looking for a way to do this in DxDesigner. Thanks.
No habla DxDesigner Automation.
Retrieving data ...