Components and instancing in 1.025

SketchUp Integrated Plugin (Integrated Plugin maintained by OTOY)
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

smicha wrote:

Code: Select all

SU:
1 2 3 4
5 6 7 8 
9 10 11 12 
13 14 15 16
Sorry,
It is obviously

Code: Select all

SU:
0 1 2 3
4 5 6 7
8 9 10 11 
12 13 14 15
.....
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

TIG,
I DID IT !!! BUT your further help is needed :)

Look at screenshots.

Before running the script I moved one of the copy of components into the project origin, to make its axes overlapping axes of the project. Then selected it and type command for running the script.


The last (I hope) thing to input into your code is to make set axes of selected component equal to [0,0,0]. Is it possible?

Thank you again! So much!!!
Attachments
octaneDONE.jpg
Reference component must be have identical axes as entire sketchup project
Reference component must be have identical axes as entire sketchup project
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
rappet
Licensed Customer
Posts: 1962
Joined: Fri Apr 06, 2012 3:57 pm
Location: The Netherlands
Contact:

smicha wrote:TIG,
I DID IT !!! BUT your further help is needed :)

Look at screenshots.

Before running the script I moved one of the copy of components into the project origin, to make its axes overlapping axes of the project. Then selected it and type command for running the script.


The last (I hope) thing to input into your code is to make set axes of selected component equal to [0,0,0]. Is it possible?

Thank you again! So much!!!
Hi Smicha, congrats in reaching your goal.
Can you explain now what exactly you can do fromout Sketchup?
greetings

4090+3089ti & Quad 1080ti
ArchiCAD25, ofcourse Octane & OR-ArchiCAD plugin (love it)
http://www.tapperworks.com
http://www.facebook.com/pages/TAPPERWOR ... 9851341126
http://www.youtube.com/user/Tapperworks/videos
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

rappet wrote:Can you explain now what exactly you can do fromout Sketchup?
greetings
Yes,
I am just preparing short tutorial.
Let you know soon.
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

TUTORIAL - COMPONENTS TO OCTANE INSTANCES
First beta version of Sketchup plugin (ruby file) exporting components as instances to Octane
The code of instances.rb is written by TIG, I added some changes to rotation matrix. TIG - thank you so so so much!


1. Download instances.rb file into C:\Program Files (x86)\Google\Google SketchUp 8\Plugins
2. Follow steps from pdf - screenshots.
Attachments
instances.rar
Download this file into C:\Program Files (x86)\Google\Google SketchUp 8\Plugins
(444 Bytes) Downloaded 430 times
tutorial_instances.rar
(4.04 MiB) Downloaded 461 times
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
rappet
Licensed Customer
Posts: 1962
Joined: Fri Apr 06, 2012 3:57 pm
Location: The Netherlands
Contact:

smicha wrote:TUTORIAL - COMPONENTS TO OCTANE INSTANCES
First beta version of Sketchup plugin (ruby file) exporting components as instances to Octane
The code of instances.rb is written by TIG, I added some changes to rotation matrix. TIG - thank you so so so much!


1. Download instances.rb file into C:\Program Files (x86)\Google\Google SketchUp 8\Plugins
2. Follow steps from pdf - screenshots.
I tried it and it works perfectly. This is great stuff !!!!
Thanx TIG, thanx Smicha.

I am perfecting an excel for making csv-files for general rows, matrices and scattered matrices.
I'll let know when I think it's usable for others when I have it working even betetr and tested for different things I am making it for. Dspite this fantatistic plugin I will finish the excel matrix, because I think it can be very helpfull for making general cvs and scattered matrices as a stand alone. i.e. to add trees to the ocs-scene.. or birds in the sky...

But this SU-plugin is great for stuff for what is very hard to make with only numbers in excell.. I can think of lot of things to do with it.... thanks so much for this.
Attachments
prntscrn.jpg

4090+3089ti & Quad 1080ti
ArchiCAD25, ofcourse Octane & OR-ArchiCAD plugin (love it)
http://www.tapperworks.com
http://www.facebook.com/pages/TAPPERWOR ... 9851341126
http://www.youtube.com/user/Tapperworks/videos
User avatar
TIG
Licensed Customer
Posts: 536
Joined: Wed May 12, 2010 1:25 pm

Well done !
I knew you could do it.
Sorry I was too busy not to be of more help...

A couple of things. ;)

If the .rb file is already in the Plugins folder when you startup Sketchup you can skip the load "instances.rb" step as it will have auto-loaded itself anyway.

Can I suggest you wrap the working code in a 'module' and run it thus:
SMICHA.instances
The module version becomes:

Code: Select all

module SMICHA
def SMICHA.instances()
  ### REST of method code goes here ###
end#method
end#module
Adjust the module name to your own taste...
That way it should never clash with anything else - after all a raw 'instances[_test]' is a pretty common name otherwise...
Last edited by TIG on Sun Aug 05, 2012 9:29 am, edited 2 times in total.
TIG
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

TIG,
Is it possible to set selected component's axes to [0,0,0] in the code ?
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

TIG wrote:Can I suggest you wrap the working code in a 'module' and run it thus:
SMICHA.instances
The module version becomes:

Code: Select all

module SMICHA
def SMICHA.instances()
  ### REST of method code goes here ###
end#method
end#module

TIG,

1. What I am doing wrong:

Code: Select all


module SMICHA 
def SMICHA.instances()

require 'sketchup.rb'

	def octane_scatter_data()
		model=Sketchup.active_model
		instances=model.selection[0].definition.instances
		txt=""
		instances.each{|instance|
		  tr=instance.transformation.to_a
		  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)]
		  str=""
		  tt.each{|e| str<<sprintf("%.4f ",e) }
		  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

end#method
end#module

2. I also would like it to run it from a pull down menu in plugins:

Code: Select all

UI.menu("PlugIns").add_item("OCTANE scatter data from components") {
  UI.messagebox("......") 
}
How to add it into the code?

3. And what about my previous post and the question about setting axes of selected component into origin?
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Rotation along red axes problem

The script works properly only for rotated along green or blue axes (and should work properly for joint rotation along vector in "green-blue space" - I didn't test it yet). I'll try to fix it.
Attachments
RGBrotation.jpg
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
Post Reply

Return to “SketchUp”