Drawing with high value coordinates
-
I have made a simple Ruby scipt in order to estrude a circle along a curve (with face.followme method).
The question arise when I try to draw the initial circle, with its centre in the coordinates I'm using (they are geographic ones as X=681581.4417, Y=4850429.052, Z=85.368)This is the sample script, with the final test to verify the face consistency:
` entities = Sketchup.active_model.entities
direction=Geom::Vector3d.new(0,0,1)
#centerpoint= Geom::Point3d.new(0,0,0)
centerpoint= Geom::Point3d.new(681581.4417,4850429.052,85.368)
edges = entities.add_circle centerpoint, direction, 1, 1000
face = entities.add_face(edges)if (face)
UI.messagebox face
else
UI.messagebox "Failure"
end`In some cases the face creation give a failure.
Attached you find the circle that the script has draw.
The problem doesn't happen when the coordinate are a low value (as example X=0, Y=0, Z=1).
I think it depends on the very low "circle radius" to "centre coordinates" ratio.
What do you think?
-
Sketchup uses inches, so you are over 10 miles away, is that what you expect?
john
-
On my Mac I get a different but likewise mangled non-circle, and I notice that it changes distortion as I zoom or pan. This leads me to suspect that this may be an OpenGL limitation that varies with graphics card and driver. One workaround (which I haven't tested) might be to draw the circle closer to the origin and then move it to the desired centerpoint. Of course, as John observes, why do you need to draw something so far from the origin?
-
Away from what?
From the origin?
But I'm not interested in a model in the origin. My model hasn't the start at the origin and the end at center coordinates. My model is centered about the center coordinates (plus o minus 200 meter).
Regarding the coordinates, at this moment I have not considered the inch aspect, but in my idea the coordinates are in meters (they are UTM coordinates of an area in Florence - Italy). In this way the value is still bigger than you have indicated.
I think that this "problem" is a sort of quantization error, due to fact that, with reference to the origin, the difference in coordinates between various point of a circle is very very low. So, it would be necessary a lot of precision in the internal variable of the Sketchup engine. This would lead to a slowing down of the engine, among other things not necessary in most modeling.
By me, one solution would be to be able to translate the origin depending on the coordinates of the work area.
I have seen that Skatchup has the possibility of changing the origin position, but I doesn't know how internally this possibility is implemented (and if it's available in Ruby). I try it -
Not denying that there may be a limit of precision thing going on, but there seems to be some confusion here too. If you haven't geolocated your model, the "origin" is an abstract drawing location with no real world significance. It is not, for example, your own physical location. So, offsetting from it by some real-world distance isn't meaningful. What do you think the coordinates (0,0,0) correspond to?
On the other hand, if you have geolocated your model, why did you place the origin so far away from where you want to draw? Are you planning to fill the entire space between with drawings?
-
On re-reading your post, I think I see the problem. SketchUp was designed for architectural-sized drawing, not for UTM zone-sized geography. So, when you draw using the UTM coordinates, you are drawing relative to the origin of that zone, which can be very far away from the objects you are drawing. Using SketchUp's geolocation capabilities (look in the knowledge base or tutorials) you can put the drawing origin of your model at any place on the earth. Then you draw relative to that reference location instead of relative to the UTM origin.
-
Dear slbaumgartner
I know that the Sketchup "origin" is an abstract drawing location, as you say.
I also know that the 0,0,0 coordinates doesn't have a phisical location in UTM or other coordinate systems.
I have also seen the possibility of geolocalize models using, among other things, the dem of google earth.But the fact that 0,0,0 doesn't represent a phisical location is valid also for a CAD environment. But this does not eliminate the possibility of a model like the one I described.
What I wanted to experience (maybe because I'm confused as you say....) it to know if Sketchup also had this possibility.
Now, it is OK that in the absence of this option you can make a model and later geolocate it.Every software has its peculiarities. Some excel at one thing , others on different aspects.
I wanted to evaluate the possibility of providing sketchup with a text file containing geolocated line coordinates, and use SketchUp Ruby to create "directly" geolocated 3D models based on those geolocated lines.
If it isn't possible directly, then I will have to proceed with a step more
That's it. -
have you looked for UTM data import ruby's?
I think at least one already does what you ask...
may be this one...
http://sketchucation.com/forums/viewtopic.php?f=323%26amp;t=1533
john -
@driven said:
have you looked for UTM data import ruby's?
I think at least one already does what you ask...
may be this one...
http://sketchucation.com/forums/viewtopic.php?f=323%26amp;t=1533
johnMany Thanks for the link. I'll read the post as soon as possible
-
@driven said:
have you looked for UTM data import ruby's?
I think at least one already does what you ask...
may be this one...
http://sketchucation.com/forums/viewtopic.php?f=323%26amp;t=1533
johnI took a look at this ruby and couldn't see anything that would directly facilitate drawing far away from the origin while using UTM coordinates. The references I found all talked about pre-processing a file of UTM by subtracting the coordinates of a "site origin" before importing values into SketchUp via the Cloud plugin.
It's not hard to set the model origin in UTM via Ruby:
utm=Geom;;UTM.new(zone_number, zone_letter, x, y) latlong = utm.to_latlong shadow_info = Sketchup.active_model.shadow_info shadow_info["Latitude"] = latlong.latitude shadow_info["Longitude"]= latlong.longitude
note: zone_letter is actually a single-character string
another note: Most of the shadow info is automatically recalculated when you set the latitude and longitude, but shadow_info["City"] defaults to "Boulder (CO)" and shadow_info["Country"] to "USA", so if you set the origin you probably want to set those also!once the origin is set, you can get individual point locations in model coordinates from UTM via
model = Sketchup.active_model utm = Geom;;UTM.new(zone_number, zone_letter, x, y) point = model.utm_to_point(utm)
then use those points to draw whatever you wish
-
@steve
maybe it was another by aeilius, jim or didier, never needed it myself...there was a thread about GE models that I vaguely recall, but can't find...
john
Advertisement