3D model of hill-like structures using SketchUp C SDK
-
@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::PolygonMeshobject. All classes in the GEom module are virtual memory objects, not actual modelSketchup::DrawingElementsubclasses.)Then to port the mesh to the model, you use
Entities#add_faces_from_mesh()orEntities#fill_from_mesh(). -
-
@dan rathbun said:
You would first create a virtual mesh (a
Geom::PolygonMeshobject. All classes in the GEom module are virtual memory objects, not actual modelSketchup::DrawingElementsubclasses.)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::PolygonMeshobject. All classes in the GEom module are virtual memory objects, not actual modelSketchup::DrawingElementsubclasses.)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
Geommodule.
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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement

