CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: chemsketch

  1. #1
    Join Date
    Jun 2010
    Location
    palermo
    Posts
    17

    chemsketch

    i'm developing a chemistry program i find this code in the program chemsketch
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' ACD CHEMBASIC DEMO PROGRAM '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' '
    ' Molecular 3D Editor//MIRROR.BAS '
    ' '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' '
    ' The utility flips the molecule at a plane '
    ' '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


    CONST TITLE="ChemBasic Molecular Editor // Mirror"


    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Function Main As String
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' MIRROR.BAS '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Dim page,diag,asm,struc As Object, s As String, OK As Boolean

    MAIN="Failed or nothing to do!"

    ' Get 1st structure from the curent page
    page=ActiveDocument.ActivePage
    If page.Diagrams.Count<1 Then Exit Function
    diag=page.Diagrams.Item(1)
    asm=Assemblies.AddFromCS(diag)
    If asm=NULL Then Exit Function
    struc=Asm.Structures.Item(1)
    If struc=NULL Then Exit Function

    ' Do the job
    s=UserIOBox("Flip X, Y, or Z coordinate ?" ,TITLE , "Y")
    s=UCase(Left(s,1))
    If s="X" OR s="Y" OR s="Z" Then
    ' Flip !
    Call Flip(struc,s)
    ' Show the results
    RefreshDiagram(diag,struc)
    Main="Completed."
    End If

    End Function



    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub Flip(struc As Object,s As String)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Dim x,y,z As Double, asm,at As Object
    With struc
    asm=.Assembly
    For Each at In asm
    .GetAtomXYZ(at,x,y,z)
    Select Case s
    Case "X"
    x=-x
    Case "Y"
    y=-y
    Case "Z"
    z=-z
    End Select
    .SetAtomXYZ(at,x,y,z)
    Next at
    End With
    End Sub


    '***LIBRARY PROCEDURES BEGIN



    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Sub RefreshDiagram(diag As Object,strmol As Object)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' LIB0.BAS PROCEDURE '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' Redraws the diagram with a molecule or structure object '
    ' '
    ' ENTER '
    ' diag object of type CS_DIAGRAM '
    ' strmol object of type CB_MOLECULE or CB_STRUCTURE '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Dim l,t,w,h,w1,h1 As Integer
    diag.GetBound(l,t,w,h)
    diag.Depict(strmol)
    diag.GetBound(w,h,w1,h1)
    diag.SetBound(l,t,w1,h1)
    End Sub



    '***LIBRARY PROCEDURES END

    '@@@@@@

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: chemsketch

    i'm developing a chemistry program i find this code in the program chemsketch
    ... and ?

  3. #3
    Join Date
    Jun 2010
    Location
    palermo
    Posts
    17

    Re: chemsketch

    Quote Originally Posted by Skizmo View Post
    ... and ?
    do you know how write this code?!?!?

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: chemsketch

    The code is already written.
    That code is not C++.
    When posting code, please use code tags.
    What is your question?

  5. #5
    Join Date
    Jun 2010
    Location
    palermo
    Posts
    17

    Re: chemsketch

    is possible,there are program,you convert number in code?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured