Skip to main content
5-Regular Member
April 29, 2013

WriteSTL Custom Function

  • April 29, 2013
  • 15 replies
  • 11382 views

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.

15 replies

24-Ruby III
February 22, 2014
1-Visitor
February 22, 2014

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

1-Visitor
February 22, 2014

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.

1-Visitor
February 24, 2014

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.

14-Alexandrite
November 6, 2019

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.

24-Ruby III
November 7, 2019

You can find it in attachment.

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