3D model of hill-like structures using SketchUp C SDK
-
Hi everyone,
I'm trying to draw sand dunes or hill-like structures using the new SketchUp C SDK on Visual Studio. I was wondering if someone has done this before or if at all this is possible. Any suggestions?
Also, I went through the header files that came along with the SDK and I feel it's not possible to do terrain modification using the SDK. Do you guys agree with that?
Lastly, is it true that the Ruby API cannot be used from an application other than SketchUp? If that's not true, then can I use Ruby API for terrain modification or creation of 3D models to produce sand dune-like structures?
-
The Ruby API can only be used from within SketchUp, correct.
As for the C SDK, where are you stuck? What prevents you from creating terrain geometry? The C API is generic, there is no limitations imposed to what it creates - so creating terrains will be possible.
-
@tt_su said:
The Ruby API can only be used from within SketchUp, correct.
As for the C SDK, where are you stuck? What prevents you from creating terrain geometry? The C API is generic, there is no limitations imposed to what it creates - so creating terrains is be possible.
Hi tt_su,
Thanks for your reply. I'm new to SketchUp and so far I have only been able to create regular shapes such as a cube or a 2D face using the SDK. How does one go about creating terrain geometry such as a sand pile? Please give some suggestions.
-
You would first create a virtual mesh (a
Geom::PolygonMesh
object. All classes in the GEom module are virtual memory objects, not actual modelSketchup::DrawingElement
subclasses.)Then to port the mesh to the model, you use
Entities#add_faces_from_mesh()
orEntities#fill_from_mesh()
. -
Then to tweak your mesh, you can get TT's Vertex Tools
http://www.thomthom.net/software/vertex_tools/
-
@dan rathbun said:
You would first create a virtual mesh (a
Geom::PolygonMesh
object. All classes in the GEom module are virtual memory objects, not actual modelSketchup::DrawingElement
subclasses.)Then to port the mesh to the model, you use
Entities#add_faces_from_mesh()
orEntities#fill_from_mesh()
.Hi Dan,
Thanks for your reply. The methods and objects you proposed are from the Ruby API. I want to be able to do the same using C API since I am working from another application and not using the SketchUp interface.
So how can I create terrain geometry using the C API? -
@srutidavis said:
Thanks for your reply. I'm new to SketchUp and so far I have only been able to create regular shapes such as a cube or a 2D face using the SDK. How does one go about creating terrain geometry such as a sand pile? Please give some suggestions.
If you observe the construction of the mesh that Sandbox you'll see that each square is made up of two triangular faces with a soft+smooth edge shared between them.
If you have your set of 3d points that represent the sand pile you'd iterate over it, generating the triangulation needed. -
@dan rathbun said:
You would first create a virtual mesh (a
Geom::PolygonMesh
object. All classes in the GEom module are virtual memory objects, not actual modelSketchup::DrawingElement
subclasses.)Then to port the mesh to the model, you use
Entities#add_faces_from_mesh()
orEntities#fill_from_mesh()
.That doesn't apply to this particular question though, as he's trying to use the C API to generate the geometry.
-
Sorry.. but does the C API have interfaces for Geom classes ?
Does it have an interface for add_faces_from_mesh ?
-
@dan rathbun said:
Sorry.. but does the C API have interfaces for Geom classes ?
Does it have an interface for add_faces_from_mesh ?
The C API interfaces with the SketchUp core, it does not interface with Ruby.
There are similar functions though, such as SUEntitiesAddFaces and SUEntitiesFill, but they are not 1:1 mappings.
-
OK thanks. I have not had time to delve into it yet.
I thought it would have virtual helper classes like the Ruby API has in the
Geom
module.
But I suppose being C, there is a wealth of such libraries that a C programmer could choose to use, even OpenGL, or MS GDI libs ? -
There is, yes. But the C API isn't finalized either. It's still being developed and we are improving it to make it have a similar coverage as the Ruby API.
Advertisement