Jump to content

Select circles of same radius/diameter


Recommended Posts

I want to select all circles of the same size on a plan and replace with a symbol which will be the same radius. The select similar tool does not have radius as an option and custom selection menu does not have this option.

If I can select all circles in one hit and replace with a scaled symbol to match the circle radius that would be even better. Any ideas?

Link to comment

Pat Stanford posted a script for selecting lines of similar length back in 2012.

Can this be modified to select circles of same radius?

http://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=166219Post166219

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);

Link to comment

You are quite right and I thought that should work.

I just found to that none of the circles are exactly the same size. Object info palette said 12m. but in fact it was 12.0002m. same with all the circles.

Down to the document precision settings.

Thanks again for making me think.

Link to comment

Ok, then how about a way to do this with a tolerance.

Procedure SelectSimilarDiameterCircles;
{If the first selected object in the drawing is a Circle}
{this script gets the Diameter of that Circle and selects all}
{other Circles in the drawing that have a diameter within}
{the tolerance given}

{March 31.2015}
{© 2015 - Pat Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}


Var H1	:Handle;
ODiam, MinDiam, MaxDiam		:Real;
Tolerance : Real;	

Function Diameter(H3:Handle):Real;
Var X1,Y1,X2,Y2:Real;
Begin
GetBBox(H3,X1,Y1,X2,Y2);
Diameter:=X2-X1;
End;

Procedure DoIt(H2:Handle);
Var TDiam:Real;
Begin
TDiam:=Diameter(H2);
If ((TDiam > MinDiam) and (TDiam < MaxDiam)) then SetSelect(H2);
End;



Begin
If EvalStr(FSActLayer,ST)='Circle' then
	Begin
		Tolerance:=RealDialog('Enter Percentage Tolerance for Match without % sign. 5% = 5', '5') / 100;
		ODiam:=Diameter(FSActLayer);
		MinDiam:=ODiam*(1-Tolerance);
		MaxDiam:=ODiam*(1+Tolerance);
		ForEachObject(DoIt,((ST=Circle)));
	End
Else AlrtDialog('First Selected Object Must Be A Circle.');
End;

Run(SelectSimilarDiameterCircles);

Link to comment

No offense taken. Five key items.

1. Vectorscript is based on Pascal that I learned in college, so I had a head start.

2. I started learning a lot of this back when there was a lot less to learn.

3. I am a firm believer in automating as many tasks as possible. The normal rule is as long as it will take me less than 10 times longer to automate it than to do it by hand It is more fun to script it.

4. I am a big procrastinator and scripting is usually way more fun than what I am supposed to be doing.

5. Yeah, I probably am crazy ;-)

I just like to be helpful. I figure the more examples we have out there, the more people who will consider scripting and the better off the entire community will be.

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...