TraceParts are on the 3d Warehouse, also.
Posts
-
Move! bug?
Does everyone know this but me...

First, the API docs for the Group.move! method:
@unknownuser said:
move!
This method is the same as the transform! method except that it does not record the move in an undo operation. This method is useful for transparently moving things during an animation.This code tells a different story. It seems that grp2 is moved to an absolute position even if a Vector is used for the Transformation object. My expectation is that both groups would be moved 3 times, leaving a trail of numbers.
require "sketchup.rb" puts Time.now grp1 = Sketchup.active_model.selection[0] grp2 = Sketchup.active_model.selection[1] v1 = Geom;;Vector3d.new(X_AXIS) v2 = Geom;;Vector3d.new(X_AXIS) v1.length = grp1.bounds.width * 2 v2.length = grp2.bounds.width * 2 tr1 = Geom;;Transformation.new(v1) tr2 = Geom;;Transformation.new(v2) 3.times do |i| grp1.transform! tr1 grp2.move! tr2 Sketchup.active_model.entities.add_text "g1-#{i+1}", grp1.transformation.origin Sketchup.active_model.entities.add_text "g2-#{i+1}", grp2.transformation.origin end -
RE: Web Dialog - how to
Short answer, add this to the html file, right before the </body> tag:
<script> setup(0,0) </script>Have a look at the totd.rb file in the Tools directory. It's a good example of a WebDialog.
Here's my re-write. Saving values between sessions can be done using Sketchup.write_default and Sketchup.read_default.
require "sketchup.rb" #class JS_Test # Inherit from the WebDialog. There's no need to use a Tool/ class JS_Test < UI;;WebDialog #def activate # activate is a method of the Tool class. def initialize # dialog = UI;;WebDialog.new("test", true,"test", 320, 160, 1100, 60, true) # super called the parant class "new" super "test", true,"test", 320, 160, 1100, 60, true fn= File.dirname(__FILE__)+'/test.html' #dialog.set_file fn set_file fn #dialog.show {} #show it show {} #show it posX = "1" #dialog.add_action_callback("setup") {|d,p| add_action_callback("setup") { |d, p| d.execute_script("document.getElementById('posX').value='#{posX}'") } #end # activate end # initialize end #class jsTest if(not file_loaded?("test.rb")) plugins_menu = UI.menu("Plugins") #plugins_menu.add_item("test") { Sketchup.active_model.select_tool JS_Test.new } plugins_menu.add_item("test") { JS_Test.new } file_loaded("test.rb") end<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta name="test" content="test" /> <title>test</title> <script> function setup(id,value) { window.location = 'skp;setup@'+document.getElementById('posX').value; } </script> </head> <body bgcolor="#e0dfe3"> <input type="text" size="8" id="posX" value="0"></div> <script>setup();</script> </body> </html> -
RE: Web Dialog - how to
For starters, you never call the javascript setup function, which in turn never calls the "setup" callback in the ruby.
Can I ask why you are using the Tool interface for the WebDialog? I never would have thought to use it, although it does work.
-
RE: Web Dialog - how to
Pixero,
To set a value from a ruby script...
The webdialog. Let's say you have a text input field...
<html> <head></head> <body> <input type=text id="name" value="Jim"> </body></html>And the Ruby...
name = "Pixero" # Miraculously, a dialog has been created. dialog.execute_script("document.getElementById('name').value='#{name}'") -
RE: Web Dialog - how to
You need to think in terms of Events. Dialog elements have events. onMouseOver, onMouseOut, onClick, onBlur, etc.
You can capture these events on most elements - one way follows:
<input type=text onClick="someJavascriptFunction()" value="10">Even divs and spans have events: (tested in Firefox)
<html> <head> <script> // javascript function function translate(element) { element.innerHTML = "Hello!"; } </script> </head> <body> <span onClick="translate(this)">Hola!</span> </body> </html>@pixero said:
When you say "you dont even need to press enter" what do you mean?
Would the script start to execute as soon as I start typing in a value?
I dont think I would want that for this script.
Lets say I have a: x, y and z value but I dont want to "run" the script before I've finished typing in my values. How would I do that if press ENTER is buggy?Thanks!
-
RE: Building a Sketchup Computer... on a $1000 budget. UPDATED
Ugh, I'm done building systems. However, I am ready to purchase a new computer and display. I tried going to my local guy, but after 2 consecutive hard drive failures, I don't think he's giving me good advice or selling me good hardware - either way, I'm not going back.
So, any recommendations for someone who's probably going to get a Dell, dude? I'm specifically interested if there is a SketchUp recommended video card?
-
RE: Google Earth web link script
Hi Tom,
I think all you need to do is export the model as a .kmz from SketchUp, and put it on the web page.
Google's acquisition of SketchUp had everything to do with getting content for Google Earth, and getting it inexpensively and quickly. Their plan appears to have worked. I find both Google Earth and Google SketchUp to be compelling programs - extremely useful and entertaining.
-
Poll: Mac vs PC
Let's get this out of the way.
When using SketchUp, do you spend most of your time on a PC or a Mac?
Poll will be open for 6 days.
-
Google Chart API
Google has opened a chart API. It should make it easy to include charts into a WebDialog (assuming the user is connected at the time.) Chart types include: line, bar, pie, 3d pie, venn, and scatter plots.
-
SketchUp API Blog
Google has opened a new blog all about the Ruby API in SketchUp.
Google SketchUp Ruby API (Google Code)
Google SketchUp API Blog -
RE: What's This?
It could be part of a carbon dioxide fire suppression system. I worked at a place that had something similar, although on a much larger scale. Plus there should be storage tanks for the liquid CO2 to go along with it.
-
RE: I was bitten in the hiney by *nix
That's a good one! I would argue that the software should have trimmed the trailing whitespace - after all, who in there right mind names a file with a trailing space?
One thing I've done is manage to create files with names like "-v" and other silly things, so when I typed rm -v, rm thinks the filename was an option! There is an option on the Gnu version of rm to get around this.
What flavor of unix is Mac based on?
-
RE: [SKM Bug]Material attributes within SKM files
Hmm, I thought I answered a similar post (from you?) many months ago. I experimented with assigning attributes to materials. If I remember, I was able to do it.
And if I also remember, it didn't work for you?
-
RE: Search Bounding Box-Script
There is one called 3d Fillet Blocks at ohyeahcad.com under free downloads.
-
RE: Two Web Dialogs Open Together
Yes, it's possible. It sounds like you may have opened the dialog as a modal dialog.
-
RE: Created geometry on auto-move mode
You want to create a ComponentDefinition from the start. Try these changes:
33; definition = Sketchup.active_model.definitions.add("New Def") 34; entities = definition.entities ... 113; (removed) 115; (removed) -
RE: Created geometry on auto-move mode
cdef = Sketchup.active_model.definitions.add("Component Def Name")Oh, you already have a Group. I forgot about Group.to_component !
-
RE: Created geometry on auto-move mode
@lekonna said:
wow that was a fast reply, thanks jim!
Now i'll just have to dig out how the ComponentDefinition class works, as my geometry is at the moment only a group.
Nah, just try it with the Group, it might work. But if not, you just create a new ComponentDefinition instead of a new Group and use the Defs entities. You shouldn't need to change but one line of code (maybe.)
