Tuesday 18 July 2017

Add Legend to Parts List

Can we add a legend to our drawing PartsList?

You can add a Custom Part on your Parts List or you can add a Virtual Part in the assembly but those will obey the Parts List format and you can’t merge the cells into a single one. I don’t suggest you add Virtual Part to BOM anyway because it will show up higher up in assemblies and I doubt anyone would want that.

What other options we have?

Create a symbol which you call and place every time. If you set the leader visible “off” it will look like a bit of text floating around but the invisible leader will allow you to attach it to views, or other elements and it will move with those by magic.

Some prefer to hardcode it on the border or titleblock but that doesn’t allow for much customization except if you use a prompted entry type field.

I don’t expect anyone to follow this but you can also manage your entire Parts List in Excel and after adding the legend to the bottom, you can place the spreadsheet as custom table on the drawing.

All this being mentioned you can add your Legend to your Parts List Title which is a single cell but you need to format your code in word, or other text editing software or even better have an iLogic code to do that for you.

If you are not iLogic fan then you can type your text in word, copy it and paste it in the Title field in Parts List editor but the next code is very easy, just give it a try...

Here is the iLogic code to add a Legend to your ParsList. It has a preset list already but it accepts user prompted values as well.

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet

Dim oPartsLists As PartsLists

' Process the rule, wrapping it in a transaction so the 
' entire process can be undone with a single undo operation. 
Dim trans As Transaction 
trans = ThisApplication.TransactionManager.StartTransaction( _ 
        oDrawDoc, "Change Title of Parts List")
    'I assume you ony have one Parts List on the sheet
    'get current title
    oPartsLists = oSheet.PartsLists
    oTitle = oPartsLists.Item(1).Title
    'ask for Legend
    oLegend = InputBox("Enter Legend", "Legend", "Mach=Machined, Fab=Fabricated")

    'set title
    oNewTitle = oTitle + _
                vbLf + _
                vbLf + oLegend
    oPartsLists.Item(1).Title = oNewTitle
'finish the transaction


No comments:

Post a Comment