+ Reply to Thread
Results 1 to 3 of 3

Thread: Command ("_SelBadObjects") always returns TRUE

  1. #1

    Command ("_SelBadObjects") always returns TRUE

    When I run the following:
    Code:
    badObjects = rs.Command("_SelBadObjects")
    I get TRUE even when no bad objects are selected. Does anybody have any idea why that would happen?

    Is there a better way? Is there a way to simply check for selected geometry?

    Here is my code:
    Code:
    badObjects = rs.Command("_SelBadObjects")
     
    if badObjects:
     
       rs.MessageBox("Bad objects were found!\n"
           "The selected bad objects must be repaired before exporting."
           , 0 | 16, "CheckGeometry: Bad Objects")
    else:
       print "...no bad objects were found."

  2. #2
    Senior Member Steve Baer's Avatar
    Join Date
    Apr 2010
    Location
    Seattle
    Posts
    1,464
    Blog Entries
    19
    Command just returns True to tell you that it completed successfully. I think the following is probably what you are after
    Python Code:
      import rhinoscriptsyntax as rs
       
      def getbadobjects():
          rs.UnselectAllObjects()
          rs.Command("_SelBadObjects")
          bad = rs.SelectedObjects()
          rs.UnselectAllObject()
          return bad
       
      bad_objects = getbadobjects()
      if bad_objects:
          print "got bad objects. count =", len(bad_objects)
      else:
          print "no bad objects"

  3. #3
    Yup! That is exactly what I needed! Thanks Steve.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts