Macros

  • sorted.mac

    Gordon May (Rolls Royce Compressor Key System)

    Example of sorting arrays using *MOPER.

  • sortem.mac

    Rick Fischer (Marconi Communications

    Another similar example of sorting arrays using *MOPER.

  • sorter.mac

    Chris Masterson (University of Toronto)

    A while back I asked Bill Bulat for a pointer to a macro that could be used for meshing skin depths. He gave me some good pointers. I have since been working on a skin depth macro myself. I now have a first working beta". It is currently pretty crude since I'm relatively new to ANSYS, my geometry is pretty simple and the expansion algorithm I worked out is very simple. It will only mesh a line of rectangular prisms oriented with the current coordinate system. The end result is something similar to what a straight VSWEEP command could accomplish but with the difference that the user can specify exactly the thickness of the skin depth (or boundary layer if it suits) and how many layers of mesh should be contained in that skin depth. Suits my purposes for now so I thought that maybe somebody else might find a use as well. There are actually three macros: skin.mac - the main macro, and sorter.mac and picker.mac that are called from the main macro. The other caveat I guess is to mention that I wrote them for Ansys 5.5 and so some of the command names may be changed or obsolete (which includes jumping to a label which was already technically obsolete in 5.5) in newer versions."
    "I posted some skin depth meshing macros to the Ansys egroup that you reproduced on your ansys.net page. Since then I have updated the macros significantly to make them more usable and a lot less buggy. The macro is now able to mesh full planes of rectangular prisms, instead of just a line of prisms. With the use of an extra coordinate system I use it to expand the mesh in both directions away from the surface of interest. The macros are now updated to Ansys version 5.6 as well (and in fact won't work in 5.5 due to VSWEEP no longer requiring source and target areas). Just thought I would send the new improved versions to save frustration if anyone ever uses them."

  • spider.mac

    Marco Perucchi (Delta JS AG)

    "I have a macro that might be useful for you. It creates spider webs between 1 center and a group of surrounding nodes. Before starting the macro you have to collect the center node in one component and the group of surrounding nodes in another component. If you are able to do that with your model you should be able to create the link elements without problems."

  • spider2.mac

    Donald Cummings (GE Transportation Systems)

    "This macro creates a spider-web that connects a center node with a group of surrounding nodes on the inside surface of a hole with line elements (beam or link). The modeling objective is to provide attachment of a single point to the inside surface of a hole for the transfer of loads or boundary conditions to the model. This is an approximate method of modeling a shaft support in a hole."

  • spider3.mac

    Barry O'Donnell (ODCS Ltd.)

    "I attach the macro which I was working on, for which I recieved help from the group for. It is called as:
    spider,arg1,arg2
    where arg1 is the washer diameter and arg2 is the centre node number. It is intended to connect all the nodes on the attached area that are within the washer diameter (arg1) to the central node (arg2) using RBE3 eleemnts. Useful if you haven't specific areas which correspond to the bolt head dimension etc. It would be easy to modify, though currently it is intended for bolts aligned with the global x-axis."

  • spiral.mac

    Keith DiRienz (PADT)

    A macro to generate a spiral.

  • spltarcs.mac

    John Crawford (Honeywell)

    A macro that splits the selected arcs into two pieces. this is done to avoid problems when using NUMM,KP with circles made from two 180 degree arcs..

  • spokes.mac

    Pat Cunningham (CAEAI)

    "The macro will create a connection between a selected set of nodes and a master node typically located at the center of curvature of a line connecting the selected nodes."
    Used for generating CERIG, MPC184, or RBE3.

  • spokes_mpc.mac

    R. Balasubramanian (Brakes India Ltd - TVS)

    "This Macro forms a 'spider web' like Multipoint constraint for a given set of nodes. The user has to just place the clusters of nodes in separate components by names 'NODES1','NODES2'..etc., The macro automatically finds the 'centre-node' for each node cluster and links it with the surrounding nodes in the cluster to form a 'spokes' pattern using MPC 184 elements with 'Rigid-beam' option (the element option can be changed by user for his/her requirements)."

  • stiicemflotran.mac

    Sheldon Imaoka (ANSYS, Inc.)

    MESH200 supports a 4-node tetrahedral option (KEYOPT(1)=8), but the node numbering is different from a degenerate 8-node tetrahedral element, such as FLUID142.
    If a user exports a lower-order tetrahedral mesh using MESH200, conversion to an actual element, such as FLUID142, may be required. Use of this macro allows a user to perform this relatively easily (it is customized to convert 4-node MESH200 tetrahedral elements to Flotran FLUID142 tetrahedral elements, although the user can modify the macro to suit his/her needs).

  • strne.mac

    Mike Rife (CSI)

    This macro sums the strain energy at every substep for a transient analysis and then plots the values versus time.

  • strplot.mac

    Peter Bastian (Darmstadt University of Technology)

    This macro displays results as continuos contours using the PLNSOL command. For the display of the numbers in the legend, you can define the number of contours and the number of digits after the decimal point, to be displayed. If you do not want any digits after the decimal point, you can define, how many places should be displayed with a "0". For example 2100 instead of 2123.

  • subcont.mac

    Joe Metrisin (Florida Turbine Technologies, Inc.)

    "Attached is a macro I wrote years ago which automates substructuring with contact. Just build the complete model with contact elements included, and create the component names as described in the macro header. The macro puts all the linear elements into a superelement and iterates on the contact elements only."

  • svsel.mac

    Sheldon Imaoka (ANSYS, Inc.)

    Macro used to select solids based on the value of the volume itself (=length^3). Can be used to select all volumes of a certain value or a range of values (with tolerance).

  • swp.mac

    Barry O'Donnell (ODCS Ltd.)

    "This macro extracts the peak worst principal stress. The worst principal stress can be defined as:
    max(S1,abs(S3)) and should be stored with the appropiate sign, e.g. S1=100,S3=-70,SWP=100 & S1=100,S3=-170,SWP=170."

  • sxyz.mac

    John Crawford (Honeywell)

    It is often times nice to be able to get the stress at a specific location in space,whether a node is there or not. By some strange quirk of fate, I just happen to have a macro that does this. Here it is.

  • tchkplot.mac

    Sung-Chul Lee (Engineering Systems & Consulting, Inc.)

    Macro to create shell thickness plot into 8-color contour band by respecifying element color properties.

  • text_unix.mac

    John Swanson (SAS, Inc./ANSYS, Inc.)

    This macro launches a text editor and creates a file called "jobname.inp"in the current working directory.

  • thickplt.mac

    Bram Weisman (SBM-IMODCO)

    "Plots shell element thickness by utilizing surface pressures. I recommend plotting nodes with a contour or outline plot of pressure for best results. Element plot can also be used, but pressure colors will conflict with element colors."

  • thicplot.mac

    Bill Newland (Bell Helicopter)

    "This macro assigns pressures based on real constant thickness values of shell elements. The shell elements are then plotted with pressure contours having the same values as the thicknesses."
    "Select the desired shell elements to be plotted before running macro. After running macro, DO NOT SAVE. Exit without saving as erronious pressures will be applied to model."

  • thread.mac

    Ernst Hustedt (Air New Zealand Engineering)

    "For what it's worth, here is a macro I made some years ago ('94) for doing thread profiles for axisym analysis. Looking at it now, I am not sure if the UN thread option works correctly, I can't remember that I actually used it, but the ISO should be O.K. You can spin the profile along Don's helix."

  • togif.mac

    Charles Wong (Goodrich Corporation)

    "I have a macro that creates small high resolution GIF files for Windows only. It calls out a shareware program pvw32con.exe. GIF's are much smaller and higher quality than tiff or jpeg."

  • trim1.mac

    G.N.S. Prakash

    Macro entry for "APDL Guru" contest by PADT. "Here is the scenario. I have a number of straight lines in the XY plane. I would like a macro that does the following:
    Allows me to select any two lines, but only two.
    If the two lines intersect, they are both divided at the intersection point and the resulting four lines are connected such that they share a common keypoint at the intersection point.
    If the lines do not intersect, the first line is extended until it is tangent to the second line.
    The macro should be capable of handling the special case in which the second line needs to be extended in order for intersection to occur. If this case should occur, the macro should extend both lines to a common intersection point and then join the two lines together. However, if the second line does not require extension, then the macro should divide the second line at the intersection point and join the two pieces of the original second line together with the first line, which has been extended."

  • trim2.mac

    Vlad Suprunov

    Macro entry for "APDL Guru" contest by PADT. "Here is the scenario. I have a number of straight lines in the XY plane. I would like a macro that does the following:
    Allows me to select any two lines, but only two.
    If the two lines intersect, they are both divided at the intersection point and the resulting four lines are connected such that they share a common keypoint at the intersection point.
    If the lines do not intersect, the first line is extended until it is tangent to the second line.

    The macro should be capable of handling the special case in which the second line needs to be extended in order for intersection to occur. If this case should occur, the macro should extend both lines to a common intersection point and then join the two lines together. However, if the second line does not require extension, then the macro should divide the second line at the intersection point and join the two pieces of the original second line together with the first line, which has been extended."

  • trim3.mac

    Charles Wong

    Macro entry for "APDL Guru" contest by PADT. "Here is the scenario. I have a number of straight lines in the XY plane. I would like a macro that does the following:
    Allows me to select any two lines, but only two.
    If the two lines intersect, they are both divided at the intersection point and the resulting four lines are connected such that they share a common keypoint at the intersection point.
    If the lines do not intersect, the first line is extended until it is tangent to the second line.

    The macro should be capable of handling the special case in which the second line needs to be extended in order for intersection to occur. If this case should occur, the macro should extend both lines to a common intersection point and then join the two lines together. However, if the second line does not require extension, then the macro should divide the second line at the intersection point and join the two pieces of the original second line together with the first line, which has been extended."

  • trim4.mac

    Navaneeth Bashyam

    Macro entry for "APDL Guru" contest by PADT. "Here is the scenario. I have a number of straight lines in the XY plane. I would like a macro that does the following:
    Allows me to select any two lines, but only two.
    If the two lines intersect, they are both divided at the intersection point and the resulting four lines are connected such that they share a common keypoint at the intersection point.
    If the lines do not intersect, the first line is extended until it is tangent to the second line.

    The macro should be capable of handling the special case in which the second line needs to be extended in order for intersection to occur. If this case should occur, the macro should extend both lines to a common intersection point and then join the two lines together. However, if the second line does not require extension, then the macro should divide the second line at the intersection point and join the two pieces of the original second line together with the first line, which has been extended."

  • trim5.mac

    Rod Scholl & Jeff Strain (PADT)

    Macro entry for "APDL Guru" contest by PADT. "Here is the scenario. I have a number of straight lines in the XY plane. I would like a macro that does the following:
    Allows me to select any two lines, but only two.
    If the two lines intersect, they are both divided at the intersection point and the resulting four lines are connected such that they share a common keypoint at the intersection point.
    If the lines do not intersect, the first line is extended until it is tangent to the second line.

    The macro should be capable of handling the special case in which the second line needs to be extended in order for intersection to occur. If this case should occur, the macro should extend both lines to a common intersection point and then join the two lines together. However, if the second line does not require extension, then the macro should divide the second line at the intersection point and join the two pieces of the original second line together with the first line, which has been extended."

  • trq_msp.mac

    Bill Bulat (CSI)

    Used to calculate torque about global Z axis for 3D MSP analyses.

  • v2comet.mac

    Fern Thomassy (Southwest Research Institute)

    Creates a COMET/Acoustics results file of velocity results.

  • v2glue.mac

    Eric Miller (PADT)

    Work around for standard VGLUE that avoids the "ungluing" that can occur

  • v_by_2a.mac

    Michael W. Hiller (In2 Solutions, Inc.)

    Creates a volume by picking two opposed areas. From the author:
    "It was meant for the case where you have two opposite areas each area having 4 lines (4 keypoints). It will automate volume creation from 2 areas, or you can modify it as necessary. It includes logic to (try to) avoid unnecessary twisting (bowtie)."

  • varthk.mac

    (CAEAI)

    "This macro applies a varying shell thickness based on a given function."

  • vert.mac

    Rod Scholl (PADT)

    Generates a big long vertical line at specified location

  • vget_subs.mac

    Kiran Sreeram (GE Power Systems)

    "This macro stores the information requested by the user for a selected set of nodes or elements in an array called RESULT_COMP. This information can be any thing that is in the command *vget,for nodes & elements. The reason for this macro is that when using *vget the node or elem numbers must be sequential, in order to get any information. This macro deals with that i.e. by using *vmask, one can always do this manually, however this macro is helpful when needed to use regularly.

    This macro also creates a txt file for the requested information."

  • viewface.mac

    Tim Atchison (IDAC)

    "This ANSYS macro orientates your model to view a selected geometry face parallel to the screen. This is a must for analysts who regularly need to instantly orientate models to positions other than the standard views allowed. Simply click the face you want to view."

  • vlsm.mac

    John Crawford (Honeywell)

    I ended up writing a macro that selects/reselects/unselects meshed areas, and then copied it and modified it for doing the same with volumes.

  • vol.mac

    John Swanson (SAS, Inc./ANSYS, Inc.)

    Used to calculate total volume of selected elements.

  • volsatelem.mac

    Doug Scott (Honeywell)

    "This macro basically takes the selected elements (8-noded bricks), creates volumes at the elements, assigns the appropriate attributes to the volumes, and then deletes the selected elements."

  • vrange.mac

    Mitch Voehl (CEC Corporation)

    Macro which creates a mask vector for array values which fall between specified minimuim and maximum values. Will also return parameters containing the index location of the first and last array elements meeting the criteria, as well as the number of array elements which meet the criteria.