SketchUcation Premium Membership

 

 

metrics or inches

metrics or inches

Postby Maggy » Mon Nov 26, 2007 5:10 am

I'm trying to use extrude_faces_along_normal.rb. My model is in meters. But when I try to extrude faces 16 meters, it does extrude exactly 16 inches. When I type in 16m instead of 16, nothing happens. I tried again after using a calculator to convert 16 meters to inches, typed in 630 but then the extrusion was much too long, didn't measure. (630 feet? 630 yards?)

Then I looked into this script, it looks extremely simple but I can't find where it decides wether to use inches, feet, yards, meters or whatever. I dived into "Programming Ruby", couldn't find the answer, searched the ruby forum... I'm lost.

BTW I do not know who wkai is, the writer of this ruby, but once I get it to work, it'll save me te manual extrusion of 19000 faces! Just in one project. I believe we, ruby downloaders, can't ever thank ruby writers enough for all the time they save us.

[Maggy]
Maggy
 
Posts: 116
Joined: Tue Mar 11, 2008 2:09 pm

Re: metrics or inches

Postby Juju » Mon Nov 26, 2007 5:11 am

Maggy wrote:I believe we, ruby downloaders, can't ever thank ruby writers enough for all the time they save us.

True, true. Thx to all the ruby programmers out there, even the ones I pay for scripts... ;)
Save the Earth, it's the only planet with chocolate.



Keeping things organised is not a sin. ;)
Juju
 
Posts: 1127
Joined: Mon Oct 22, 2007 1:45 pm
Location: Durbanville, Cape Town, South Africa.
Name: Julian Smith

Re: metrics or inches

Postby Didier Bur » Mon Nov 26, 2007 5:11 am

I dived into "Programming Ruby", couldn't find the answer, searched the ruby forum... I'm lost


All distances and lengthes are stored in inches in SU. Totally idiot IMHO, but that's the way it is.
Replace the following line: e.pushpull Float( dist[0])
with e.pushpull Float( dist[0]).m

That's it !

To convert a metric number in inches, for instance 16m, you can type in the Ruby console: 16.m and you'll get 629.92125984252

Cheers
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur
 
Posts: 1238
Joined: Wed Nov 14, 2007 10:07 pm
Location: Nancy, France
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: metrics or inches

Postby Maggy » Mon Nov 26, 2007 5:12 am

Thanks a lot!
It's all over the docs that SU internally only uses inches. But no simple explanation on how to change an imperial script to metrics. A bit strange (read: yes, idiot indeed).

I guessed, after looking into existing scripts, that .m somewhere should do the trick.
I probably tried
e.pushpull Float( dist[0])".m"
e.pushpull Float( dist[0].m)
e.pushpull Float( dist[0.m])
e.pushpull Float( dist.m[0])
plus several other places in the script.

And I already found out that in this case e.pushpull 630 gave an acceptable result after all. The first time I tried that I must have accidentally pushpulled a much smaller face than I thought.

[Maggy]
Maggy
 
Posts: 116
Joined: Tue Mar 11, 2008 2:09 pm

Re: metrics or inches

Postby Todd Burch » Mon Nov 26, 2007 5:12 am

If you want to change the default displayed unit in a model via Ruby, you have to change an Option (See Ruby Help>Classes>OptionManager). They are all stored in a Hash. If you want more help, lemme know.

Also, you might try typing in "16.meters" (no quotes).

Todd
Todd Burch
 
Posts: 909
Joined: Mon Nov 12, 2007 2:43 pm
Location: Katy, Texas

Re: metrics or inches

Postby Maggy » Mon Nov 26, 2007 5:13 am

Thanks Todd, I'll look into it in case I'm going to need it (likely) but Didier already solved it for this script.

[Maggy]
Maggy
 
Posts: 116
Joined: Tue Mar 11, 2008 2:09 pm

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Artisan Organic Toolset - a set of powerful organic modeling tools.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012



 

Return to Developers' Forum

Who is online

Users browsing this forum: No registered users and 3 guests