[Plugin] CenterPointAll.rb

[Plugin] CenterPointAll.rb

Postby TIG » Mon Jun 23, 2008 5:08 pm

Here's an updated version that adds a centerpoint to anything that's selected - Group, ComponentInstance, Line, Circle, Face etc.



Select / filter what you want c'pointing first and then run the script. Centerpoints are added at every bounding box center. It 'undoes' in one go...
8
Last edited by Rich O Brien on Sat Dec 08, 2012 1:49 am, edited 7 times in total.
Reason: Split topic
TIG
User avatar
TIG 
Global Moderator
 

Re: Set centre point on multiple objects?

Postby watkins » Mon Jun 23, 2008 6:09 pm

Dear TIG,

Your script uses the same name as Todd Burch's script, centerpoint.rb.

http://www.smustard.com/script/CenterPoint

An alternative name might be cPointEntity.rb to indicate that you select the entity or entities first (line, surface etc) before running the script.

Regards,
Bob
0

watkins 
 

Re: Set centre point on multiple objects?

Postby TIG » Mon Jun 23, 2008 6:13 pm

watkins wrote:Dear TIG,

Your script uses the same name as Todd Burch's script, centerpoint.rb.

http://www.smustard.com/script/CenterPoint

An alternative name might be cPointEntity.rb to indicate that you select the entity or entities first (line, surface etc) before running the script.

Regards,
Bob


I've renamed it "CenterPointAll.rb" (see earlier post...)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: Set centre point on multiple objects?

Postby Mr S » Tue Jun 24, 2008 8:25 am

Hi TIG,

Thanks for taking the time to create this script for me.
I will try it out today.

The name "CentrePointAll" describes exactly what is required.

Thanks again.

Mr S
=====
0

Mr S 
 

Re: Set centre point on multiple objects?

Postby juju » Tue Jun 24, 2008 12:39 pm

Sweet, thanks TIG. I'm shooting from the hip here but can someone create an icon for it so it can be placed on a toolbar? I'm using (I think) Jim's centrepoint ruby and icon as a reference.
0
Save the Earth, it's the only planet with chocolate.
User avatar
juju 
Premium Member
Premium Member
 

Re: Set centre point on multiple objects?

Postby david_h » Fri Jun 27, 2008 5:52 pm

Here's a problem I have. . ..If you create an ARC with the traditional Arc tool you can righ-clk on it and use the ARC CENTERPOINT rb to find the CENTER RADIUS Point of the arc. Very useful. I like that. BUT. . .and Here's the big BUT my friends . . .if you make an arc by stitching segments together via the WELD.rb and try to find the center point--you dont get teh option of using "Arc Centeroint" ruby, so I tried using the Centerpoint Rb. only finds the centroid of an implied closed figure as it were rather than the desired Radius point. Any insight you gurus could give on this would be greatly appreciated.
Thx,

Dl
centerpoint 1.jpg
centerpoint 2.jpg
0
If I make it look easy. . .then it probably is.
User avatar
david_h 
Top SketchUcator
 

Re: Set centre point on multiple objects?

Postby TIG » Fri Jun 27, 2008 7:26 pm

If you weld lines into a curve there's no guarantee that that 'curve' will have a 'centre' at all (draw some connected lines and weld them into a curve - where's its centre ?). So, if you have an exploded arc don't weld it back into a curve (an arc is a curve but a curve isn't an arc): just redraw the arc and then it WILL have a centre...

The following are different animals...
CenterPoint marks the 'centre of gravity' of the selection.
My CenterPointAll marks the centres of all selected objects individually.

.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: Set centre point on multiple objects?

Postby Jim » Fri Jun 27, 2008 8:55 pm

Hi David,

the API supports getting the center of an ArcCurve object. Once a curve is exploded, it no longer has a center (according to the API.)

What I typically do is create a new 2-segment arc over 2 of the existing segments - in essence tracing over 2 of the existing segments. Then you can use Arc Centerpoint on that arc.
0
Hi

Jim 
Global Moderator
 

Re: Set centre point on multiple objects?

Postby david_h » Fri Jun 27, 2008 9:05 pm

