How to Assign group id while pasting object inside group?

Hi,
I need to copy paste object inside group, but here i am unable to get group id while pasting object inside group.when i pasted object inside group it was not attached to group. so object is not moving along with group. how to get and set group id to object when we paste object inside group?

If you are talking about making sure that when the user copies and pastes member nodes so that the newly copied nodes also become members of the same group(s), just set CommandHandler.copiesGroupKey to true.

But in my case object is not related to any group,object is individual. i need to copy this object inside existing group.

Either set Part.containingGroup or call Group.addMembers.

But how it will find either we are pasting inside group or outside group?

Ctrl-V is a command that the user can execute. Keyboard commands inherently do not provide any positional information.

CommandHandler.pasteSelection does not know anything about “inside” or “outside” of any object. In fact it does not even know where the paste should occur unless the optional argument is provided to that method. And that position is only approximate, since it is only supposed to be the center of the newly copied parts.

shall we know whether a paste operation is inside group or outside group?

I repeat what I said earlier:

So What can we do if we are pasting item arbitrary position how to figure out group information pasted location

That depends entirely on how you want to design your app. I do not know the semantics of what users can draw nor the typical workflows of the app.

If you do have a Point in document coordinates where the paste should happen, then I suppose you could find out if there are any Groups already there at that point. But I do not understand what it is that you want to accomplish.