Mathcad + Rhino

Does anyone know if there is a way to read in or write out a Mathcad file to/from Rhino/Grasshopper?

I have found ways to do this with Excel files, but typically I prefer to work in Mathcad since spreadsheets are error-prone. The use is for engineering work where geometry is created in Rhino/Grasshopper but the parameters and input would be in Mathcad.

Thanks, Andrew

Hi @Andrew_Cronin,

There is this plugin:

2 Likes

Thanks @Erik_Beeren. I have seen this, however, it doesn’t appear to support Rhino 8, and I’m not sure if it supports Mathcad Prime 9 either given the development of the plugin is outdated.

If you wanted to use Python to connect the two products, this would work:

2 Likes

Check out this alternative (sMath) ghMath | Food4Rhino

Thanks @scottd, I actually have been looking into this and will probably go this route.

Thanks @w.radaczynski , I prefer to use Mathcad.

@scottd , I’ve been trying to get this solution to work, but it requires installing MathcadPy inside of the GH Python script editor which isn’t working. (pip install MathcadPy)
Any suggestions on how to install a module (e.g., MathcadPy, numpy, etc.) in GH?

Use the # requirements line at the start.

"""Grasshopper Script"""
# requirements: pywin32, MathcadPy

import MathcadPy

When watching the error messages and some looking at MathcadPy documentation it does require the additional package pywin32

Is your case in Windows?
Does this set of lines work in your case?

I do not have Mathcad, so I can only go so far, but here is sample code that might be good to test: MathcadPy/documentation/Examples/simple_example.py at master · MattWoodhead/MathcadPy · GitHub

2 Likes

Awesome!! Thanks @scottd , that worked right away!
Now Mathcad is interacting w/ GH! Super awesome.

2 Likes

I copied codes from MathcadPy/documentation/Examples/simple_example.py at master · MattWoodhead/MathcadPy · GitHub
and add what @scottd suggested in the GH python.

"""Grasshopper Script"""
# requirements: pywin32, MathcadPy

import MathcadPy

But it shows error as below. How to solve it?

@netsonicyxf Let’s try a few things:

This script kind of works for me. Notice that I am not specifying pywin32 as it is a requirement of MathcadPy and pip automatically installs that.

However on the first run, the package installs but I get an import error on import MathcadPy. There reason is that pywin32 installs a .pth file that adjusts python search paths.

On restarting Rhino and running the script again, the module imports correctly.

#! python3
# requirements: MathcadPy

import MathcadPy
print(MathcadPy)
  • Reset your Python 3 Runtime

  • Run this script
  • if installation fails (not import) then run RhinoCodeLogs command and send me all the contents

@eirannejad
I deleted “pywin32” and resetted Python 3 Runtime, but stil got error.
ScriptEditor.log (30.3 KB)

@netsonicyxf Seems like this is some SSL certificate error

  File "C:\Users\YXF\.rhinocode\py39-rh8\lib\ssl.py", line 997, in _create
    raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname

Would you mind testing this with Rhino 8.13 SRC? I have pushed a fix in there related to similar SSL certificate issues

1 Like

@eirannejad
I tested this with Rhino 8.14 if it’s ok. But still got error.
ScriptEditor.log (32.4 KB)