Components and instancing in 1.025

Forums: Components and instancing in 1.025
SketchUp Integrated Plugin (Integrated Plugin maintained by OTOY)

Re: Components and instancing in 1.025

Postby smicha » Sat Aug 04, 2012 11:01 am

smicha Sat Aug 04, 2012 11:01 am
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
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Components and instancing in 1.025

Postby smicha » Sat Aug 04, 2012 2:02 pm

smicha Sat Aug 04, 2012 2:02 pm
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
selected.jpg
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
smicha
Licensed Customer
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Components and instancing in 1.025

Postby rappet » Sat Aug 04, 2012 3:36 pm

rappet Sat Aug 04, 2012 3:36 pm
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
User avatar
rappet
Licensed Customer
Licensed Customer
 
Posts: 1962
Joined: Fri Apr 06, 2012 3:57 pm
Location: The Netherlands

Re: Components and instancing in 1.025

Postby smicha » Sat Aug 04, 2012 3:39 pm

smicha Sat Aug 04, 2012 3:39 pm
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
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Components and instancing in 1.025

Postby smicha » Sat Aug 04, 2012 5:06 pm

smicha Sat Aug 04, 2012 5:06 pm
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 400 times
tutorial_instances.rar
(4.04 MiB) Downloaded 427 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
smicha
Licensed Customer
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Components and instancing in 1.025

Postby rappet » Sat Aug 04, 2012 7:25 pm

rappet Sat Aug 04, 2012 7:25 pm
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
User avatar
rappet
Licensed Customer
Licensed Customer
 
Posts: 1962
Joined: Fri Apr 06, 2012 3:57 pm
Location: The Netherlands

Re: Components and instancing in 1.025

Postby TIG » Sun Aug 05, 2012 9:12 am

TIG Sun Aug 05, 2012 9:12 am
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
TIG
Licensed Customer
Licensed Customer
 
Posts: 536
Joined: Wed May 12, 2010 1:25 pm

Re: Components and instancing in 1.025

Postby smicha » Sun Aug 05, 2012 9:20 am

smicha Sun Aug 05, 2012 9:20 am
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
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Components and instancing in 1.025

Postby smicha » Sun Aug 05, 2012 11:22 am

smicha Sun Aug 05, 2012 11:22 am
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
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Components and instancing in 1.025

Postby smicha » Sun Aug 05, 2012 5:03 pm

smicha Sun Aug 05, 2012 5:03 pm
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
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland
PreviousNext

Return to SketchUp


Who is online

Users browsing this forum: No registered users and 9 guests

Thu Mar 28, 2024 8:21 pm [ UTC ]