Skip to main content
5-Regular Member
Apr 29, 2013 5:41 PM UTC

WriteSTL Custom Function

Full list of worksheets

 

WriteSTL allows Mathcad users to create 3D models mathematically using PTC Mathcad then save them as STL files, perfectly suited for incorporation to CAD assemblies.

 

Along with the README, the WriteSTL.zip file contains two worksheets, showing 2 different matrix styles possible to generate 3D models. WriteSTL takes an array of triangle vertices. The included PTC Mathcad worksheets demonstrate inline routines to convert each matrix type to triangle vertices arrays.

 

Also included is the WriteSTL Custom Function compiled and linked for the Windows 7 64-bit platform. The MS Visual Studio project with source is included for anyone needing to build for different Windows Platforms. Microsoft has a free, Express version of Microsoft Visual Studio customers are using to successfully build PTC Mathcad Custom Functions.

17 replies

24-Ruby IV
Feb 22, 2014 7:25 AM UTC
1-Visitor
Feb 22, 2014 1:53 PM UTC

I'll add a function like tis and see. Hopefully the surfaces will be all face up. Stay tuned.

Begin Function CalculateSurfaceNormal (Input Triangle) Returns Vector

        Set Vector U to (Triangle.p2 minus Triangle.p1)

        Set Vector V to (Triangle.p3 minus Triangle.p1)

        Set Normal.x to (multiply U.y by V.z) minus (multiply U.z by V.y)

        Set Normal.y to (multiply U.z by V.x) minus (multiply U.x by V.z)

        Set Normal.z to (multiply U.x by V.y) minus (multiply U.y by V.x)

        Returning Normal

End Function

Translate
1-Visitor
Feb 22, 2014 4:08 PM UTC

So I have a gen_norms function. Can easily be added to Mathcad 14-15 version. In Prime I have have updated the csutomer function to take a second matrix.

Now my Creo license is dead!! No way to test I subtracted the sides and cross producted the vectors correctly.

I'll keep plugging.

Translate
1-Visitor
Feb 24, 2014 2:27 PM UTC

Up and running and will be posting a new WriteSTL.zip today (2/24/2014) with worksheets and source code for Prime. After researching I found that OpenGL renderers call glNormal3f() when normals are not present. This is why my renderings in Creo do not look any different.Mystery solved.

But as you have mentioned the nromals being present can be useful for CFD and perhaps others, they they are now included in the STL outputfile.

Thanks for the tip.

Translate
14-Alexandrite
Nov 6, 2019 12:52 PM UTC

Dear Sir,

 

Is .dll file available for windows 10 - 64 bit.??

I am working with Mathcad 6.0

 

If available please share.

It will helpful for me.

Translate
24-Ruby IV
Nov 7, 2019 7:39 AM UTC

You can find it in attachment.

Translate
14-Alexandrite
Nov 19, 2019 10:39 AM UTC
Dear sir, These files are compatible for Windows 7. I need .dll which works for windows 10 & Mathcad 6.0. If available please provide.
Translate