Going from Zero to "How did I ever get along before that" in three minutes
The other day I heard about a little indicator app ( aka bookmarks-indicator ) for Ubuntu that sits nicely on the task bar and allows you to drill down through the disk hierarchy by simply mousing over the icon. It displays the folder names as you move through the system, auto expanding as you pause over a file name, showing individual files in each folder and opening them when you click. One minute I didn't even know I wanted this ability and three minutes later I wondered how I ever survived without it. The fact that is was just a couple dozen easy to read lines of python was even funner.
Jump ahead to this morning and I came across a bunch of lines that just needed to have one particular point removed from them. Long story, but on this particular job it happens on a fairly regular basis. Well I've always had a program to straighten a line, removing all points between to identified locations, but I just needed to delete one point, and doing it with a single click would just be that much easier. Granted EditVertex set to delete is 95% of the way to what I want but honestly sometimes you just need to step outside for a break to grab that last 5% especially if you can do so with a few lines of code. And let's be honest it's funner than working anyway.
Hence dellpt.py
print 'dellpt.py modified 9:06 AM 9/20/2016'
# Delete Line Point
'''
Copyright 2016 Dennis Shimer
Vr Mapping copyright Cardinal Systems, LLC
No warranties as to safety or usability expressed or implied.
Free to use, copy, modify, distribute with author credit.
Deletes a single point identified on a line.
'''
Ws=PyVrWs()
Line=PyVrLine()
while Line.Id() != -1:
Ws.UndoBegin(WsNum,"dellpt")
PntNum=Line.GetIdPoint ()
Line.DelPoint (PntNum)
Line.ReRec()
Line.Plot()
PyVrGr().Replot()
Ws.UndoEnd(WsNum)
No comments:
Post a Comment