Hi,
is there a way to select an object by location? If so, can you send me a sample of the code?
Hi,
is there a way to select an object by location? If so, can you send me a sample of the code?
@Harold1
Through Gh it would be this easy.
Can you give me a sample i can put into the script editor that uses coordinates ?
Could you give me a sample of an object that has a coordinate? Point or block?
I want to select the red text fields so i can delete them. i tried using select ID but i used this templet so many times their different ids. FYI, in the templet I am using their different colors. I just made them red for the sample.
test2.3dm (251.6 KB)
If they have consistent textual context inside them, then _FindText
command works usually really well. And without scripting.
Other than that, it’s really hard to understand the goal. I could assume from your description that you have several different files, where the texts objects are on those exact positions. So you would open then individually?
Or do you have one file, with a lot of these scattered around?
I could assume from your description that you have several different files, where the texts objects are on those exact positions. So you would open then individually? That is correct.
I don’t know how they ended up with different ids.
Hello @Harold1 ,
Hope it can help.
import rhinoscriptsyntax as rs
import scriptcontext as sc
# Origin of the text to be deleted
point3D = rs.GetPoint()
# Get all text entities from the document
Texts = [sc.doc.Objects.Find(guid) for guid in rs.AllObjects() if rs.IsText(guid)]
epsilon = sc.doc.ModelAbsoluteTolerance
# For each text check if it is on the point picked. if yes, delete it.
for text in Texts :
if rs.Distance(point3D,text.Geometry.Plane.Origin) <= epsilon :
sc.doc.Objects.Delete(text)
break
Thanks.