[Plugin] Center on Origin UPDATE May 23, 2013

Re: [Plugin] Center on Origin

Postby nesh70 » Sat Nov 02, 2013 4:39 am

nesh70 wrote:Hi!

Thanks for creating so useful SU plugin!

BTW, is there a way to center a model or component like the image B (not like the original script do - image A)?

Best regards!


I found out how to achieve it, changing the line

vector = point.vector_to [0,0,0]

to

vector = point.vector_to [0,0,model.bounds.height / 2]

:)
0

nesh70 
 

Re: [Plugin] Center on Origin UPDATE May 23, 2013

Postby TIG » Sat Nov 02, 2013 11:43 am

Why not use something like
vector = point.vector_to(model.bounds.center)
for the center, or
pt=model.bounds.center
pt.z=model.bounds.min.z
vector = point.vector_to(pt)

for the center-bottom
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Center on Origin

Postby babak » Sun Nov 03, 2013 10:03 pm

nesh70 wrote:
nesh70 wrote:Hi!

Thanks for creating so useful SU plugin!

BTW, is there a way to center a model or component like the image B (not like the original script do - image A)?

:)


I use this plugin for centering an object while setting it's bounding box bottom at 0 :

center_group_bottom.rb

You can find it at http://www.fsdeveloper.com/forum/showthread.php?t=71321

download link
http://www.fsdeveloper.com/forum/attach ... 1310763814
1

babak 
 

Re: [Plugin] Center on Origin

Postby nesh70 » Mon Nov 04, 2013 5:44 pm

babak wrote:
nesh70 wrote:
nesh70 wrote:Hi!

Thanks for creating so useful SU plugin!

BTW, is there a way to center a model or component like the image B (not like the original script do - image A)?

:)


I use this plugin for centering an object while setting it's bounding box bottom at 0 :

center_group_bottom.rb

You can find it at http://www.fsdeveloper.com/forum/showthread.php?t=71321

download link
http://www.fsdeveloper.com/forum/attach ... 1310763814



Thanks babak! It works perfectly! Just what I wanted!
0

nesh70 
 

Re: [Plugin] Center on Origin UPDATE May 23, 2013

Postby tsurfing » Sat May 10, 2014 3:48 am

Hi Chris,
Tried to enter the patch script at the start of this thread, but the the ruby script is different than what you quoted:

And here's another option. If you want it to reset the component rotation and scale, edit the ruby file in a plain text editor (like Notepad for example) and after the line:

if comp.typename == "Group" || comp.typename == "ComponentInstance"

add the two following lines:

t = Geom::Transformation.new
comp.transformation = t



This is it now:
sela.each do |e|
if e.is_a?(Sketchup::Group) || e.is_a?(Sketchup::ComponentInstance)
to_move << e
end

...
I need to zero out the components rotation/scale
What's your thoughts?

Terry
0

tsurfing 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Previous


 

Return to Plugins

Who is online

Users browsing this forum: alpunia, DenisGavrilyuk, L13291898300, magduss11 and 9 guests

Visit our sponsors: