Hi All,
Does anyone know how to sort the text outline and inside separately into two list?
3D_Text_Sample.3dm (332.5 KB)
Hi All,
Does anyone know how to sort the text outline and inside separately into two list?
3D_Text_Sample.3dm (332.5 KB)
Hi Jia Yeap
Below is a crude script setup that might be enough for what you need or to get you started.
It will select all curves in a selectionset that are inside another curve in that set
import rhinoscriptsyntax as rs
import Rhino.Geometry as RG
def is_AinB(curveA, curveB):
SAMPLE_DISTANCE = 0.1
sample_pointsA = rs.DivideCurveLength(curveA, SAMPLE_DISTANCE)
containers = []
for sample_point in sample_pointsA:
containment = curveB.Contains(sample_point)
if containment == RG.PointContainment.Inside:
containers.append(True)
else:
containers.append(False)
return all(containers)
if __name__ == '__main__':
obj_ids = rs.GetObjects('select curves to check', preselect=True)
rs.UnselectAllObjects()
insiders = set()
for i, obj_idA in enumerate(obj_ids):
for obj_idB in obj_ids[i:]:
if obj_idA is obj_idB:
continue
else:
curveA = rs.coercecurve(obj_idA)
curveB = rs.coercecurve(obj_idB)
if is_AinB(curveA, curveB):
insiders.add(obj_idA)
if is_AinB(curveB, curveA):
insiders.add(obj_idB)
if insiders:
rs.SelectObjects(insiders)
Does this help?
Do ask if you have more questions
-Willem