TIG wrote:If you weld lines into a curve there's no guarantee that that 'curve' will have a 'centre' at all (draw some connected lines and weld them into a curve - where's its centre ?). So, if you have an exploded arc don't weld it back into a curve (an arc is a curve but a curve isn't an arc): just redraw the arc and then it WILL have a centre...

The following are different animals...
CenterPoint marks the 'centre of gravity' of the selection.
My CenterPointAll marks the centres of all selected objects individually.

.

Understood, hence the question. However this CenterpointALL sounds intriguing. WHere does one find this?

thx
0
If I make it look easy. . .then it probably is.
User avatar
david_h 
Top SketchUcator
 

Re: Set centre point on multiple objects?

Postby david_h » Mon Jul 07, 2008 7:48 pm

I got the Centerpointall.rb. It's a good one , but not exactly doing what I need. It enabled me to do a workaround for my specific case, but I guess what is needed is a script that will find the Radius point of an arc even if SU doesn't recognize it as an arc per se.
0
If I make it look easy. . .then it probably is.
User avatar
david_h 
Top SketchUcator
 

Re: Set centre point on multiple objects?

Postby plot-paris » Tue Jul 08, 2008 8:43 am

so basically you need a "geometric shape recognizer".

that would be a wonderful thing, by the way. imagine you have a complicated curved form consisting of loads of small lines and SketchUp simplifies it into (for example) three curves.

the plugin could have some correction-freedom settings too. for example if it recognizes two arcs in a shape which connecting bits are almost tangential, SU could correct the position of the connectin point slightly to match a perfect tangent...

that would be awesome! :?
0
User avatar
plot-paris 
 

Re: [Plugin] CenterPointAll.rb

Postby david_h » Tue Jul 08, 2008 3:08 pm

Oui! C'est Ca! Where are these RUBY GURUS when you need them? (jk) :oops:

Im sure they don't have anything else to do but respond to my whining. :D
0
If I make it look easy. . .then it probably is.
User avatar
david_h 
Top SketchUcator
 

Re: [Plugin] CenterPointAll.rb

Postby JClements » Tue Jul 08, 2008 3:32 pm

When I have time, I often draw over "apparent" arcs and circles because I can then use Entity Info to verify radii of piping and to facilitate the extrusion of smoothed-surfaces and improve exporting .SKP's to other formats.

I think the bottom line is you'd need a basic script (using the model context or selection) to find series of contiguous segments, then analyze them to determine if they have the characteristics of an arc.

For instance: are all segments of equal length and are all of their common angles equal (there may be more conditions that I haven't thought of)? If all segments touch one another, then are they a polygon or a circle?

If such a script can be developed, then it could be used as a common routine called by other scripts such as pipe-along-path or used on intersected geometry. Once the script qualifies the segments, it could then automatically redraw them, make centerpoint guides, etc.
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] CenterPointAll.rb

Postby david_h » Tue Jul 08, 2008 5:05 pm

Yeah. . .what he just said. .. uh Huh. I think

Anyway. .. I just want to find the Radius point of any curve be it arc or no. anything else, above that . . ..Gravy.
0
If I make it look easy. . .then it probably is.
User avatar
david_h 
Top SketchUcator
 

Re: [Plugin] CenterPointAll.rb

Postby plot-paris » Tue Jul 08, 2008 5:29 pm

JClements, that would be a damn handy tool and a wonderful addition to the weld-script...
0
User avatar
plot-paris 
 

Re: [Plugin] CenterPointAll.rb

Postby watkins » Tue Jul 08, 2008 5:54 pm

Dear David_H

You can use the protractor to find the centre of an arc or circle. Snap the tool to the mid-point of a segment and then click on the end of that segment (you have a choice of two points). Rotate the protractor 90 degrees to create a construction line along the segment's normal (located at mid-point). Repeat for a second segment. The centre point is marked by the crossing of the construction lines.

A ruby script might work in the same way.

Activate the tool, and moving either clockwise or anticlockwise (but not both):

Click first end point, segment 1
Click second end point, segment 1
Click third end point, segment 2
Click fourth end point of segment 2
Ruby computes equations of normals at mid-points of segments 1 and 2
Ruby computes coincident point to yield x,y,z value of centre point

