How can I edit my point-selection?
-
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 -
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