TIG,smicha wrote: 1 0 0 2 0 1 0 3 0 0 1 4
First, sixth, eleventh ones must be equal to one - they are responsible for scaling along X Y Z axes respectively (or X Z Y in octane, ZY swapped)
Sorry again

TIG,smicha wrote: 1 0 0 2 0 1 0 3 0 0 1 4
First, sixth, eleventh ones must be equal to one - they are responsible for scaling along X Y Z axes respectively (or X Z Y in octane, ZY swapped)
TIG,TIG wrote:Put the code into a .rb file and load it in the Ruby Console.
To test export an OBJ of an instance placed at the origin, that's neither rotated nor scaled.
Place some more instances and select one and type in the Ruby Console to run it...
csv_test
To make it truly 'CSV' seen the 'sprintf' note in the code.
Code: Select all
r,r,r,0
r,r,r,0
r,r,r,0
x,y,z,1
Code: Select all
r,r,r,x
r,r,r,y
r,r,r,z
Code: Select all
require 'sketchup.rb'
###
def txt_test()
model=Sketchup.active_model
instances=model.selection[0].definition.instances
###
txt=""
instances.each{|instance|
tr=instance.transformation.to_a
tt=[tr[0],tr[4],tr[8],tr[12].to_m, tr[2],tr[6],tr[10],-(tr[14]).to_m, tr[1],tr[5],tr[9],tr[13].to_m]
str=""
tt.each{|e| str<<sprintf("%.4f ",e) }
### "%.4f," for a Comma
txt<<str+"\n"
}
###
path=File.dirname(model.path)
file=File.join(path, model.title+"_"+instances[0].definition.name+".TXT").tr("\\","/")
f=File.new(file, "w")
f.puts(txt)
f.close
end
Code: Select all
SU:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Code: Select all
Octane:
0 2 -1 3
8 10 9 11
-4 6 5 7
12 14 -13 15
Code: Select all
tt=[tr[0],tr[8],-(tr[4]),tr[12].to_m, tr[2],tr[10],tr[6],tr[14].to_m, -(tr[1]),tr[9],tr[5],-(tr[13]).to_m]