Announcement

Collapse
No announcement yet.

mathcad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Robert DeBolt
    replied
    Originally posted by Mark Spencer View Post
    Thanks for your reply. I would take the simplist one that allows me access to the functionality for array calculations in finite element analysis for example.
    Mark, What kind of array calculations are you talking about?

    PowerBASIC has some very powerful matrix functions.
    I would be happy to assist you in using them.

    Leave a comment:


  • Bob Zale
    replied
    Not at all, Mike. Dominic is not a PowerBASIC employee. He's a very competent programmer who likes to help his many friends here. He also offers a very good PowerBASIC add-on, the Phoenix Visual Designer.

    If you find you need to talk to PowerBASIC employees, you can just contact them at [email protected].

    Bob Zale
    PowerBASIC Inc.

    Leave a comment:


  • Mark Spencer
    replied
    Godness gracious! You wrote all that for me!
    You must be paid my the PowerBasic corporation to provide support?

    I will look at this carefully. Thank you tons.

    Leave a comment:


  • Dominic Mitchell
    replied
    This is from tests I did using the demo version of Mathcad 14.0 some time ago.
    I am not going to post a compilable sample, because the tests were done using
    the OLE container in Phoenix to embed the Mathcad OCX. Besides, the demo has
    already expired on my system.

    Step 1: Generate an include file for the Mathcad automation API.
    If you will never respond to events, then the PB COM Browser should suffice.
    Okay, forget I said that, just hop over to José Roca's site and get yourself a real browser.
    In any case, you will see a list of type libraries listed for Mathcad. Pick the one
    titled "Mathcad Automation API".

    You will get a file similar to the following:

    Code:
    ' ****************************************************************************************
    ' Library Name: Mathcad
    ' Library ID:   {A86F3A06-7127-4E0F-BCAF-56D15FA57AC4}
    ' Library File: C:\Program Files\Mathcad\Mathcad 14\.\automation.tlb
    ' Description:  Mathcad Automation API
    ' Code generated by Phoenix Visual Designer
    ' ****************************************************************************************
    
    ' ****************************************************************************************
    ' ProgIDs (Program identifiers)
    ' ****************************************************************************************
    
    $PROGID_MATHCADNUMERICVALUE                                  = "Mathcad.NumericValue"
    $PROGID_MATHCADSTRINGVALUE                                   = "Mathcad.StringValue"
    $PROGID_MATHCADMATRIXVALUE                                   = "Mathcad.MatrixValue"
    $PROGID_MATHCADWORKSHEET1                                    = "Mathcad.Worksheet.1"
    $PROGID_MATHCADAPPLICATION14                                 = "Mathcad.Application.14"
    $PROGID_MATHCADCUSTOMMETADATAITEM1                           = "Mathcad.CustomMetadataItem.1"
    
    ' ****************************************************************************************
    ' __MIDL___MIDL_itf_automation_0262_0004
    ' ****************************************************************************************
    
    %MIDL___MIDL_ITF_AUTOMATION_0262_0004_MCTEXTREGION           = &H00000000&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0004_MCMATHREGION           = &H00000001&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0004_MCBITMAPREGION         = &H00000002&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0004_MCMETAFILEREGION       = &H00000003&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0004_MCOLEREGION            = &H00000004&
    
    ' ****************************************************************************************
    ' __MIDL___MIDL_itf_automation_0262_0003
    ' ****************************************************************************************
    
    %MIDL___MIDL_ITF_AUTOMATION_0262_0003_MCMAXIMIZED            = &H00000000&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0003_MCMINIMIZED            = &H00000001&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0003_MCNORMAL               = &H00000002&
    
    ' ****************************************************************************************
    ' __MIDL___MIDL_itf_automation_0262_0002
    ' ****************************************************************************************
    
    %MIDL___MIDL_ITF_AUTOMATION_0262_0002_MCSAVECHANGES          = &H00000000&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0002_MCPROMPTTOSAVECHANGES  = &H00000001&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0002_MCDISCARDCHANGES       = &H00000002&
    
    ' ****************************************************************************************
    ' __MIDL___MIDL_itf_automation_0262_0005
    ' ****************************************************************************************
    
    %MIDL___MIDL_ITF_AUTOMATION_0262_0005_MCAUTOCALC             = &H00000000&
    
    ' ****************************************************************************************
    ' __MIDL___MIDL_itf_automation_0262_0001
    ' ****************************************************************************************
    
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCDEFAULTFORMAT        = &H00000000&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCPROMPTUSER           = &H00000001&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCMATHML               = &H00000002&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCHTML                 = &H00000003&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCMCAD6                = &H00000004&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCMCAD7                = &H00000005&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCMCAD8                = &H00000006&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCMCAD2000             = &H00000007&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCMCAD2001             = &H00000008&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCMCADCURRENTVERSION   = &H00000009&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCTEMPLATE             = &H0000000A&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCMCAD2001I            = &H0000000B&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCMCAD12               = &H0000000C&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCXMCD12               = &H0000000D&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCXMCDZ12              = &H0000000E&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCXMCT                 = &H0000000F&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCRTF                  = &H00000010&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCMCAD11               = &H00000011&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCXMCD13               = &H00000012&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCXMCDZ13              = &H00000013&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCXMCD14               = &H00000014&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCXMCDZ14              = &H00000015&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCXMCD                 = &H00000014&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0001_MCXMCDZ                = &H00000015&
    
    ' ****************************************************************************************
    ' __MIDL___MIDL_itf_automation_0262_0006
    ' ****************************************************************************************
    
    %MIDL___MIDL_ITF_AUTOMATION_0262_0006_MCSHOWMESSAGEBOXES     = &H00000000&
    
    ' ****************************************************************************************
    ' __MIDL___MIDL_itf_automation_0262_0007
    ' ****************************************************************************************
    
    %MIDL___MIDL_ITF_AUTOMATION_0262_0007_MCCMTTEXT              = &H00000000&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0007_MCCMTDATE              = &H00000001&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0007_MCCMTNUMBER            = &H00000002&
    %MIDL___MIDL_ITF_AUTOMATION_0262_0007_MCCMTYESNO             = &H00000003&
    
    ' ****************************************************************************************
    ' coclass:        Value
    ' clsid:          {A828667B-A515-4039-BD74-DD1A821E6709}
    ' Description:    Value Class
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadValue
      MEMBER GET  TYPE<&H00000001>() AS STRING
      MEMBER GET  AsString<&H00000002>() AS STRING
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        NumericValue
    ' clsid:          {142355A1-6480-4F39-9198-9DCDC7B7F102}
    ' ProgID:         Mathcad.NumericValue
    ' Description:    NumericValue Class
    ' Type Flags:     [cancreate]
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadNumericValue
      MEMBER GET  TYPE<&H00000001>() AS STRING
      MEMBER GET  AsString<&H00000002>() AS STRING
      MEMBER GET  Real<&H00000000>() AS DOUBLE
      MEMBER LET  Real<&H00000000>() ' rhs as Double
      MEMBER GET  Imag<&H00000003>() AS DOUBLE
      MEMBER LET  Imag<&H00000003>() ' rhs as Double
      MEMBER GET  INTEGER<&H00000004>() AS LONG
      MEMBER LET  INTEGER<&H00000004>() ' rhs as Long
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        StringValue
    ' clsid:          {4D2EE1E0-AB3A-4B3B-B76D-64F6E2D43402}
    ' ProgID:         Mathcad.StringValue
    ' Description:    StringValue Class
    ' Type Flags:     [cancreate]
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadStringValue
      MEMBER GET  TYPE<&H00000001>() AS STRING
      MEMBER GET  AsString<&H00000002>() AS STRING
      MEMBER GET  Value<&H00000000>() AS STRING
      MEMBER LET  Value<&H00000000>() ' rhs as String
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        MatrixValue
    ' clsid:          {E36C1CA0-FC17-4B4C-97D9-317E6403311E}
    ' ProgID:         Mathcad.MatrixValue
    ' Description:    MatrixValue Class
    ' Type Flags:     [cancreate]
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadMatrixValue
      MEMBER GET  TYPE<&H00000001>() AS STRING
      MEMBER GET  AsString<&H00000002>() AS STRING
      MEMBER GET  Rows<&H00000003>() AS LONG
      MEMBER GET  Cols<&H00000004>() AS LONG
      MEMBER CALL GetElement<&H00000005>(IN row AS LONG<&H00000000>, IN col AS LONG<&H00000001>) AS VARIANT
      MEMBER CALL SetElement<&H00000006>(IN row AS LONG<&H00000000>, IN col AS LONG<&H00000001>, IN VAL AS VARIANT<&H00000002>)
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        Worksheet
    ' clsid:          {BD4E383F-CEC2-4B54-AC47-3962009468A1}
    ' ProgID:         Mathcad.Worksheet.1
    ' Description:    Mathcad Worksheet Object
    ' Type Flags:     [cancreate]
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadWorksheet
      MEMBER GET  Application<&H00000001>() AS MathcadApplication
      MEMBER GET  FullName<&H00000002>() AS STRING
      MEMBER GET  NAME<&H00000003>() AS STRING
      MEMBER GET  NeedsSave<&H00000004>() AS INTEGER
      MEMBER GET  Parent<&H00000005>() AS MathcadApplication
      MEMBER GET  Path<&H00000006>() AS STRING
      MEMBER GET  Regions<&H00000007>() AS MathcadRegions
      MEMBER GET  Windows<&H00000008>() AS MathcadWindows
      MEMBER CALL CLOSE<&H00000009>(OPTIONAL IN SaveOption AS LONG<&H00000000>)
      MEMBER CALL GetOption<&H0000000A>(IN OPTION AS LONG<&H00000000>) AS VARIANT
      MEMBER CALL GetValue<&H0000000B>(IN bstrName AS STRING<&H00000000>) AS VARIANT
      MEMBER CALL PrintAll<&H0000000C>()
      MEMBER CALL Recalculate<&H0000000D>()
      MEMBER CALL SAVE<&H0000000E>()
      MEMBER CALL SaveAs<&H0000000F>(IN filespec AS STRING<&H00000000>, OPTIONAL IN Format AS LONG<&H00000001>)
      MEMBER CALL SetOption<&H00000010>(IN OPTION AS LONG<&H00000000>, IN vValue AS VARIANT<&H00000001>)
      MEMBER CALL SetValue<&H00000011>(IN bstrName AS STRING<&H00000000>, IN vValue AS VARIANT<&H00000001>)
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        Application
    ' clsid:          {94FBBD40-E791-4E8C-8F21-FA7A724654DA}
    ' ProgID:         Mathcad.Application.14
    ' Description:    Mathcad Application Object
    ' Type Flags:     [cancreate]
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadApplication
      MEMBER GET  NAME<&H00000000>() AS STRING
      MEMBER GET  Application<&H00000001>() AS MathcadApplication
      MEMBER GET  Parent<&H00000002>() AS MathcadApplication
      MEMBER GET  ActiveWorksheet<&H00000003>() AS MathcadWorksheet
      MEMBER GET  ActiveWindow<&H00000004>() AS MathcadWindow
      MEMBER GET  Worksheets<&H00000005>() AS MathcadWorksheets
      MEMBER GET  FullName<&H00000006>() AS STRING
      MEMBER GET  Path<&H00000007>() AS STRING
      MEMBER LET  DefaultFilePath<&H00000008>() ' rhs as String
      MEMBER GET  DefaultFilePath<&H00000008>() AS STRING
      MEMBER LET  Height<&H00000009>() ' rhs as Long
      MEMBER GET  Height<&H00000009>() AS LONG
      MEMBER LET  WIDTH<&H0000000A>() ' rhs as Long
      MEMBER GET  WIDTH<&H0000000A>() AS LONG
      MEMBER LET  LEFT<&H0000000B>() ' rhs as Long
      MEMBER GET  LEFT<&H0000000B>() AS LONG
      MEMBER LET  Top<&H0000000C>() ' rhs as Long
      MEMBER GET  Top<&H0000000C>() AS LONG
      MEMBER GET  Version<&H0000000D>() AS STRING
      MEMBER LET  Visible<&H0000000E>() ' rhs as Integer
      MEMBER GET  Visible<&H0000000E>() AS INTEGER
      MEMBER GET  Windows<&H0000000F>() AS MathcadWindows
      MEMBER CALL Quit<&H00000010>(OPTIONAL IN SaveOption AS LONG<&H00000000>)
      MEMBER CALL CloseAll<&H00000011>(OPTIONAL IN SaveOption AS LONG<&H00000000>)
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        Worksheets
    ' clsid:          {3C6A3022-1F83-47EC-885A-7139E65FF108}
    ' Description:    Mathcad Worksheets Collection
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadWorksheets
      MEMBER GET  Application<&H00000001>() AS MathcadApplication
      MEMBER GET  Count<&H00000002>() AS LONG
      MEMBER GET  Parent<&H00000003>() AS MathcadApplication
      MEMBER CALL ADD<&H00000004>() AS MathcadWorksheet
      MEMBER CALL Item<&H00000000>(OPTIONAL IN index AS VARIANT<&H00000000>) AS MathcadWorksheet
      MEMBER CALL OPEN<&H00000005>(IN pFileName AS STRING<&H00000000>) AS MathcadWorksheet
      MEMBER CALL Remove<&H00000006>(IN index AS VARIANT<&H00000000>)
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        Windows
    ' clsid:          {FB9C64CD-1B3C-47CA-97E7-C95C6D61F4C5}
    ' Description:    Mathcad Windows Collection
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadWindows
      MEMBER GET  Application<&H00000001>() AS MathcadApplication
      MEMBER GET  Parent<&H00000002>() AS VARIANT
      MEMBER GET  Item<&H00000003>(index AS VARIANT<&H00000000>) AS MathcadWindow
      MEMBER GET  Count<&H00000004>() AS LONG
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        Window
    ' clsid:          {3BEC5E1E-C9EF-4806-9B23-591A890B481E}
    ' Description:    Mathcad Window Object
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadWindow
      MEMBER GET  Application<&H00000001>() AS MathcadApplication
      MEMBER GET  Height<&H00000002>() AS LONG
      MEMBER LET  Height<&H00000002>() ' rhs as Long
      MEMBER GET  LEFT<&H00000003>() AS LONG
      MEMBER LET  LEFT<&H00000003>() ' rhs as Long
      MEMBER GET  Parent<&H00000004>() AS MathcadApplication
      MEMBER GET  Top<&H00000005>() AS LONG
      MEMBER LET  Top<&H00000005>() ' rhs as Long
      MEMBER GET  WIDTH<&H00000006>() AS LONG
      MEMBER LET  WIDTH<&H00000006>() ' rhs as Long
      MEMBER GET  WindowState<&H00000007>() AS LONG
      MEMBER LET  WindowState<&H00000007>() ' rhs as Long
      MEMBER GET  Worksheet<&H00000008>() AS MathcadWorksheet
      MEMBER GET  Zoom<&H00000009>() AS INTEGER
      MEMBER LET  Zoom<&H00000009>() ' rhs as Integer
      MEMBER CALL Activate<&H0000000A>()
      MEMBER CALL ScrollTo<&H0000000B>(IN X AS LONG<&H00000000>, IN Y AS LONG<&H00000001>)
      MEMBER CALL ScrollToRegion<&H0000000C>(IN pRegion AS DWORD<&H00000000>)
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        Regions
    ' clsid:          {2B791942-9A20-4CBA-8453-3BAAA9C1BF51}
    ' Description:    Mathcad Regions Collection
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadRegions
      MEMBER CALL Item<&H00000000>(OPTIONAL IN index AS VARIANT<&H00000000>) AS DWORD
      MEMBER GET  Count<&H00000001>() AS LONG
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        MathcadOld
    ' clsid:          {AE7C5340-D9BF-11CF-87C7-0000C021AF0D}
    ' Description:    Mathcad Object
    ' Type Flags:     [cancreate]
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadMathcadOld
      MEMBER CALL Recalculate<&H00000001>() AS LONG
      MEMBER CALL GetComplex<&H00000002>(IN NAME AS STRING<&H00000000>, OUT RealPart AS VARIANT<&H00000001>, OUT ImagPart AS VARIANT<&H00000002>) AS LONG
      MEMBER CALL SetComplex<&H00000003>(IN NAME AS STRING<&H00000000>, IN RealPart AS VARIANT<&H00000001>, IN ImagPart AS VARIANT<&H00000002>) AS LONG
      MEMBER CALL SaveAs<&H00000004>(OPTIONAL IN NAME AS VARIANT<&H00000000>) AS LONG
      MEMBER GET  Worksheet<&H00000005>() AS MathcadWorksheet
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        CustomMetadataItem
    ' clsid:          {1BEC60CE-A859-47EE-8C48-95DD9382B94C}
    ' ProgID:         Mathcad.CustomMetadataItem.1
    ' Description:    Mathcad CustomMetadataItem object
    ' Type Flags:     [cancreate]
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadCustomMetadataItem
      MEMBER GET  NAME<&H00000001>() AS STRING
      MEMBER LET  NAME<&H00000001>() ' rhs as String
      MEMBER GET  TYPE<&H00000002>() AS LONG
      MEMBER LET  TYPE<&H00000002>() ' rhs as Long
      MEMBER GET  Value<&H00000000>() AS VARIANT
      MEMBER LET  Value<&H00000000>() ' rhs as Variant
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        CustomMetadataCollection
    ' clsid:          {35842E77-E51F-40F1-BD17-5E8476F1537A}
    ' Description:    Mathcad CustomMetadataCollection object
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadCustomMetadataCollection
      MEMBER GET  Application<&H00000001>() AS MathcadIMathcadApplication2
      MEMBER GET  Count<&H00000002>() AS LONG
      MEMBER CALL Item<&H00000000>(OPTIONAL IN index AS VARIANT<&H00000000>) AS MathcadCustomMetadataItem
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        WorksheetMetadata
    ' clsid:          {574DBD9C-DC5D-47E4-82E8-387783EA7B7B}
    ' Description:    Mathcad WorksheetMetadata object
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadWorksheetMetadata
      MEMBER GET  Application<&H00000001>() AS MathcadIMathcadApplication2
      MEMBER GET  Parent<&H00000002>() AS VARIANT
      MEMBER GET  CustomItems<&H00000003>() AS MathcadCustomMetadataCollection
      MEMBER CALL AddCustomItem<&H00000004>(IN pItem AS MathcadCustomMetadataItem<&H00000000>)
      MEMBER CALL RemoveCustomItem<&H00000005>(IN vItem AS VARIANT<&H00000000>)
      MEMBER GET  Author<&H0000000A>() AS STRING
      MEMBER LET  Author<&H0000000A>() ' rhs as String
      MEMBER GET  Company<&H0000000B>() AS STRING
      MEMBER LET  Company<&H0000000B>() ' rhs as String
      MEMBER GET  Description<&H0000000C>() AS STRING
      MEMBER LET  Description<&H0000000C>() ' rhs as String
      MEMBER GET  DocumentID<&H0000000D>() AS STRING
      MEMBER GET  Keywords<&H0000000E>() AS STRING
      MEMBER LET  Keywords<&H0000000E>() ' rhs as String
      MEMBER GET  RevisedBy<&H0000000F>() AS STRING
      MEMBER LET  RevisedBy<&H0000000F>() ' rhs as String
      MEMBER GET  Revision<&H00000010>() AS LONG
      MEMBER GET  Title<&H00000011>() AS STRING
      MEMBER LET  Title<&H00000011>() ' rhs as String
      MEMBER GET  VersionID<&H00000012>() AS STRING
      MEMBER GET  ParentVersionID<&H00000013>() AS STRING
      MEMBER GET  BranchID<&H00000014>() AS STRING
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        RegionMetadata
    ' clsid:          {FBBAF74A-DA47-4D1A-A14A-641F3F767F27}
    ' Description:    Mathcad RegionMetadata object
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadRegionMetadata
      MEMBER GET  Application<&H00000001>() AS MathcadIMathcadApplication2
      MEMBER GET  Parent<&H00000002>() AS VARIANT
      MEMBER GET  CustomItems<&H00000003>() AS MathcadCustomMetadataCollection
      MEMBER CALL AddCustomItem<&H00000004>(IN pItem AS MathcadCustomMetadataItem<&H00000000>)
      MEMBER CALL RemoveCustomItem<&H00000005>(IN vItem AS VARIANT<&H00000000>)
    END INTERFACE
    
    ' ****************************************************************************************
    ' Interface:      IMathcadApplication2
    ' uuid:           {80298DA1-2DE1-44CC-934E-A57A74052A77}
    ' Description:    IMathcadApplication2 Interface
    ' Type Flags:     [dual, dispatchable]
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadIMathcadApplication2
      MEMBER GET  NAME<&H00000000>() AS STRING
      MEMBER GET  Application<&H00000001>() AS MathcadApplication
      MEMBER GET  Parent<&H00000002>() AS MathcadApplication
      MEMBER GET  ActiveWorksheet<&H00000003>() AS MathcadWorksheet
      MEMBER GET  ActiveWindow<&H00000004>() AS MathcadWindow
      MEMBER GET  Worksheets<&H00000005>() AS MathcadWorksheets
      MEMBER GET  FullName<&H00000006>() AS STRING
      MEMBER GET  Path<&H00000007>() AS STRING
      MEMBER LET  DefaultFilePath<&H00000008>() ' rhs as String
      MEMBER GET  DefaultFilePath<&H00000008>() AS STRING
      MEMBER LET  Height<&H00000009>() ' rhs as Long
      MEMBER GET  Height<&H00000009>() AS LONG
      MEMBER LET  WIDTH<&H0000000A>() ' rhs as Long
      MEMBER GET  WIDTH<&H0000000A>() AS LONG
      MEMBER LET  LEFT<&H0000000B>() ' rhs as Long
      MEMBER GET  LEFT<&H0000000B>() AS LONG
      MEMBER LET  Top<&H0000000C>() ' rhs as Long
      MEMBER GET  Top<&H0000000C>() AS LONG
      MEMBER GET  Version<&H0000000D>() AS STRING
      MEMBER LET  Visible<&H0000000E>() ' rhs as Integer
      MEMBER GET  Visible<&H0000000E>() AS INTEGER
      MEMBER GET  Windows<&H0000000F>() AS MathcadWindows
      MEMBER CALL Quit<&H00000010>(OPTIONAL IN SaveOption AS LONG<&H00000000>)
      MEMBER CALL CloseAll<&H00000011>(OPTIONAL IN SaveOption AS LONG<&H00000000>)
      MEMBER CALL SetOption<&H00000012>(IN OPTION AS LONG<&H00000000>, IN VAL AS VARIANT<&H00000001>)
      MEMBER CALL GetOption<&H00000013>(IN OPTION AS LONG<&H00000000>) AS VARIANT
      MEMBER GET  Active<&H00000014>() AS INTEGER
      MEMBER LET  Active<&H00000014>() ' rhs as Integer
      MEMBER GET  HWND<&H00000015>() AS LONG
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        Worksheet
    ' clsid:          {BD4E383F-CEC2-4B54-AC47-3962009468A1}
    ' ProgID:         Mathcad.Worksheet.1
    ' Description:    Mathcad Worksheet Object
    ' Type Flags:     [cancreate]
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadWorksheet
      MEMBER GET  Application<&H00000001>() AS MathcadApplication
      MEMBER GET  FullName<&H00000002>() AS STRING
      MEMBER GET  NAME<&H00000003>() AS STRING
      MEMBER GET  NeedsSave<&H00000004>() AS INTEGER
      MEMBER GET  Parent<&H00000005>() AS MathcadApplication
      MEMBER GET  Path<&H00000006>() AS STRING
      MEMBER GET  Regions<&H00000007>() AS MathcadRegions
      MEMBER GET  Windows<&H00000008>() AS MathcadWindows
      MEMBER CALL CLOSE<&H00000009>(OPTIONAL IN SaveOption AS LONG<&H00000000>)
      MEMBER CALL GetOption<&H0000000A>(IN OPTION AS LONG<&H00000000>) AS VARIANT
      MEMBER CALL GetValue<&H0000000B>(IN bstrName AS STRING<&H00000000>) AS VARIANT
      MEMBER CALL PrintAll<&H0000000C>()
      MEMBER CALL Recalculate<&H0000000D>()
      MEMBER CALL SAVE<&H0000000E>()
      MEMBER CALL SaveAs<&H0000000F>(IN filespec AS STRING<&H00000000>, OPTIONAL IN Format AS LONG<&H00000001>)
      MEMBER CALL SetOption<&H00000010>(IN OPTION AS LONG<&H00000000>, IN vValue AS VARIANT<&H00000001>)
      MEMBER CALL SetValue<&H00000011>(IN bstrName AS STRING<&H00000000>, IN vValue AS VARIANT<&H00000001>)
    END INTERFACE
    
    ' ****************************************************************************************
    ' coclass:        Window
    ' clsid:          {3BEC5E1E-C9EF-4806-9B23-591A890B481E}
    ' Description:    Mathcad Window Object
    ' ****************************************************************************************
    
    INTERFACE DISPATCH MathcadWindow
      MEMBER GET  Application<&H00000001>() AS MathcadApplication
      MEMBER GET  Height<&H00000002>() AS LONG
      MEMBER LET  Height<&H00000002>() ' rhs as Long
      MEMBER GET  LEFT<&H00000003>() AS LONG
      MEMBER LET  LEFT<&H00000003>() ' rhs as Long
      MEMBER GET  Parent<&H00000004>() AS MathcadApplication
      MEMBER GET  Top<&H00000005>() AS LONG
      MEMBER LET  Top<&H00000005>() ' rhs as Long
      MEMBER GET  WIDTH<&H00000006>() AS LONG
      MEMBER LET  WIDTH<&H00000006>() ' rhs as Long
      MEMBER GET  WindowState<&H00000007>() AS LONG
      MEMBER LET  WindowState<&H00000007>() ' rhs as Long
      MEMBER GET  Worksheet<&H00000008>() AS MathcadWorksheet
      MEMBER GET  Zoom<&H00000009>() AS INTEGER
      MEMBER LET  Zoom<&H00000009>() ' rhs as Integer
      MEMBER CALL Activate<&H0000000A>()
      MEMBER CALL ScrollTo<&H0000000B>(IN X AS LONG<&H00000000>, IN Y AS LONG<&H00000001>)
      MEMBER CALL ScrollToRegion<&H0000000C>(IN pRegion AS DWORD<&H00000000>)
    END INTERFACE
    Step 2: Launch the Mathcad server.
    You will probably have to declare a global variable for the Mathcad application object.

    Code:
    GLOBAL  oMathcadApp   AS MathcadApplication
    Then initialize it when you program starts as explained below.
    If you are just going to use the Mathcad server without embedding the OCX, then use this.

    Code:
      ' Mathcad Application Object 
      SET oMathcadApp = MathcadApplication IN $PROGID_MATHCADAPPLICATION14
      IF ISFALSE ISOBJECT(oMathcadApp) THEN
        SET oMathcadApp = NEW MathcadApplication IN $PROGID_MATHCADAPPLICATION14
      END IF
    If you are going to embed the OCX use this

    Code:
      ' Mathcad Application Object(mathcad.exe -Embedding)
      ' Launch the embedding server
      SET oMathcadApp = NEW MathcadApplication IN $PROGID_MATHCADAPPLICATION14
    The first code snippet uses an instance of the Mathcad server that is currently running.
    Well, that is something you don't want to do when embedding the OCX. The Mathcad server, mathcad.exe,
    must be launched with the -Embedding option in order to be able to embed a mathad worksheet. If the
    current instance was launched from Windows Explorer, it means the Embedding option was not used, and
    any attempt to embed a worksheet in a window will fail.

    Step 3: Free outstanding reference.
    Just before you program terminates, do this

    Code:
      oMathcadApp = NOTHING
    Step 4: Do something useful.
    This code snippet is from one of the samples that came with the demo.
    Code:
      LOCAL oWkSheet    AS MathcadWorksheet
      LOCAL vObj        AS VARIANT
      LOCAL vName       AS VARIANT
      LOCAL vValue      AS VARIANT
      
      OBJECT GET oMathCadApp.Worksheets TO vObj
      vFile = "C:\beamdef.mcd"
      OBJECT CALL oMathCadApp.Worksheets.Open(vFile) TO vObj
      oWksheet = vObj
      IF ISOBJECT(oWksheet) THEN
        ' Pass Load to the Mathcad sheet where it is bound to a Mathcad variable called F
        vName  = "F"
        vValue = 101
        OBJECT CALL oWksheet.SetValue(vName, vValue)
    
        'Extract the variable Smax from the Mathcad sheet
        OBJECT CALL oWksheet.GetValue(vName) TO vValue
      END IF
    If you have a code sample(any language) that you want help with, post it or information
    about where it may be found.
    Last edited by Dominic Mitchell; 2 Aug 2008, 03:48 PM.

    Leave a comment:


  • Mark Spencer
    replied
    Thanks for your reply. I would take the simplist one that allows me access to the functionality for array calculations in finite element analysis for example.

    Leave a comment:


  • Dominic Mitchell
    replied
    It can. Are you trying to communicate with the exe or the ocx?

    Leave a comment:


  • Mark Spencer
    started a topic mathcad

    mathcad

    Can Powerbasic communicate with MathCad?
    Are there any examples? (I did a search and came up empty)
Working...
X