Point from (X & Y FROM a circle & Mtext content)

Hello all
How to link Mtext content with X & Y to a circle that is closer to it than the rest of the circles
Arrange in order of proximity
to form a point from (X & Y FROM a circle & Mtext content)
SORT_PONT&TEXT_TOCIVILPOINTS 01.dwg (917.5 KB)
SORT_PONT&TEXT_TOCIVILPOINTS.dyn (15.7 KB)



@hosneyalaa you can try with bellow process…

  1. Find X,Y postion of Mtext (use toolkit node objectextension.getparameter)
  2. create dynamo points from Mtext (x,y)
  3. create points at the center of circle.
  4. use node closestPointto to find the nearest points between the two geometry points.

you can give it a try.

1 Like

Thanks @shahid.shaikh_C3D
I will try

hi @shahid.shaikh_C3D
You have reached this stage
I didn’t understand how LOOP works on all points
If you have enough time, help
Thanks


SORT_PONT&TEXT_TOCIVILPOINTS 01.dyn (46.2 KB)

Apologies, i thinki i missed something the closest point wont work for all points.

Thanks @shahid.shaikh_C3D

The solution is from this link
With a little modification

closest-point-from-long-list-to-a-point-in-a-shorter-list

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Inputs
short_list = IN[0]
long_list = IN[1]

# Output list
result = []

# Loop check for each point in the short list
for s in short_list:	
	# List for distances
	dist = []
	for l in long_list:
		# Distance to point s
		d = Geometry.DistanceTo(s,l)
		dist.append(d)
	# Lowest distance in list		
	min_d = min(dist)
	# Index of lowest distance in list
	min_ind = dist.index(min_d)
	# Get the closest point from the long_list
	closest_p = long_list[min_ind]
	# Add the point to the results, as it is the closest to the point from the short list
	result.append(closest_p)

# Output the results
OUT = result
1 Like

Thanks for sharing this.

1 Like