Macros

  • bbldiv.mac

    Bill Bulat (OMM)

    From the author:
    "I whipped up the following simple macro (I call it bbldiv.mac) to help assign divisions to predefined lines when you don't know their direction, but you do know their end keypoints. Useful for bottom-up modeling with input scripts."

  • beaforce.mac

    Juha Tyllinen (KONE Corporation)

    Macro applies pressure distribution for approximation of bearing force. See contents of macro for details.

  • beamnet.mac

    Artem Kulachenko (Mid Sweden University)

    Adds beam elements on outer edges of shell elements. From the author:
    Attached please find a macro that creates a net of beam/link elements on 4/3 node shells.

    An example of its use:
    /prep7
    et,1,41
    rect,0,1,0,1
    amesh,1
    et,2,4
    beamnet,41,2

  • beampres.mac

    Bram Weisman (Alan C. McClure Associates, Inc.)

    Applies linearly varying pressure on beams.

  • bearing.mac

    Mark Kessler (BAE Systems)

    "Applies a bearing load using discreet forces. Written primarily to apply a bearing load to a model that has been tet meshed where using a pressure gradient would require rebuilding the model."

  • bilinear.mac

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

    Used when specifying a material which has different tensile and compressive moduli. A test input file is also available.

  • bode01.mac

    Bill Bulat (CSI)

    Macro produces a bode plot using 2 predefined variables in /post26.

  • cbc_rmp5.mac

    Bill Bulat (CSI)

    Macro for defining a cubic ramp for use w/ ANSYS/LS-Dyna for performing quasi-static explicit analyses.

  • checkiges.mac

    Julián Díaz (ITR México)

    "This is a very simple macro, but I've found it very useful when I have an iges file with common errors of duplicate geometry and small lines. All it does is look for lines smaller that .1 inches and plots them along with the attached areas, this can be useful to have a glipse of where could the problems be."

  • clean.mac

    Tom Glade (PACCAR Technical Center)

    "Here's a macro I use to clean up TYPEs, REALs, and MPs."

  • clean_model.mac

    René Fiege (Meyer Werft GmbH)

    "The macro deletes not used attributes (real, mat, type, section), similar to the clean macro from Tom Glade, but with vector operations. It can easily be enlarged to document the used attributes (see macro).
    "Do not use the macro with referencing attributes, like tapered beams. All attributes, which are not an attribute of an element will be deleted."

  • closeline.mac

    Ernst Hustedt (Air New Zealand Engineering)

    The macro selects those lines that surround a picked point, or those lines that are exterior, depending on the case. Try the attached igs file and pick completely outside, inside but close to an outer line, inside outer loop but close to an inner line etc. and see what happens."

    "Extending it to 3-D should be possible by starting with the WP aligned with the screen csys or so."

  • cmdif.mac

    Eric Miller (PADT)

    "ANSYS has a *get,,common command that lets you grab things from memory. The only problem with this is that you can't just give the *get the name of the block, you need to tell it its position (count) in the block. As an example, the 3rd value listed in a common block is at position 3 (or index 3).

    The way you use a common block is you look in the ansys/custom/include directory for the value you want to know.
    In this case I did a search for a file that contained "/cplane"and found it in d3com.inc.
    Looking in the file I found that the value kycpln is what I was looking for and the common block was /d3com/
    Sometimes you can just count to find out what the index is, but this block is huge and has arrays in it. So instead, I used the macro below.

    I did:

    /cplane,0
    cmndif,0,'d3com',0
    /cplane,1
    cmndif,1,'d3com',0

    And the macro wrote:

    Found: 91 0 1.

    So I would then do: *GET,_cpstat,COMMON,,D3COM,,int,91 to retrieve the value.

    Another example would be if I wanted to know what the global minimum and max number of divisions per line was (DESIZE):

    desize,10,11
    cmndif,0,'cfprp7',0
    desize,20,21
    cmndif,1,'cfprp7',0

    Yields:
    Found: 99 10 20.
    Found: 100 11 21.

    For this I would use:
    *get,_mnlnsz,common,,cfprp7,,int,99
    *get,_mxlnsz,common,,cfprp7,,int,100"

  • cmf.mac

    Ernst Hustedt (Air New Zealand Engineering)

    Make a compound fillet at two straight lines.

  • cmget.mac

    John Crawford (Honeywell)

    "A macro that retrieves the components saved using cmput.mac."

  • cmput.mac

    John Crawford (Honeywell)

    "A macro that saves all the currently selected entities in components"

  • cmresu.mac

    Juha Tyllinen (KONE Corporation)

    "Here is a fully vectorized version where you can select the entity type you are saving. The saved component (well, select status) is stored as file with 'cmp' extension and includes two header lines: entity type and number of selected entities. CMSave saves the status and CMResu resumes it from the file."

  • cmreview.mac

    Tom Glade (PACCAR Technical Center)

    Reviews defined components of a specific type (node, element, keypoint, line, area, or volume components).

  • cmsave.mac

    Juha Tyllinen (KONE Corporation)

    "Here is a fully vectorized version where you can select the entity type you are saving. The saved component (well, select status) is stored as file with 'cmp' extension and includes two header lines: entity type and number of selected entities. CMSave saves the status and CMResu resumes it from the file."

  • cnf_freqresp.mac

    Rick Morgans (Adelaide University)

    Outputs velocities for a single frequency analysis in COMET/Acoustics from an ANSYS harmonic analysis.

  • cnvg_time.mac

    Mitch Voehl (CEC Corp)

    Macro to get last converged substep.

  • coil_emf.mac

    Bill Bulat (CSI)

    Used to report per-turn EMF induced in predefined closed loop paths.

  • compten.mac

    Carl Ostervig (Tech Inno)

    This macro analysis iteratively structures with different material properties (Youngs modulus) in tension and compression. [STI: Please note that this macro looks at SX and SY. See BILINEAR macro for a more general compression/tension macro based on principal stresses.]

  • conts2s.mac

    G. N. S. Prakash

    "'conts2s.mac' macro creates surface to surface contact elements between nodal components with the default options. Only nodal components(target & contact), material number and coefficient of friction can be given as arguments. Use Contact wizard or your custom code to modify other properties. This macro is helpful when number of components in Ansys models are large or sometimes when the Contact wizard becomes slow with large db files and if we need to create a lot of contact pairs."

  • coupcoin.mac

    Alex Komissarov (GEAE)

    A macro used to couple DOF of nodes in a given cylindrical coordinate system within a specified tolerance.

  • couple_dof.mac

    Jyotis Sardar (IIT MADRAS)

    "Here's a macro I created, that will generate couples in the required DOF's, merely by prompting the user to pick the source and target lines."

  • cpjoins.mac

    Mark Kessler (BAE Systems)

    "A macro to create couples at coincident locations."

  • cpquery.mac

    Sheldon Imaoka (ANSYS, Inc.)

    This macro counts the number of coupled sets associated with the current selected set of nodes.

    If the first argument is 1, then the macro will count the total number of coupled sets if any of its nodes are selected. Otherwise, the coupled set will only be counted if all of its nodes are selected.

  • ctpipe3.mac

    Mark Kessler (BAE Systems)

    "A macro to create a series of elements from one picked node to all other selected nodes."

  • cubic.mac

    Bob Weathers (Trane)

    Performs monotonic cubic interpolation in a table.

  • cvctrl.mac

    Chris Kennedy (Think PEAK, Inc.)

    Prompts for yield stress of material and uses it to set up /CVAL command so that post-processing plots will show elements that exceed the YIELD stress value as red, and elements which have a compressive stress lower than -YIELD as blue. If the minimum stress is not less than -YIELD than the actual minimum is used instead of -YIELD.

  • cycgen.mac

    cycgen.mac

  • dcontour.mac

    Doug Woolridge (Mercury Marine)

    Creates a second contour using 2D annotation under the original color contour. The values on the new contour are scaled by 'scale_factor'.

    A modified macro DCONTOU2 by Vincent Raillard changes this to have 2 - 9 uniform contours.

  • dgnr8.mac

    Eric Miller (PADT)

    "Finds degenerate 2D and 3D elements (i.e., when nodes 3 and 4 are identical), selects them, and then plots them. This works for many cases, such as SOLID45 or PLANE82, etc. Does not work for lower- or higher-order pyramids, but macro can easily be modified for these cases."

  • distcalc.mac

    Carl Ostervig (Tech Inno)

    This macro calculates the distance between two nodes, selected by picking. Normally this facility is available in the preprocessor only. This macro works in all processors.

  • distkp2l.mac

    Wangming Lu (Impact Technologies, LLC)

    "I have developed the following macro: Given a key point level component,and a line number, it will evaluate the distance from each key point in this component to the input line. The result is returned in an array called distk (you can change into your name, of course). While using this, pls. be careful, it is not fully tested yet."

  • distload.mac

    Nick Veikos (CAEAI), modified by Jim Kosloski (CAEAI)

    Attached is a macro for applying surface loads. You have to create a file with your own equation defining the load distribution as a function of x,y,z coordinates. You can use any equation possible with ADPL commands.

  • dnsol_view.mac

    Adam Shinbrot (Spine-Tech Inc.)

    "GLOBAL INFO: This macro is basically just a couple of routines that use dnsol to align two nodes (arg1 and arg2) on the theoretically fixed body, and adjusts the rest of the nodal results accordingly.
    I needed to do this with a multi-body model where I wanted to look at the motion of one body relative to another with the motion of the first body subtracted from the global result."
    Example input file can be downloaded here.

  • ds_JPDL___User_Fatigue_PNEN13445-3.js

    Przemyslaw Siedlaczek (MESco)

    Workbench macro solves fatigue according to pressure vessel code PN EN 13445-3 and displays results as a User Defined Result.

  • ds_MESCO_ContFrictVsTemp_APLD.js

    Przemyslaw Siedlaczek (MESco)

    Workbench macro adds APDL code to the contact branches to define temperature-dependent coefficient of friction.