LDView Parts List Sorter v1.1


LDView Parts List Sorter v1.1
#1
I wrote this for myself but I'm posting it here in case it is of use to anyone else.

This is a browser javascript bookmarklet that can be run on an html parts list produced by LDView's "Parts List" function to provide these additional features:
  • Dynamic re-sorting of parts list by any column(s)
  • Repair of missing part images
  • Color swapping of part images

Compatibility
Tested successfully with LDView 4.1 and 4.2b1 generated parts lists.
Tested successfully with various versions of Firefox, Chrome and Opera, and will probably work on other mainstream desktop browsers too. Internet Explorer has restrictive bookmark length limitations that stop the full version of the script working, so I've included a "shortened" version that includes the sorting functionality but omits the image manipulation functionality.

Setup
http://pastebin.com/t5pbHxFY (v1.1 - Full Version)
http://pastebin.com/LdadR27g (v1.1s - Shorter Version, see compatibility above)
  1. Visit the relevant link above.
    (I can't post the script here because this forum damages the script (even using "quote" or "code").)
  2. Copy the entire contents of the RAW Paste Data box to your clipboard.
  3. Create a new bookmark in your browser.
  4. Edit the properties of the bookmark.
  5. Paste the copied script from above into the location/URL box.
    Verify the paste begins with javascript: and ends with (document); as some browsers will chop the end of the script off rendering it useless.
  6. Set the bookmark name to something useful, like "LDView Parts List Sorter".
  7. Save the bookmark.

Usage
  1. Open an LDView generated html parts list in your browser.
  2. Click on the bookmark to run it.
The opened parts list will be modified to have the following new features:
  • Click on a column header to re-sort the parts list by that column. Click the same column header again to reverse sort order. Each sort is a result of the previous sort, so multi-index sorting can be achieved - if you sort by color and then by quantity then parts will be primary sorted by quantity and secondary sorted by color whenever the quantities match, and so on.
Also, if using the full version of the script, and if you had the "Part" column enabled from LDView with "Show part images":
  • If a part has no image due to the LDView 4.1/4.2B1 "shortcut" bug whereby LDView doesn't generate an image link because it mistakenly believes the part is not an official part, then clicking on the part number will override this decision and attempt to fetch an image for this part using your chosen color.
  • If any part has no image due to Peeron not having an image in your chosen color, then clicking on the part number will prompt you to enter a new color number for the image. Colors 0-15 (and especially 7) will increase the chances of an image now appearing, although there are still parts for which Peeron doesn't have an appropriate image to show for any color.
  • If you click on a part number and enter a new color in the form =7 then the addition of the = causes it to search & replace the images of all parts matching the original color of the part you clicked on with the color 7. Whilst this can be used to swap any color for another globally, it is most useful for models that use color 16, since LDView outputs this as color -1 (which results in missing images) and you can use this feature to generate images with a usable example color. The = feature only works if you had the Color column enabled within LDView when generating the parts list. You can also use the form ==7 to force all part images to color 7 for example.
You can print or screenshot modified parts lists, but it's likely you won't be able to save them using the browser's "Save Page As" function since this will just save a copy of the original file again. If you want to save them you can do so by saving the output of the "View Generated Source" function from Chris Pederick's "Web Developer" browser add-on (Firefox, Chrome, Opera). Note that if you do this, the saved html file contains changes made by this script in order for it to function, so if you later open that new version of the parts list you won't need to run the script on it again to continue using the new features, but you also won't be able to run a newer version of this script on such a modified parts list - it will only ever run on an original parts list from LDView.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 2 Guest(s)