Jump to content
Sign in to follow this  
Pat Stanford

Replace Circle with Loci

Recommended Posts

Someone on the Vectorworks mail list asked for a way to replace 11,000 circles with loci at the centers of the circles. This script replaces every circle in a drawing with a locus point. If you only want to do some edit the criteria in the ForEachObject line and use Layer, Class, Lineweight, Color, etc. to limit the objects that will be acted on.

Use at your own risk.

Procedure Test;

{Replaces every circle in a drawing with a 2D loci at}
{the center of the circle. Use with care after backing up}
{the original drawing. Use at your own risk. Here there}
{be dragons. No warranty expressed or implied.   ;-)  }

{July 15, 2011}
{? 2011, Coviana, Inc - Pat Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}



Var		Hand1, Hand2	:Handle;
	Int1, Int2		:Integer;



Procedure DoAction(Hand3:Handle);
Var X1, Y1 : Real;

Begin
	Get2DPt(Hand3, 1, X1, Y1);
	Locus (X1,Y1);
	DelObject(Hand3);
End;

Begin
ForEachObject(DoAction,((ST=CIRCLE)));
End;

Run(Test);

Share this post


Link to post

Someone finally posted a request for the inverse of this this, a script to replace a loci with a circle, so here it is.

Procedure LociToCircle;

{Replaces every Loci in a drawing with a Circle}
{centered at the insertion point of the loci. Use with care after backing up}
{the original drawing. Use at your own risk. Here there}
{be dragons. No warranty expressed or implied.   ;-)  }

{Adjust the Const Radius = 1' to a unit an size appropriate to the requirement}
{All Circles created will use the default class, color, etc of the document.}

{January 28, 2015}
{July 15, 2011}
{© 2011-2015, Coviana, Inc - Pat Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}


Const	Radius = 1';

Var		Hand1, Hand2	:Handle;
	Int1, Int2		:Integer;



Procedure DoAction(Hand3:Handle);
Var X1, Y1 : Real;

Begin
	Get2DPt(Hand3, 1, X1, Y1);
	ArcByCenter(X1,Y1, Radius,0,360);
	DelObject(Hand3);
End;

Begin
ForEachObject(DoAction,((T=LOCUS)));
End;

Run(LociToCircle);

Edited by Pat Stanford

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×