Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
π£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download
How to receive correct coordinates of all vertexes?
-
How to receive correct coordinates of all vertexes in selection, including all the nested groups and components.
Multiplication of transformations far not always gives correct result, especially if for any nested group(component) of an axis do not coincide with an axis of group(component) in which it is enclosed.I was trying so:
... @lines = [] extract_lines(group.entities, (Geom;;Transformation.new)) ... def extract_lines(ents, tr) ents.each do |e| if e.typename == "Edge" line = [e.vertices[0].position, e.vertices[1].position] line[0] = tr * line[0] line[1] = tr * line[1] @lines << line elsif e.typename == "Group" extract_lines(e.entities, (e.transformation * tr)) elsif e.typename == "ComponentInstance" extract_lines(e.definition.entities, (e.transformation * tr)) end end endBut here the relative positioning of groups concerning a model is not considered.
There are ideas as it to make? -
Hi Alex,
Your sample code looks fine for me. Could you post a simple model showing wrong coordination's readout?
Tomasz
-
Correctly it will be whew:
... @lines = [] extract_lines(group.entities, group.transformation)#!!! ... def extract_lines(ents, tr) ents.each do |e| if e.typename == "Edge" line = [e.vertices[0].position, e.vertices[1].position] line[0] = tr * line[0] line[1] = tr * line[1] @lines << line elsif e.typename == "Group" extract_lines(e.entities, (tr * e.transformation))##!!! elsif e.typename == "ComponentInstance" extract_lines(e.definition.entities, (tr * e.transformation))#!!! end end endand it works!

Advertisement