EAGLE Central Forums
Where the EAGLE community meets. Sponsored by Stratford Digital.

Home » CadSoft Support Forums » eagle.support.eng » Rotate group of objects about center point?
Rotate group of objects about center point? [message #153571] Tue, 21 January 2014 01:40 Go to next message
Glenn Jones
Messages: 77
Registered: January 2005
Member
Hi would like to rotate a group of objects 180 degrees about their
combined center. It is too difficult to accurately do this using the
mouse, how can get this done?

Glenn
Re: Rotate group of objects about center point? [message #153572 is a reply to message #153571] Tue, 21 January 2014 05:36 Go to previous messageGo to next message
warrenbrayshaw
Messages: 1750
Registered: January 2010
Location: New Zealand
Senior Member
On 21/01/2014 3:04 p.m., Glenn Jones wrote:
> Hi would like to rotate a group of objects 180 degrees about their
> combined center. It is too difficult to accurately do this using the
> mouse, how can get this done?
>
> Glenn

Hi Glenn

To rotate elements about a point on the board, I would do it thus:

Enter into the command line
Display NONE 21 23;
<enter>
Select MARK and click at the spot you call the center
Enter into the command line
rotate R180 (c>R0 0)
<enter>

The group pivots around the MARK by 180 degrees

HTH Warren
Re: Rotate group of objects about center point? [message #153573 is a reply to message #153572] Tue, 21 January 2014 06:00 Go to previous messageGo to next message
Glenn Jones
Messages: 77
Registered: January 2005
Member
On 1/21/2014 1:01 AM, warrenbrayshaw wrote:
> On 21/01/2014 3:04 p.m., Glenn Jones wrote:
>> Hi would like to rotate a group of objects 180 degrees about their
>> combined center. It is too difficult to accurately do this using the
>> mouse, how can get this done?
>>
>> Glenn
>
> Hi Glenn
>
> To rotate elements about a point on the board, I would do it thus:
>
> Enter into the command line
> Display NONE 21 23;
> <enter>
> Select MARK and click at the spot you call the center
> Enter into the command line
> rotate R180 (c>R0 0)
> <enter>
>
> The group pivots around the MARK by 180 degrees
>
> HTH Warren

Hi Warren, thanks for the response. I am having trouble manually finding
the exact center of the group. Is there anyway to tell Eagle to locate
the cursor to that point?

Thanks

Glenn
Re: Rotate group of objects about center point? [message #153575 is a reply to message #153573] Tue, 21 January 2014 06:34 Go to previous messageGo to next message
warrenbrayshaw
Messages: 1750
Registered: January 2010
Location: New Zealand
Senior Member
On 21/01/2014 7:25 p.m., Glenn Jones wrote:

>
> Hi Warren, thanks for the response. I am having trouble manually finding
> the exact center of the group. Is there anyway to tell Eagle to locate
> the cursor to that point?
>


Which center are you after? Is it the centroid of the group's pads, the
part outlines or all part objects including names and values?

Eagle cannot do it out of the box but a ULP could be written to do it.

Can you not rotate the group as I suggested earlier and then just move
the group as a whole to correct for any misplacement?

Warren
Re: Rotate group of objects about center point? [message #153590 is a reply to message #153575] Tue, 21 January 2014 14:48 Go to previous messageGo to next message
Glenn Jones
Messages: 77
Registered: January 2005
Member
On 1/21/2014 1:59 AM, warrenbrayshaw wrote:
> On 21/01/2014 7:25 p.m., Glenn Jones wrote:
>
>>
>> Hi Warren, thanks for the response. I am having trouble manually finding
>> the exact center of the group. Is there anyway to tell Eagle to locate
>> the cursor to that point?
>>
>
>
> Which center are you after? Is it the centroid of the group's pads, the
> part outlines or all part objects including names and values?
>
> Eagle cannot do it out of the box but a ULP could be written to do it.
>
> Can you not rotate the group as I suggested earlier and then just move
> the group as a whole to correct for any misplacement?
>
> Warren

Hi Warren, "Is it the centroid of the group's pads" is what i want.

I expected to be able to rotate the entire group in place so that I
don't have to try and relocate it afterward.

Sounds like a feature request now :)

Glenn
Re: Rotate group of objects about center point? [message #153596 is a reply to message #153590] Wed, 22 January 2014 07:08 Go to previous messageGo to next message
warrenbrayshaw
Messages: 1750
Registered: January 2010
Location: New Zealand
Senior Member
On 22/01/2014 4:14 a.m., Glenn Jones wrote:

>
> Hi Warren, "Is it the centroid of the group's pads" is what i want.
>
> I expected to be able to rotate the entire group in place so that I
> don't have to try and relocate it afterward.
>
> Sounds like a feature request now :)
>
> Glenn

Try the attached ULP
It rotates the group around the pad/smd centroid.

I suspect this is not what you want. I feel you are likely after
'transpose horizontally'

Warren




#usage "<b>Rotates a group of elements 180 degrees around the centroid of their contacts </b>"
"<p>"
"Turn off all layers except tOrigin and tPlace.<br>"
"Group the parts of interest and then run the UPL"
"<author>Author: Warren Brayshaw</author>"

// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED
int gridunit,X,Y,X1,Y1,X2,Y2, first =1;;
string cmd, result, unit;


//------------------------------------------------
real u2u(int val) {
switch (gridunit) {
case GRID_UNIT_MIC : unit = "mic"; return u2mic(val);
case GRID_UNIT_MM : unit = "mm"; return u2mm(val);
case GRID_UNIT_MIL : unit = "mil"; return u2mil(val);
case GRID_UNIT_INCH : unit = "inch"; return u2inch(val);
}
}
//------------------------------------------------

if (!board) {
dlgMessageBox("<hr><b>ERROR: This ULP will only operate in the board layout view.</b></hr><p>Switch to the board layout editor and re-run.");
exit(1);
}

if (board) board(B) {
gridunit = (B.grid.unit);
B.elements(E) {
if(ingroup(E)){
E.package.contacts(C){
if(first) { X1=C.x; X2=X1; Y1=C.y; Y2=Y1;}
else {
if(C.x < X1) X1= C.x;
if(C.x > X2) X2= C.x;
if(C.y > Y1) Y1 = C.y;
if(C.y < Y2) Y2 = C.y;
}
first = 0;
}
}
}
}
X = X1 + (X2-X1)/2;
Y = Y1 - (Y1-Y2)/2;
sprintf(cmd,"GRID FINEST;\nMARK (%f %f);\nROTATE R180 (C>R0 0);\nGRID LAST\n",u2u(X),u2u(Y));
//dlgMessageBox(cmd);
exit(cmd);
Re: Rotate group of objects about center point? [message #153610 is a reply to message #153596] Thu, 23 January 2014 13:58 Go to previous messageGo to next message
Glenn Jones
Messages: 77
Registered: January 2005
Member
On 1/22/2014 2:33 AM, warrenbrayshaw wrote:
> On 22/01/2014 4:14 a.m., Glenn Jones wrote:
>
>>
>> Hi Warren, "Is it the centroid of the group's pads" is what i want.
>>
>> I expected to be able to rotate the entire group in place so that I
>> don't have to try and relocate it afterward.
>>
>> Sounds like a feature request now :)
>>
>> Glenn
>
> Try the attached ULP
> It rotates the group around the pad/smd centroid.
>
> I suspect this is not what you want. I feel you are likely after
> 'transpose horizontally'
>
> Warren
>
>
>
Hi Warren,

First let me say thank you! for writing that ulp.

It works great in the board editor. I neglected to mention that I was
actually trying to rotate the pads in the package library editor. :)

For an enhancement it would be handy for the ulp to take a rotation
amount as my requirement this time was for 180 (transpose) when it could
be any amount.

Glenn
Re: Rotate group of objects about center point? [message #170347 is a reply to message #153610] Mon, 01 May 2017 10:27 Go to previous message
Peter Newman
Messages: 16
Registered: September 2015
Junior Member
Thanks a lot for the ULP Warren. I needed something to rotate a board by 45° in the board editor. Modified it and it works a treat :)

--
To view any images and attachments in this post, visit:
https://www.element14.com/community/message/221518
Previous Topic: Eagle 7.7 Download
Next Topic: Library for JST PH connectors
Goto Forum:
  


Current Time: Sun Jun 25 15:31:09 GMT 2017