Cable & Harness component names

<?xml encoding=”UTF-8″>By Adam Nagy

When iterating through the components of a Cable & Harness assembly you’ll find VirtualComponentDefinition‘s named like “HA_VC_xxx”:

...
Hard Drive:2
CD Ribbon Cable
CD Ribbon Cable
Ribbon Cable Connector:1
Ribbon Cable Connector:2
Ribbon Cable Connector:3
<strong>HA_VC_100:1</strong>
Power Supply Harness
Power Supply Connector:1
...

This does not line up with what you see in the Browser Tree. It’s because what’s listed there are not actually the components but just placeholders. If you select them and run a code like this then you can see that those parts are just ClientBrowserNodeDefinitionObject‘s:

Selectset

The Part Number of the VirtualComponentDefinition‘s resemble more how those components are represented in the Browser Tree, so you could use that instead:

Sub PrintHierarchyTreeRecursive(occs, indent)
Dim occ As ComponentOccurrence
For Each occ In occs
Dim pss As PropertySets
If TypeOf occ.Definition Is VirtualComponentDefinition Then
Set pss = occ.Definition.PropertySets
Else
Set pss = occ.Definition.Document.PropertySets
End If
Dim partNumber As String
partNumber = pss("Design Tracking Properties")("Part Number").value
Write #1, Spc(indent); occ.Name + ", " + partNumber
Call PrintHierarchyTreeRecursive(occ.SubOccurrences, indent + 2)
Next
End Sub
Sub PrintHierarchyTree()
Dim asm As AssemblyDocument
Set asm = ThisApplication.ActiveDocument
Open "C:tempassemblyparts.txt" For Output As #1
Call PrintHierarchyTreeRecursive(asm.ComponentDefinition.Occurrences, 0)
Close #1
End Sub

PartNumber

 


Comments

5 responses to “Cable & Harness component names”

  1. Hi, I want to know whether we can get the reference designator(refdes) parameter of the connectors through API. We need that to mark the connectors in drawings.
    Thanks

  2. I share this information quite a bit so I thought it would be helpful to me as well to have some of the best pins in one post..

  3. Adam Voges Avatar
    Adam Voges

    Writing in long form requires an almost Herculean ability to delay gratification.’
    Mobile Application Development

  4. thanks for sharing this
    Electrical Wire Harness Design | Wire Harness Manufacturing ?- SolidPro ES

  5. Thanks a lot for your efforts to produce such an impressive article
    Wire Harness Manufacturing

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading