A few weeks back one of our partners asked me to create a PTC Mathcad file that he could use to demonstrate how curves created with mathematical equations can be exported to Creo. Specifically, he wanted to create a helical curve to help him drive a sweep cut.
We’ve talked before on this blog about the Engineering Notebook, a powerful integration between Creo 3.0 and Mathcad Prime 3.1. With this new capability, communication between the two software applications works bidirectionally, so users can easily push and pull values (dimensions, force values) between the two.
This request from our partner provided a good opportunity to show how the Engineering Notebook can streamline engineering calculations and CAD modeling work.
My solution to the problem included setting up a curve(s) and creating an IBL file by using a simple custom function:
The first step was to get the equations into PTC Mathcad:
To quickly validate the data, I created a 3D plot of the data points:
Everything looks to be in place.
Next I needed to get the data out of PTC Mathcad and into Creo. For that, I need to export it to an IBL file. First I need to get the data in a specific format so I created a four-column matrix, where the first column contains the header, followed by three columns filled with empty strings:
Next I defined the curve section:
Note. If you want to write multiple curves to the same file, you need to make sure that you repeat Curve Section for each curve.
After defining the Curve header and the Curve Section, I stacked them together along with my curve points:
The last step was to actually write the IBL file. For this, I used a custom function called “write without quotes” that, as the name suggests, enables me to export textual information (that always contains quotes), out of PTC Mathcad. [Ed. The WRITEWOQ function is available in the PTC Mathcad subscription bundles.]
At this point, the “test.ibl” file is created, and the PTC Mathcad side of things is all set.
Note. You may have noticed in the image above, I created a variable “path” that has the value “CWD”. This ensures that I can easily retrieve my IBL file when I want to do the import in Creo.
Let’s switch the attention to Creo now and see what we need to do in order to import the curve.
The first thing I did was to embed the PTC Mathcad file into my Creo part. That ensures that I keep everything together so I don’t waste time searching for the corresponding file that goes with this part. Using Get Data/Import from the Model tab, I’ve managed to create the curve that you see below.
The shape of the curve can be changed at any point by accessing the PTC Mathcad file, typing in new inputs, and then updating the model via ATB (Associative Topology Bus).
I took this a step forward and after deciding what curve suits my needs, I’ve used the curve as a cutting path on a cylinder in order to shape a drill bit.
This is just a simple example that demonstrates how to create simple geometry using a mathematical approach, but you can use the same method to create more complex geometry like turbine blades for instance.
If you're not already using PTC Mathcad. get started by downloading your free-for-life version PTC Mathcad Express.