Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    How can I edit my point-selection?

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 261 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 14/03/2012 at 06:33, xxxxxxxx wrote:

      Hi to everyone,

      I'm trying to write a simple script that converts ringselections in points by melting the selected points.
      In order to get an automatism I only select the first point, and python get the next neighbors by calling SendModelingCommand(c4d.MCOMMAND_SELECTGROW...).

      Works how suggested up to this point.

      Now the problem: because I need to keep the sourcepoint of every new ringselection I've tried to deselect the first point so I can melt the remaining points.

      But I can't get this working. Either the whole selection disappears or nothing happens.
      I've tried to get the BaseSelection.DeselectFrom(x) function working for me, but no success.

      Here the code I'm using:

      > def meltNextRing(doc,scriptParent) :
      >     source = scriptParent[c4d.ID_USERDATA,2]            #the object to work on
      >     doc.SetSelection(source,c4d.SELECTION_NEW)
      >    
      >     sourcePoint = source.GetPointS()                    #get first point
      >    
      >     settings = c4d.BaseContainer()
      >     v = utils.SendModelingCommand(c4d.MCOMMAND_SELECTGROW,[source],c4d.MODELINGCOMMANDMODE_POINTSELECTION,settings,doc)
      >     scriptParent.Message(c4d.MSG_UPDATE)
      >    
      >     newSelection = source.GetPointS()
      >     newSelection.DeselectFrom(sourcePoint)
      >

      Any suggestions?

      Best regards,
      blutsvente

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 22/03/2012 at 04:31, xxxxxxxx wrote:

        After searching a few days I've found the answer in a post of NiklasR.

        Here a little code-snippet in order to complete this thread and give anybody reading this the answer:

          
        import c4d  
        from c4d import documents, BaseSelect  
          
          
        def main() :  
          doc = documents.GetActiveDocument()  
          obj = doc.SearchObject("Landschaft")                     #find the object of interest  
          
          selection = obj.GetPointS()                              #read all selected points in a BaseSelect  
          selectedPoints = []                                      #create an empty array  
          
          for i in xrange(obj.GetPointCount()) :                    #iteration over every point in the object  
              if selection.IsSelected(i) :                          #check if the actual point is recorded as selected in the BaseSelect  
                  selectedPoints.append(obj.GetPoint(i))           #if the point is selected store it in the array  
            
          print selectedPoints                                     #print all selected points to the console  
          
        

        cheers,
        blutsvente

        1 Reply Last reply Reply Quote 0
        • First post
          Last post