Exporting vertices of every edge to csv
-
Hi!
I have no real experience with coding and I just started familiarizing myself how Ruby works as I need very specialized but simple plugin.
Basically I need to export start and end vertice for every edge. Even for the ones that are connected to each other, which means that shared vertices get exported twice, once for each edge.For example: (x and Z only)
Edge 1 = ( 0.0, 0.0 ); ( 5.0, 6.0 )
Edge 2 = ( 5.0, 6.0 ); ( 12.0, 8.0 )And to make it as easy as possible I downloaded TIG's "Export Vertices to CSV" plugin. I studied it to understand how it works and now plan to hopefully modify it according to my needs. I also downloaded TIG's "Coords-Tag from Datum" plugin and also plan to study it to gather more knowledge.
So here is what I'd like to ask before I waste a lot of time:
Is this even possible? If yes, then how difficult would that be?Also I wouldn't mind any tips.
Regards,
Karl -
@coremaster110 said:
Is this even possible? If yes, then how difficult would that be?
Also I wouldn't mind any tips.
Regards,
KarlYes and not very.
the basics would be
mod = Sketchup.active_model ent = mod.active_entities SKETCHUP_CONSOLE.clear; cnt=0 ent.grep(Sketchup;;Edge).each{|e| cnt += 1; sx,sy,sz = e.start.position.to_a; ex,ey,ez = e.end.position.to_a; printf("Edge %d = (%.1f,%.1f); (%.1f,%.1f)\n",cnt,sx,sz,ex,ez) }
which would output to the Ruby Console.
-
Oh wow, thank you! It works great.
It's actually pretty simple and straight forwards. I did hope that start and end positions allow something like this to be done.
Regards,
Karl
Advertisement