Software Developer's Kit - ChemDraw

Send comments on this topic
Atoms Property
See Also 

Description

Member of ChemDraw Control.AltGroup.

Returns the atoms in this AltGroup.

Property type

Read-only property

Syntax

Visual Basic
Public Property Atoms() As Atoms

Return Type

Remarks

This property refers to the collection of atoms which is in this AltGroup. The members of this collection will be the atoms in this AltGroup. The properties associated with the collection are the following:

myAltGroup.Atoms.Application      returns the application associated with the collection of atoms 
myAltGroup.Atoms.Count             returns the number of atoms that are in this AltGroup
myAltGroup.Atoms.Item(i)           returns one atom from the collection 
myAltGroup.Atoms.Parent            returns the parent of the collection of atoms

With AltGroup.Atoms.Item(i) all the atom properties are enabled for atom(i). This index starts with 1.

Since all the structures within an AltGroup are to be used interchangeably, they must have the same number of attachments. To specify where the fragments should bond to the parent structure on the AltGroup label you must define Attachment Points (myAtom.IsAttachmentPoint). After creating the attachment point, you can verify the node is present with a bond or a selection tool. This provides a way to check the definition of pre-existing attachment points.

Example

'Atoms property of AltGroup 
 Dim MyAltGroup As ChemDrawControl10Ctl.AltGroup
 Private Sub ChemDrawControl10Ctl_SelectionChanged(ByVal selection As ChemDrawControl10Ctl.IChemDrawSelection)
     If  ChemDrawControl10Ctl.Objects.AltGroups.Count = 1 Then 'Checks if one AltGroup has been drawn
         Set MyAltGroup = ChemDrawControl10Ctl.Objects.AltGroups.Item(1)
         Command1.Enabled = True
     Else
         Command1.Enabled = False
     End If
 End Sub
 Private Sub Command1_Click()
    'Returns the number of atoms in this AltGroup
     vMessage = MsgBox("The alt group has " & MyAltGroup.Atoms.Count & " Atom/s", _
                vbInformation + vbOKOnly, "Info")
 End Sub


See Also