Thanks very much, cleaning up html did the job. If its still of intereset, i use windows 7.
Haven't seen my HTML mistake, so thanks again,
curator
Thanks very much, cleaning up html did the job. If its still of intereset, i use windows 7.
Haven't seen my HTML mistake, so thanks again,
curator
Hi all,
I have some problem here. I created the follwing minimal example as an HTML File:
<script>
function callJavaScript(i_Value)
{
alert('hi')
var jsonString = '{ "foo"; 42, "bar"; 17 }';
var jsObject = JSON.parse( jsonString );
alert(jsObject["foo"])
var message = jsObject["foo"];
document.getElementById('output').innerHTML = message;
alert(obj.count);
}
</script>
<html>
<body onload = "callJavaScript('Update')">
<h3 id="output"></h3>
</body>
</html>
Wenn opening in a browser, it start by welcoming with 'hi' and prompts 42 afterwards. That makes no sense, but works as expected. However, if I now use sketchup to display that html file, e.g., like this:
p_File = Sketchup.find_support_file("DEMO.html","Plugins")
p_Dialog = UI;;WebDialog.new("DEMO")
p_Dialog .set_file(p_File )
p_SettingsDialog.show
That does not work anymore. The Dialog opens and greetings 'hi' still works, but the JSON stuff doesn't work anymore.
Can anyone provide any help?
kinds regards,
curator
Hi there,
I have problems understanding the data structure of SketchUp. Lets assume I have a empty scene and draw a simple rectangle. Then I can use ruby console like this
Sketchup.active_model.entities.at(4).vertices.at(1).position
Point3d(0, 3.93701, 0)
Ok. Then I resize the rectangle using the scale tool (holding CTRL) by some factor and get
different values
Sketchup.active_model.entities.at(4).vertices.at(1).position
Point3d(0.984252, 2.95276, 0)
Ok, undo the rescaling and put the rectangle to a group. Then the call is
Sketchup.active_model.entities.at(0).entities.at(1).vertices.at(0).position
Point3d(0, 3.93701, 0)
Then I rescale as above, but this time the group. I again try
Sketchup.active_model.entities.at(0).entities.at(1).vertices.at(0).position
Point3d(0, 3.93701, 0)
The thing is, that the position of the vertex has changed in the scene, but the output as above does not change. How can I get the "real" position instead?
kind regards,
curator
Hi,
thanks for the Tip. I looked their and synced the position with the position, the target with the focal point and view up with view up. That seems to work pretty good in the first attempt, but I am not allowed to zoom in or out, since then both view are not the same anymore (basically the vtk window does not "rescale". vtk has the zoom or setdistance function, but I expected them to be given indirectly be the distance between position and focal point. what information have i missed?
Hey all,
I am trying to use Sketchup as modelling tool for an external application. Both run simultainiously and communication is not a problem.
As both tools run together, I would prefer that a change of view in SU would result in the same change of view in the vtk Tool. Hence, I already made use of the ViewObserver to get informed about any changes, but I dont know how to "convert" the View information to vtk. I guess, that I have to modify the vtkCamera [1], but I dont know which data to insert (based on Sketchup View [2]). Any suggestions?
kind regards,
curator
[1] http://www.vtk.org/doc/nightly/html/classvtkCamera.html
[2] http://www.sketchup.com/intl/en/developer/docs/ourdoc/view
Hi, thanks for your replies. All your arguments are resonable. Actually, I am currently working with a group
` def self.drawSphere(i_Point, i_Radius, i_Entities)
p_Circle1 = i_Entities.add_circle i_Point, [0,1.m,0], i_Radius, 16
p_Circle2 = i_Entities.add_circle i_Point+[0.m,0.m,-2.0*i_Radius], [0.m,0.m,1.m], 2.0 * i_Radius, 16
p_Face = i_Entities.add_face p_Circle1
p_Face.followme p_Circle2
i_Entities.erase_entities p_Circle2
end`
but that SEEMED to me to be not the best choice. But as I said, I am very new to this.
So lets say a sphere is a group like that. If I "rightklick" on such a sphere (group) it shows a menu starting with "Entity info". How can I add, sets say, an option like "change radius" or "change position". How do I add such an option only to "sphere", and not to "cube" or whatever.
Thanks again,
curator
Hi all,
I am starting with SketchUp Development, so please be patient with me .
First of all: Is there any good literature that you recommend?
Second: My overall plan is to use SketchUp as visualization and configuration tool for an external software I am currently developing. I tried around with ruby and managed to have the essential communication working.
The next step is, that I receiver centerpoint and radius of a sphere, that I want to visualize. I managed to do so by creating a group where I have two circles, where one "follows" the other. However, I would like to have this sphere (and later other objects) as an own Entity, such that I can to specified stuff with it later.
I am quite familiar with C++, where I would create a subclass "Sketchup::Sphere" from "Sketchup::Drawingelement". The constructor would contain center and radius as input parameter. Furthermore, I would add a function "add_sphere" to "Sketchup::Entities".
So I guess my file should look something like
` require "sketchup.rb"
class Sketchup::Sphere< Sketchup::Drawingelement
def Sphere(i_Pos) #constructor?
end
end
class Sketchup::Entities
def add_sphere(i_Pos)
Sphere = Sketchup::Sphere(i_Pos)# like this?
# how to add Sphere to entities?
end
end
....
Sketchup.active_model.entities.add_source [1, 2, 3]`
Besides that, I have no idea where to start.
Can anyone help me?
Advertisement