Pat Stanford Posted February 13, 2012 Share Posted February 13, 2012 The following script selects all lines the same length as a selected line. Procedure SelectSameLengthLines; {If the first selected object in the drawing is a line} {this script gets the length of that line and selects all} {other lines in the drawing that have the same length.} {February 13, 2012} {? 2012, Coviana, Inc - Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} Var H1 :Handle; OLength :Real; Procedure DoIt(H2:Handle); Begin If HLength(H2)=OLength then SetSelect(H2); End; Begin If GetType(FSActLayer)=2 then Begin OLength:=HLength(FSActLayer); ForEachObject(DoIt,((T=LINE))); End Else AlrtDialog('First Selected Object Must Be A Line.'); End; Run(SelectSameLengthLines); Quote Link to comment
Pat Stanford Posted March 31, 2015 Author Share Posted March 31, 2015 I just posted a similar script but for the circles of similar diameter at: https://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=209693Post209693 Quote Link to comment
peterlukejenkins Posted September 11, 2015 Share Posted September 11, 2015 Late reply but this came up in a search for some similar functionality. I'm trying to find a way of selecting all lines of shorter length than my first selected line - I tried modifying your script but to no avail (my scripting experience is very very limited!) Incidentally, I also tried just running it as it is and it did nothing - no errors, no selections, nothing. Also tested it on a circle to see if it would produce the error message but that also produced nothing. Any clues what I'm missing? Quote Link to comment
Pat Stanford Posted September 11, 2015 Author Share Posted September 11, 2015 Try this: Procedure SelectShorterLines; {If the first selected object in the drawing is a line} {this script gets the length of that line and selects all} {other lines in the drawing that have a shorter length.} {September 11, 2015} {February 13, 2012} {© 2015, Pat Stanford pat@coviana.com} {© 2012, Coviana, Inc - Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} Var H1 :Handle; OLength :Real; Procedure DoIt(H2:Handle); Begin If HLength(H2)End; Begin If GetType(FSActLayer)=2 then Begin OLength:=HLength(FSActLayer); DSelectAll; ForEachObject(DoIt,((T=LINE))); End Else AlrtDialog('First Selected Object Must Be A Line.'); End; Run(SelectShorterLines); I changed the comparison in the DoIt routine from = to <. I also added a DSelectAll function in the main routine so you will only have lines shorter that the original selected at the end, not the shorter lines plus the original line. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.