Variations:

Segments 1 and 2 are start and end segments of arc = redraw arc (input = number of segments)
Segments 1 and 2 are connected = redraw circle (input = number of segments)

I am not a script writer, but the above would seem do-able.
0

watkins 
 

Re: [Plugin] CenterPointAll.rb

Postby david_h » Tue Jul 08, 2008 6:47 pm

Watkins. Yeah, I had been doing that. I was just hoping for a one-click solution. Cuz I ain't no Ruby Writer Neither. . .sigh! :roll: But thanks for the input.
0
If I make it look easy. . .then it probably is.
User avatar
david_h 
Top SketchUcator
 

Re: [Plugin] CenterPointAll.rb

Postby Jim » Tue Jul 08, 2008 8:49 pm

David_H wrote:Watkins. Yeah, I had been doing that. I was just hoping for a one-click solution. Cuz I ain't no Ruby Writer Neither. . .sigh! :roll: But thanks for the input.


Dave,

You might have more luck if you start a new request thread in the Ruby forum.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] CenterPointAll.rb

Postby rosbourne » Wed Sep 02, 2015 6:45 pm

Thanks.. Now more easier to make center point
0

rosbourne 
 

Re: [Plugin] CenterPointAll.rb

Postby ship69 » Fri Dec 18, 2015 2:01 pm

Does this video have sound? It's coming out silent on my PC.
0

ship69 
 

Re: [Plugin] CenterPointAll.rb

Postby Dave R » Sun Dec 20, 2015 2:30 pm

ship69 wrote:Does this video have sound? It's coming out silent on my PC.


No. It's a silent video.
0
%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] CenterPointAll.rb

Postby Einstein » Tue Jan 02, 2018 1:07 am

Thanks TIG :D

This simple tool helps me rotating components around their centerpoints which is quite complicated in SU.

It would be even more handy if a created centerpoint was interactive, I mean: changed with scaling and moving component or group it's based on. But I realise that would be also much more complicated code.
0

Einstein 
 

Re: [Plugin] CenterPointAll.rb

Postby Box » Tue Jan 02, 2018 1:20 am

Einstein wrote: rotating components around their centerpoints which is quite complicated in SU.


To rotate about the midpoint of a group or component, use the rotation handles that appear when you use the Move tool.
0
User avatar
Box 
 

Re: [Plugin] CenterPointAll.rb

Postby sarkarshomit » Wed May 16, 2018 5:44 am

Can't get it working in sketchup 2018.working fine in skup16, but not in 18...any help if i am doing something wrong!!
0

sarkarshomit 
 

Re: [Plugin] CenterPointAll.rb

Postby Dave R » Wed May 16, 2018 11:33 am

sarkarshomit wrote:Can't get it working in sketchup 2018.working fine in skup16, but not in 18...any help if i am doing something wrong!!


Evidently you are doing something wrong. I just installed it in SU2018 and ran it. It works fine. How did you install it? Where did you install it? Do you have Guides set to show in the View menu?
Screenshot - 5_16_2018 , 5_31_16 AM.png
1
%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] CenterPointAll.rb

Postby sarkarshomit » Wed Jun 13, 2018 10:11 am

Dave R wrote:
sarkarshomit wrote:Can't get it working in sketchup 2018.working fine in skup16, but not in 18...any help if i am doing something wrong!!


Evidently you are doing something wrong. I just installed it in SU2018 and ran it. It works fine. How did you install it? Where did you install it? Do you have Guides set to show in the View menu?
Screenshot - 5_16_2018 , 5_31_16 AM.png



Thanks for the help.

Strangely in skup16, the plugin shows up in plugins menu named as "set centerpoint".
And in skup18 it shows up in extensions menu as "Add centerpoint".

So finally its working for me. Thanks again.
0

sarkarshomit 
 

Re: [Plugin] CenterPointAll.rb

Postby Box » Wed Jun 13, 2018 11:51 am

Sounds like you may have had a different extension installed in 2016. There is one called Set Centerpoint.
Tig's shows for me in 2016 as Add Centerpoint.
0
User avatar
Box 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: Google Bot, ucation2018 and 8 guests

Visit our sponsors: