Software Developer's Kit - ChemDraw

Send comments on this topic
AddAttachedAtom Method
See Also 
pVal
[in] Adds this atom to the collection of attached atoms.

Description

Member of ChemDraw Control.Atom

Adds an atom to the collection of attached atoms, for multi-center atoms and variable attachment points 

Syntax

Visual Basic
Public Sub AddAttachedAtom( _
   ByVal pVal As Atom _
) 

Parameters

pVal
[in] Adds this atom to the collection of attached atoms.

Return Type

None

Remarks

Variable attachment points are the points through which we can draw different positional isomers of a compound using an abbreviated notation that retains chemical significance.

Example

'Declares variables
 Dim vAuxAtom  As ChemDrawControl10Ctl.Atom
 Dim myAtom As ChemDrawControl10Ctl.Atom
'Checks that there is an atom loaded in the variable
 If  Selection.Atoms.Count < 1 Then
     Exit Sub
 End If

'AddAttachedAtom 
 Private sub cmdAddAttachedAtom_click()
     MyAtom.IsMultiCenter = True
    
'Verifies if there is a secondary atom chosen
     If  MyAtom.LabelText = "Secondary" Then
         vMessage = MsgBox("Cannot be attached to itself, please select another", vbCritical _
                   + vbOKOnly, "Error") 
          Exit Sub
     End If
     MyAtom.AddAttachedAtom vAuxAtom
     vMessage = MsgBox("Number of AttachedAtom Atoms: " & MyAtom.AddAttachedAtom.Count, vbInformation _
               + vbOKOnly, "Info")
 End Sub

See Also