Create a new "empty" group

To all

As part of program I 'd like to create a group to add elements and nodes to it. I had in mind creating a new "empty" group as soon as the program starts and add things to it as the program goes along (loop). The doc states that 2 inputs are required, see below, and my understanding is that I need at least 1 taggedobject to put in it to create it.

Is there a way of "fouling" NX and passing a "dummy taggedojbect i.e. nothing?

Thanks
Regards

Public Function CreateGroup ( _
setName As String, _
objects As TaggedObject() _
) As CaeGroup

I've not yet verified that this works, but I'd try passing in the value "Nothing" for the "objects" parameter.

Just tried the suggestion and NX does not like the Nothing as the taggedObject

Dim mycaeGroup As CAE.CaeGroup
mycaeGroup = caePart2.CaeGroups.CreateGroup("mygroupname", Nothing)

Thanks
Regards

Does it complain because the input wasn't an array? If so, try:

Dim mycaeGroup As CAE.CaeGroup
mycaeGroup = caePart2.CaeGroups.CreateGroup("mygroupname", {Nothing})

test failed with: Expression expected
May have to create the group on the 1st loop in my main program

Thanks
Regards

I had a similar issue in modeling. I had to create a temporary object (a cube in my case). I create the new group with this object in initially and then remove the object after the group has been created. NX seems perfectly happy to have an empty group. It just doesn't let you create one like this in the first instance.

Looking at the way I went about...

It looks like I created a function AddelementTogroup() which is called in each loop in the main programme. In this function I check if the target group exists, if it doesn't then I create it. It's a couple of lines
To Check if a group exists I simply created a function TheGroupExist() which returns True or False. It is a simple Try ...loop as follows,

Dim theCAEPart As CAE.CaePart = CType(theSimPart, CAE.CaePart)
Dim thecaeGroup As CAE.CaeGroup
Try
thecaeGroup = CType(theCAEPart.CaeGroups.FindObject(sInputGroupName), CAE.CaeGroup)
Catch ex As Exception
End Try

I created "small" functions as it make the main program a bit easier to read.

What I still haven't managed to do is to expand the (final) group with the elements and nodes displayed on the screen. I am using the variable Dim showAdjacentBuilder1 As CAE.ShowAdjacentBuilder but the .Commit or .GetCommittedObjects() do not return anything

Regards
JXB

Thanks
Regards