Hello everyone
Here is a little solution, still a bit hacky, but functional, to go from a SketchUp surface or a curve… Into a list of vectors for Trimble creator.
The idea is to be able to feed a large list of points by pasting a simple text into a text input of the dialog box.
Here is a little demo of what I managed to do:
Here is the Ruby code to extract the information.
# Extract outerloop points position of a face in a selected Component Instance to a string
# x,y,z values are roundes to 1 decimal
# string use different separator for points and values
# How to use
# 1- Draw à face
# 2- Create a Component of the face
# 3- Define the origin of the component it will be the equal at the origin of the graphe
# 4- paste this code in the Ruby Console
# 5- Copy the string result
# 6- Past it in the Live component dialog, in the string input
def stringOuterloop(separatorPoint=";",separatorValue=",")
inst = Sketchup.active_model.selection.grep(Sketchup::ComponentInstance)[0]
face = inst.definition.entities.grep(Sketchup::Face)[0]
vertices = face.outer_loop.vertices
points = vertices.map{|v| v.position}
points_mm = points.map{|p| "#{p.x.to_mm.round(1)}#{separatorValue}#{p.y.to_mm.round(1)}#{separatorValue}#{p.z.to_mm.round(1)}"}
points_string = points_mm.join("#{separatorPoint}")
return points_string
end
def stringCurve(separatorPoint=";",separatorValue=",")
inst = Sketchup.active_model.selection.grep(Sketchup::ComponentInstance)[0]
curve = inst.definition.entities.grep(Sketchup::Edge)[0].curve
vertices = curve.vertices
points = vertices.map{|v| v.position}
points_mm = points.map{|p| "#{p.x.to_mm.round(1)}#{separatorValue}#{p.y.to_mm.round(1)}#{separatorValue}#{p.z.to_mm.round(1)}"}
points_string = points_mm.join("#{separatorPoint}")
return points_string
end
string = stringCurve()
puts string
And to finish use with my live wood deck component
It’s up to Keith’s team to make the direct knot with as an output parameter: create points, a mesh if points are coplanar, a curve, and as an input parameter the separators for each level.
And I will make a small plugin with different text output options and copy to clipboard.
Link to the graph : Graphe string to liste
How do you like it ?