Jump to content

Custom Selection Tool : select rectangles of a certain size


blimey

Recommended Posts

Hello, 

I would like to know if someone  knows a way to select all the rectangles of a certain height in a drawing. A tool like custom selection would be perfect. Except that custom selection allows to select all the rectangles, but not to downsize the selection with an extra criteria such as height or width... 

Would you know about how this could be done? I often Pat Stanford ideas about script and wondered if there would be something like that.

thank you for your help. 

Edited by blimey
Link to comment

How about this.  Tolerance in the script is set to zero so requires an exact match.  Change the value on line 16 of the script to set a tolerance for near matches.

 

Procedure SelectSameHeight;

{September 23, 2019}
{© 2019 Patrick Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}

{Using a selected rectangle as the source selects all rectangles}
{in the drawing with the same height using a user setable tolerance.}
{Tolerance is set by changing the value in the Const section of the}
{script.}

{No warranty expressed or implied. Use at your own risk.}
{Test on an inconspicuous sport before using}
{Here by dragons.}

Const	Tolerance=0";

Var	H1:	Handle;
	OrigHeight, ThisHeight:real;

Procedure Execute(HD:Handle);

	Begin
		ThisHeight:=HHeight(HD);
		If ((ThisHeight >= OrigHeight-Tolerance) AND (ThisHeight <= OrigHeight+Tolerance)) then SetSelect(HD);
	End;
	
Begin
	H1:=FSActLayer;
	DSelectAll;
	If (H1<> Nil) and (GetTypeN(H1)=3) then
		Begin
			OrigHeight:=HHeight(H1);
			ForEachObject(Execute,((T=RECT)));
		End
	Else
		AlrtDialog('A Rectangle Must Be Selected to use this command');
End;

Run(SelectSameHeight);

 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...