Macros
-
Don Shaffer (Siemens Westinghouse Power Corp)
"Macro moves keypoint arg1 to the location of keypoint arg2 and if arg3 equals 1 merges them."
-
Chris Bridge (2H Offshore Engineering Ltd)
A macro to list selected nodes but in a specified format without repeated header information.
-
Jimmy Carlsson (AF Group)
This macro colors lines as follows:
Red: Line connected only to one of selected areas
Yellow: Line connected to two of the selected areas
Blue: Line connected to three or more selected areas
Magenta: Line is not connected to any of the selected areas -
Sheldon Imaoka (ANSYS, Inc.)
Macro used to list all unique combinations of element type, real constant, section type, and material properties of currently selected elements. Useful, for example, when importing mesh from Workbench or other software into ANSYS and confirming settings.
-
Sheldon Imaoka (ANSYS, Inc.)
At 7.0, the CMLIST command only lists selected components rather than all existing components in the database (pre-7.0 behavior). This macro provides a listing of all components in the database, regardless of their selection status. May be useful to get pre-7.0 behavior of CMLIST
-
John Crawford (Honeywell)
Here is a macro I wrote several years ago that projects lines onto the working plane. It's a little crude, but works okay. I use it all the time to project IGES geometry onto the working plane (placed at global Z=0) to straighten lines that are slightly bent or not at Z=0. You still have to recreate your areas and all that sort of stuff, which is kind of a pain.
-
John Crawford (Honeywell)
Recreates selected lines by fitting b-splines through points on line. Useful with some imported IGES geometry
-
Chris Kennedy (Think PEAK, Inc.)
This macro finds all :LBL constructs in the database. A :LBL can be any valid Ansys characters following a colon ":". Therefore you can have different labels for different aspects of your model, such as :MAT for material info, :REAL for real constant information, :INFO for general notes about the analysis, etc. Labels can be repeated.
-
(ANSYS, Inc.)
Converts 5.5 CDB file to 5.4 format (for backwards compatibility).
-
John Crawford (Honeywell)
Recreates selected lines by fitting b-splines through points on line. Useful with some imported IGES geometry
-
Sheldon Imaoka (ANSYS, Inc.)
General macro used to map one set of values & (x,y,z) coordinates to another. Uses *MOPER,,,MAP.
Example input file can be found here which uses this macro. In this input example, *VPUT is used to compare mapping UX, UY, and UZ from one mesh to another. This can be used to map pressures, heat flux, convection, etc. from CFD codes to ANSYS, for example.
-
Bill Bulat (CSI)
Calculates accurate mass properties via inertial relief method.
-
Joe Metrisin (Florida Turbine Technologies, Inc.)
"Here is a macro to calculate the mass average temperature of the selected elements."
-
John Crawford (Honeywell)
Zooms in, out or autoscales images then does a replot
"When I want to zoom in by a factor of two I enter MG,2. If I want to zoom out I enter something like MG,.1. If I want to autoscale I just enter MG. It replots the last display, which is usually what I want to do anyway." -
Peter Budgell (Innovative Steam Technologies)
From Analysis Solutions article "MIDSTRES: An ANSYS macro to aid mid-plane shell stress and load flow evaluation", Vol. 2 Issue 4 pg. 14. Useful for postprocessing shells, modifies results such that mid-plane stresses (or load/length) is copied to shell exterior. Used with PowerGraphics averaging/noaveraging.
-
Larry Bryant
"I have attached a script to compute a Miners Rule summation of structural results from three different data bases.
It is not general for any case, however, one can see the logic and apply this to their specific case as required.
I also have a simple script here that can be used to dump out a table of results for an independent check of your results."
-
Matt Sutton (PADT, Inc.)
This is a macro to write out arrays of user-specified width. Usually, when writing a macro, one has to specify the format of *MWRITE beforehand. This is a technique of a macro writing a macro for formatting purposes.
The history of this is from XANSYS on the following post (search for "mk_mwrite").
-
Mark Krueger (Goodrich Corporation)
"Macro to connect a single node by a 'web' of beams using an area"
Be sure that you have defined the beam element type and made it active (TYPE, REAL/SECNUM, MAT) prior to using this macro. -
Sheldon Imaoka (CSI)
Plots four modes on screen and annotates plots
-
Ted Harris (PADT)
Creates MPC184 elements between a master node and the other selected nodes. Can be modified for other 2-node line element types. Example of the use of *VMASK.
-
(CAEAI)
Macro to scale linear material property and put into new material number.
-
Bob Weathers (Trane)
Selects meshed volumes.
-
Sean Harvey (CSI)
Macro that facilitates importing multiple parts using the Connection product for Pro/E at 5.5.x. Note that from 5.6.1, importing of Pro/E assembly is supported (it is a beta feature in 5.6.0)
-
Sean Harvey (CSI)
Macro that facilitates importing multiple part iges files into ANSYS at 5.5.x
-
Alex Ng (ASM Assembly Automation Ltd.)
Calculates total mass of selected volumes.
-
Matt Sutton (PADT)
Macro to write arrays to file. This macro actually uses Tcl/Tk to write another macro, which is then invoked.
-
Peter Budgell (Innovative Steam Technologies)
A quick and dirty animation of rotation
-
Peter Budgell (Innovative Steam Technologies)
The following simple animation macro has worked for me with user-set contour level values. The user indicates the time delay for each frame, and the number of substeps to plot.
-
(ANSYS, Inc.)
In Design Simulation 8.0, Named Selections can be imported from Pro/E. However, only one surface is given a name...
"Attribute transfer from Pro/E is particularly limited since each entity within a part needs to have a unique name. That means that our processing for named selections becomes particularly ineffective since we group entities of like name (exact match only) for named selections. These same attributes can be imported as general attributes and then "grouped" by a different paradigm with the use of the script attached.
Here the expectation is that user would create a common naming structure (beginning with NS, though this could be modified with a simple script change) for the entities that would belong to a named selection and make them unique based on a "_N" suffix. N here is meant to be some counting number though it could be any unique string."
-
(ANSYS, Inc.)
Macro to change all contact regions in Workbench to names of its contact parts.
-
Diego Gorriz (Skycross Engineers)
Example of a macro to convert Nastran input to ANSYS input. Works on shells only, so it should be used as an example.
-
Barry O'Donnell (ODCS Ltd.)
"The macro uses logic (primariliy extracted from a previously published macro) to identify the unique combinations of ETYPE, REAL and MAT for non-section based elements and ETYPE, SECTYPE and MAT for secrion based elements. It then gathers the relevant data into arrays (primarily vector based arrays), and outputs the following NASTRAN cards:
CONM2 (mass21 element)
PSHELL (based on real data only, i.e. shell63)
CTRIA3 (shell63 degenerate elements recognised)
CQUAD4 (shell63 elements)
PBAR (beam4 element or beam188 element, A/Iyy/Izz supported)
CBAR (beam4 element or beam188 element, orientation node exported if it exists and default vector of <0 1 0> exported otherwise)
CELAS2 (combin14, spring option, linear 2 node version only)
PROD (link180 element, A supported)
CROD (link180 element)
PSOLID (solid element property definition card, fully supported)
CHEXA (solid 185 and solid 45 fully supported, solid 186 & solid 95 not working correctly)
CPENTA (solid 185/45/186/95 fully supported, degenerate elements recognised)
CTETRA (solid 185/45/186/95 & solid 186 & 95 fully supported)
GRID (nodal coordinates, note: nodal csys = 0) MAT1 (E, nu, dens supported - non temp dependent, initial value supported only)" -
John Crawford (Honeywell)
From the author:
"ndgroup.mac a macro which creates a macro of nsel commands for the currently selected nodes. this group of nodes can be recovered by running the macro that this macro creates.
The macro will prompt the user for the name of the file which will be created. The default name is 'ndgrp1.mac'.
You might check the implementation of *ASK to see if it works okay. I think they changed the way *ASK uses character parameters a few revisions ago and I may not have updated this macro. There is a chance that it will always create a file named "fname.mac" regardless of the name you entered at the *ASK prompt." -
Joe Woodward (PADT)
"A macro which creates a macro of nsel commands for the currently selected nodes. this group of nodes can be recovered by running the macro that this macro creates. The macro will prompt the user for the name of the file which will be created. The default name is 'ndgroup.mac'."
Original macro by John Crawford, vectorized by Joe Woodward. -
John Crawford (Honeywell)
"A macro that removes the selected nodes that are mistakenly associated with nonexistent geometry in ANSYS."
-
(EMI)
This is an ANSYS macro to move an existing node to the location of an existing keypoint. User picks single node to be moved, then picks single keypoint to move it to.
-
John Crawford (Honeywell)
A macro that toggles ID numbers off and on for keypoints, lines, areas, volumes, nodes, and elements.
-
Przemyslaw Siedlaczek (MESco)
Macro to plot material properties as temperatures. (Note that this macro will apply boundary conditions to your model, so save your model first prior to using this macro.)
-
Chris Kennedy (Think PEAK, Inc.)
From the author:
You can use the attached macro. This is supplied without warranty, etc.
It places the directory, date, time, hostname at the top of the graphics window.... There are additional args that can also extract and post the jobname. Read the macro (at least the top of it.)
P_LOGO2 is a macro that places my company logo on the screen. You can remove that command.... unless you want it! :-) -
Chris Kennedy (Think PEAK, Inc.)
A special version of NLIST to list nodes in the active coordinate system.