Metrics or inches
-
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 said:
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...
-
@unknownuser said:
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]).mThat'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
-
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]
-
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
-
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]
Advertisement