@timglobal wrote:
Hello everyone, I'm fairly new to scripting in python, but so far its cool.
I was working with an urban plan and needed to select some text of specific height. I looked around the forum and managed to find some related info which helped me a lot, but I still have a couple of questions:code
def SelectTextWithSameHeight(): # Let user pick a text object with required height txtObj = rs.GetObject("Select text", filter=512) if rs.IsText(txtObj): # Return current text height textHeight = rs.TextObjectHeight(txtObj) rs.EnableRedraw(False) # Select all annotation objects and store them in annotations annotations = rs.ObjectsByType(rs.filter.annotation) # Go through each annotation for annotation in annotations: # Check if it's a numeric text if rs.IsText(annotation) and rs.TextObjectText(annotation).isdigit(): # And if yes, get its height textHeights = rs.TextObjectHeight(annotation) # If its height equals to preselected height, if textHeights == textHeight: # select it rs.SelectObject(annotation) rs.EnableRedraw(True) if __name__=="__main__": SelectTextWithSameHeight()
So, there is this filter 512 for annotations, I was wondering if annotations here is just text objects or does it include other stuff like dimensions?
txtObj = rs.GetObject("Select text", filter=512)
Is there a better way to write this function or do you have any suggestions?
Posts: 3
Participants: 2