I you want nice (well nicer) dialog boxes you could do a html/js one using WebDialog 
AdamB
I you want nice (well nicer) dialog boxes you could do a html/js one using WebDialog 
AdamB
Nice idea. And trivial to do.
dialog = UI::WebDialog.new
dialog.set_url "filepath_to_document.pdf"
dialog.show
Voila!
FWIW I think the WebDialog is a really underused facility of SU - it opens up all the functionality of your browser to SU.
Well perhaps I was just grumpy last night.
But that link shows what I know, which is a simple for-loop is around 10% faster for pretty much zero loss in readability. I'll take the 10% thanks.
There is a real danger with Ruby of not understanding how much work you're asking for in using these cool constructs. Look at the Struct stuff - obscenely slow. Ditto expressions in which one is making Ruby do a lot of copying behind the scenes. It might look nice and compact on the outside, but... And some of the self-serving arguments you hear about "hardware is cheap" are a bit, well, self serving!
</rant_off>
Bon weekend!
Hmm. When I first came across Ruby I was enamored with these constructs. However, there is no such thing as a free lunch and the fact is that they are all slow. For my stuff, significantly slower than plain old simple for-loops - now you can argue they're semantically identical until your blue in the face.. Not as sexy, I know, but I'm old and wise and detest fancy language features that have hidden costs almost as much as I detest feats-of-engineering for engineering's sake. Been there, done that, got the t-shirt. Move on. 
Adam
I use XCode as my development IDE which works great as my project has Ruby, C, C++, Javascript and HTML files (for that special "syntax-overload" feeling!). However, for Ruby only, XCode is generating madly indented function-menu pop-ups.
I just spent some time figuring out what is going on and it turns out to be just that it gets confused by loop constructs which have an optional "do" keyword. (Guess the parser for syntax coloring is too picky).
eg:
for faces in container do
blah
end
causes the function menu pop-up to be wrong. Removing the (unneccessary) "do" fixes it.
Anyway, hope this tidbit helps others.
Ah (so this doesn't work on Macs I guess). However, QHull does a great job - I've used it for many years. If SketchyPhysics doesn't use convex hulls it probably should rather than do full prim.prim collision wrt performance.
re: convex hull
Wonder if its of any use for SketchyPhysics? (Though I'm not sure whether it uses GJK searching.) Anyone?
You say it didn't make the hole in the wall, but did it do anything? ie Is it that it just didn't make a good cut?
Adam
Yes, having done the 40% of the work to show a prototype I'm very hard at work doing the other 90% to make it a product. 
As promised, here's a grab of the ambient occlusion lighting (BTW 3.6 seconds to generate):

Adam
Does anyone understand the bizarre parts hierarchy in Sketchup? As Didier says the parent of a group is a quasi anonymous Definition (called "Group#N"). So you get things like group.entities.parent != group which caught me out!
chouette!
I've thought for some time this is the way forward to get high density content without superhuman efforts. Its something I proposed at EA some years back. But in some sense you might want to have this functionality bound to materials and not be an interactive thing. I envision ceiling materials that can spawn light fitting that satisfy minimum lighting requirements, floors that can spawn desks, chairs etc (all with clash detection/resolution) , pavements that generate street lamps spaced nicely etc etc etc. The trees you generate might be L-systems that are seeded by position so all trees are unique, the size of your files could be pretty small and only expanded/exploded on-demand as well.
Tons of neat possibilities and with Ruby - how hard can it be! 
Go do it!
@monsterzero said:
- I'd love to see your plugin do a global lighting pass using location and time settings.
- I also render my images using the "hidden line" face style. Would your lighting work with that?
Currently it does Ambient Occlusion (which looks pretty cool and I'll post some pics soon) - is that what you mean by "global lighting"? - and I'll put in a directional light tied to the Sketchup Sun in the next couple of weeks.
Yes, it works just fine with different styles - I tend to leave edge drawing on because I just hate that blue edge from the rendering of backfacing faces failing the ztest. Keep meaning to try whether setting back_material to a transparent color helps...
Happy New Year All.
Adam
yes, that my point - that the internal function (length) that does something like *Math.sqrt(v.dot(v))*is faster than 3 scalar multiplies.. A bit sad.
Adam
Anyone got any good tips for a fast Geom::Vector3d scale? Along with a few others, its a function thats sorely missing in the API. Initially, I trivially did:
def scale(s)
Geom::Vector3d.new(self.x * s,self.y * s, self.z * s)
end
However, this is waaay slower than the Vector3d#length function which (must) do slightly more work. I'm currently using (brace yourself for the horror):
vec = (vtmp = aVector; vtmp.length = vtmp.length * aNewLength; vtmp)
where aVector and aNewLength are effective parameters.
Its actually faster..but just so ugly.
ilay7k: How did you apply the changes? I ask because line 1583 is way away from the small changes I did.. I've attached the version I have.. I'm just wary of having N versions of this exporter floating around - better Didier folds in these into his..
TBD: yes, ruby script to read quake (using BitStruct). Needed some test data to play with 
Adam
FWIW I use attributes on materials and it "works-fine-for-me" (tm)
ie Attributes getting serialised works fine - so I agree with Didier, I'd revisit your processing code.
Adam
Been having a blast with Sunflow. It is very sad the developers put so little effort into helping getting started / docs but hey, I haven't had as much fun since playing with Renderman when it first came out.
Not sure how I fold changes into the exporter, so I'll post the diff changes to "su2sf.rb" here to support textures and UVs
629c629,638
< @stream.print "\n\tuvs none" # TODO fix uv mapping
---
>
> # @stream.print "\n\tuvs none" # TODO fix uv mapping
> # AMB added
> @stream.print "\n\tuvs vertex"
> meshes.each do |m|
> m.uvs(1).each do |p|
> @stream.print "\n\t\t#{PRECISION % (p.x)} #{PRECISION % (p.y)}"
> end
> end
> #####
680c689,710
< else
---
> # AMB added
> elsif mat.texture
> # check which extension it is
> filepath = File.dirname(mat.texture.filename) + "/"
> filename = File.basename(mat.texture.filename)
> filename = filename.split(".")[0] if filename.split(".").length > 1
>
> [".jpg",".png",".tif",".bmp",".gif",".tga"].each do |ext|
> testfile = filepath + filename + ext
> if File.exists?(testfile)
>
> @stream.print "shader {",
> "\n\tname \"#{name}\"",
> "\n\ttype diffuse",
> "\n\ttexture \"#{testfile}\"",
> "\n}\n\n"
> return name
>
> end
> end
> ######
> else
Adam
PS And here's a snapshot of a Sunflow rendering of Quake exported from Sketchup... because I can in case you ask!

Took a while to download on the wet piece of string it was at the end of! 
OK, so it looks like z-fighting / z-bias issues caused by almost coplanar geometry. Not your modelling I hasten to add! Its the geometry projected onto yours by the shadowing method in SU. So no, this plugin doesn't suffer from that issue.
BTW Nice model! Any chance of me trying it on my stuff?
Can you point me at some video that shows the effect you're thinking of. I'm not sure I understand.
Thanks.
Adam
@gaieus said:
Adam,
This is just something really cool. One of the most genious plugins I have ever seen.
When you export animation with these lights, does tha "classical flickering effect with the shadows" also appear or is this somehow free from that effect?