[REQ] label points with same X,Y Coordinates -pointcloud aid
-
Using points_cloud_triangulation.rb
In some cases there are whole areas that aren't triangulated, or areas that the triangulation is overlapping. (see images)
following the error message in the console, I figured that the problem occurs when there are points that share a common X,Y coordinate (on a different Z).It is a tedious task to find these points throughout a large model. I was wondering if there might be a script to label points that share the same Z? something similar to labeling stray lines - in "stray lines.rb".
Or if anybody knows how to write a script that would do that!?




-
Try this
require 'sketchup.rb' def cpointseqxy() model=Sketchup.active_model ents=model.active_entities layers=model.layers tlayer=layers.add("cpointseqxy") sel=model.selection sela=sel.to_a sel.clear model.start_operation("cpointseqxy") cs=[] ca=[] sela.each{|e| cs<< e if e.class==Sketchup;;ConstructionPoint ca<< e if e.class==Sketchup;;ConstructionPoint } th=[] ch=[] lh=[] ca.each{|c| cx=[] cs.each{|e| next if c.to_s == e.to_s if c.position.x == e.position.x and c.position.y == e.position.y cx<< e ch<< e t=ents.add_text(" =XY",e.position) th<< t l=ents.add_cline(c.position,e.position) lh<< l end#if } cs=cs-cx } th.each{|t|t.layer=tlayer} lh.each{|l|l.layer=tlayer} sel.add(th+ch+lh) model.commit_operation endCopy + Paste the code into a file in the Plugins folder called
cpointseqxy.rb.
Restart SUp and select everything [only cpoints get processes anyway].
In the Ruby Console typecpointseqxyand all cpoints with common X & Y values are highlighted and highlighted=XYtext is added next to each of them, also a highlighted vertical cline is added between them. Note that the text and clines are also put onto a layer called 'cpointseqxy' - so you can isolate them or delete them more easily [by deleting the layer and its contents]...
-
Hi,
@unknownuser said:
the problem occurs when there are points that share a common X,Y coordinate (on a different Z)
Correct. Delauney algorithm is a 2D triangulation process, sort of. Having 2 points at the same location (plan view) breaks it.
Note: the "Points are not planar" error can also occur if 2 points are very very very close to each other. It is a Sketchup "add_face" method issue, IMHO.
-
Very nice TIG! You're the man!
It works wonderfully!
Could you have the text that's added, with arrows just like in "straylines.rb". I think it would make it easier on the eyes to find the points. I've added one arrow to demonstrate the difference, see attached image.
Thanks! really great!!

-
@didier bur said:
Note: the "Points are not planar" error can also occur if 2 points are very very very close to each other. It is a Sketchup "add_face" method issue, IMHO.
There is a way to overcome the problem of very close points not closing faces. scale the the model x10. add the faces, and then rescale by .1. It usually works.
Thanks guys!
-
Try this
require 'sketchup.rb' def cpointseqxy() model=Sketchup.active_model ents=model.active_entities layers=model.layers tlayer=layers.add("cpointseqxy") sel=model.selection sela=sel.to_a sel.clear vec=[10,10,10] ### change these values for arrow length model.start_operation("cpointseqxy") cs=[] ca=[] sela.each{|e| cs<< e if e.class==Sketchup;;ConstructionPoint ca<< e if e.class==Sketchup;;ConstructionPoint } th=[] ch=[] lh=[] ca.each{|c| cx=[] cs.each{|e| next if c.to_s == e.to_s if c.position.x == e.position.x and c.position.y == e.position.y cx<< e ch<< e t=ents.add_text(" =XY",e.position,vec) th<< t l=ents.add_cline(c.position,e.position) lh<< l end#if } cs=cs-cx } th.each{|t|t.layer=tlayer} lh.each{|l|l.layer=tlayer} sel.add(th+ch+lh) model.commit_operation endThis has arrows for the text:
vec=[10,10,10]sets the arrows 'vector', adjust the value of it to change the leader location, length etc...
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