Composite Sketching, ANSYS Style: Copying a Sketch from One DesignModeler Session to Another

Recently a customer approached me and told me that he had a sketch in one DesignModeler database that needed to be copied over to another DesignModeler database and asked me if it would be possible to do so. My initial reaction was, “No way, dude be trippin’,” because that’s how I talk in professional settings. But, I really wasn’t ready to assert its impossibility without first digging into it a bit, so that’s what I did.

Clicking around the DesignModeler menus (Ever wonder how we ANSYS support professionals figure things out? Now you know.) I found something that had flown under my radar previously. Under the File menu are a couple of selections indicating the ability to write and read sketch scripts. Pay dirt.

So, what is it that these wonderful scripts can do for us? Let’s take a look. Say, for example, you have two separate sketches in two separate DesignModeler sessions. I have labeled these sessions “Face” and “Head.” See if you can figure out which is which.

imageimage

(Side note: It may be hard to believe, but this is not the original geometry the customer was working with)

Now, keeping in mind that these are two completely different DesignModeler databases, how can I copy the Face sketch, including dimensions, and paste it on top of the Head sketch? The answer is simple. First highlight the DesignModeler plane containing the Face sketch.

image

Next, click File > Write Script: Sketch(es) of Active Plane. You will be prompted for a file name and location of the resulting jScript file. Specify those and click [Save].

imageimage

Note that all of the sketches on the selected plane will be written to the jScript file. If there are any sketches you don’t want to keep, you can always delete them later.

Next, move over to the Head model. Highlight the plane you would like to copy the Face sketch to. In this case, it is the XYPlane again, but you can pick whatever plane you want; it doesn’t have to be the same plane between sessions. The sketch will maintain its position relative to the origin of whichever plane you select.

image

Next click File > Run Script and select the jScript file that was written previously. Click [Open].

image

image

More than likely, you will get a warning about modifying the feature number to avoid duplicates. This is normal. It simply means that it’s renumbering the imported sketch to avoid having, for example, two “Sketch1” objects. Click [OK].

You will now see the Face sketch, dimensions and all, overlaid on the Head sketch. The Sketch object has been renumbered and placed onto the XYPlane.

imageimage

And, as you can see, everyone is happy.