Height labels to point grid in 2D

How would one use SketchUp to add point labels to create a point grid with height labels in 2D to create the following pattern?

The objective is to add height labels to points which has been used to generate a toposhaper surface, e.g. by projecting the grid and labels on to the surface.

I.e. something similar to this Help

There are a number of plugins to import point data into SketchUp …


I think @TIG has a plugin over at SketchUcation that can insert height callouts.

Importing points is very straightforward, 4 lines of code, see below. However, the labels are totally different story. My plan is to make a 2D surface that contains the lines and labels (for point height) and Sandbox/Drape that on toposhaper surface. The questions is then how to make the 2D surface (automatically from the point data). I’m thinking about extending the code below along the lines with ent.add_3d_text(‘test’, TextAlignLeft, “Arial”, true, false, 1.0, 0.0, 0.5, true, 5.0). However, I’m uncertain about how to position the text under each point on the 2D surface. Any suggestions?

> model = Sketchup.active_model
> ents = model.active_entities
> arr = [[-18.m, 54.m, 33.845.m]]
> arr.each {|a| ents.add_cpoint(Geom::Point3d.new(a))}

I have already suggested you look at what TIG has done.
One of the best ways to learn is to look at code that already works.

FYI: SketchUp does not have a “line” entity. It has edge entities.

So you could make a face inside a group, and then draw edges across it.

Your only other option would be to use GuideLines (of a stipple you choose) as the “grid lines”.

Here is a minimal working code, which is very inefficient, having more points increases running time considerably. Starting from a point cloud, the objective is to create a flat labelled grid at z=0, from code, with no user interaction, which can be projected on to a surface.

model = Sketchup.active_model
entities = model.active_entities

arr = 
[[-18.m, 54.m, 33.845.m],
[-15.m, 54.m, 33.785.m],
[-18.m, 51.m, 34.015.m],
[-15.m, 51.m, 33.705.m],
[-12.m, 51.m, 33.475.m],
[-9.m, 51.m, 33.335.m],
[-6.m, 51.m, 33.345.m],
[-3.m, 51.m, 33.115.m]]

arr.each {|a| 
  newgroup =entities.add_group
  newgroup.entities.add_3d_text(a[2].to_m.to_s, TextAlignCenter, 'Liberation',  true, false, 1.0, 0.0, 0, true, 0)
  transformation = Geom::Transformation.rotation(ORIGIN, Y_AXIS, 0.degrees)
  transformation *= Geom::Transformation.translation([a[0],a[1],0]) 

Take a look at FlatText. It makes the sort of 2D text you want, much lower edge count than 3D text.
It also has a lightweight API (one method, #text_in_a_box) for making FlatText where you want it. Specify a rectangle and a message and it does the rest.
Here’s a link to FlatText and to the API docs.