ansys.net search results
quick file search:
    home » search results
 
 
General Macros (106 entries)
 
A2COMET
  Fern Thomassy (Southwest Research Institute)
  Creates a COMET/Acoustics model from an ANSYS model.
[permalink]
 
Average Rating: 9.5 (41 votes)  
Rate this item:
 
ANGLEMOD
  John Crawford (Honeywell)
  From ANSYS Solutions article "Big Insights from Small Macros", Vol. 2 No. 1 pg. 27. Generates a cantilever beam to determine required elements per fillet for modeling studies
[permalink]
 
Average Rating: 10.0 (10 votes)  
Rate this item:
 
ANOL
  Bram Weisman (SBM-IMODCO)
  "I wrote some macros to simplify common annotation tasks. They let me place annotation on the screen n lines above the title. This eliminates picking and placement guesswork. Below is the one that places annotation on the left side. Initially, I only had one argument for the actual text (arg3). Then I realized that the /tlab command allows up to 60 characters, but currently only 32 get passed through as arguments to macros. So I added a second one (arg4).

"Generally for ANOL, I won't use the second argument (the character offset). If you use a zero for ARG1, your text will precisely overlay the /title and I believe this is independent of screen resolution, but might be dependent on certain other text settings.

"To get a feel for this, try issuing the following:
ANOL,4,,'This is four lines above title',''
ANOL,3,,'This is three lines above title',''
ANOL,2,,'This is two lines above title',''
ANOL,1,,'This is one lines above title',''

"Also try the following:
/title,This is the title
ANOL,0,,'This is the title',''

The two are perfectly overlaid on my system."

[permalink]
 
Average Rating: 10.0 (13 votes)  
Rate this item:
 
ANS2UNV
  Rogelio Perez (Schneider Electric Industries SAS)
  This macro creates an I-deas universal file (.unv) from ANSYS for SOLID45, SOLID92, and SOLID95. Based on ANS2PAT macro.
[permalink]
 
Average Rating: 10.0 (4 votes)  
Rate this item:
 
AnsBGA Utilities
  (AnsBGA)
  AnsBGA Utilities include the following:
  • AnsKBD - Hot Keys
    AnsKBD allows you to assign any key combinations, such as <F7>, <Control-n>, <Alt-F1>, <Control-Shift-t> etc. to your macros.
  • Realtime macEdit + Tail Utility.
    Yes it works on windows and all other platforms Just press <Alt-t> when the Ansys GUI is active to launch tail + real time macro editor.
  • AnsBGA enhanced ASK (1 Liner Multipro)
    This is a neat replacements for multipro and *ask commands. You can build multi prompts having 1 to 20+ inputs in just one line of code. This one command effectively replaces *ask and multipro commands. For example this one liner creates a prompt for three inputs.
    ~eui,'_ask "Your message here" "parm1=2, parm2=string, parm3" '
    where parm1, parm2, parm3 are three parameters having 2, 'string' and nothing as the default values.
  • GUI Configuration
    Just press the "Config Utility" button below for more information. Press <Control-Alt-S> to bring up this window.

Alternative download here.
[permalink]
 
Average Rating: 6.6 (22 votes)  
Rate this item:
 
AnsKeys HotKeys
  Carlos Shultz (PADT)
  "AnsKeys HotKeys is a Visual Basic program which will provide HotKeys for commonly issued commands and hide/unhide the ANSYS Process Status dialog box."
This is very useful to map Function keys (and Shift-Function or Ctrl-Function) for commonly-used commands. Hiding the Process Status is also available.
Although it is recommended to download the latest version from PADT's website above, there is an alternative download here.
To use this, after installation, launch AnsKeys. You can minimize the window, but the application must be running for your F1-F12 keys to work. Also, it will pop up the old-style Input Window if you are using the new (default) GUI.
[permalink]
 
No rating yet  
Rate this item:
 
ARPLOT
  (Unknown source)
  Annotates each area with its size (/AN3D)
[permalink]
 
Average Rating: 10.0 (2 votes)  
Rate this item:
 
ASK
  Navtej Singh (Intel)
  "You will be prompted with variable name and value in a single dialouge box.
Enter the variable name upto 32 chars long.
Enter the variable value upto 128 chars long. Value can be numeric or string. No need to enter quotes for string.
On clicking enter this script will set the variable name with the value in ANSYS properly either as a nummeric or string."

[permalink]
 
Average Rating: 8.6 (14 votes)  
Rate this item:
 
AVSUCD
  Ian Sigal (University of Toronto)
  "The macro writes an AVS UCD file that can be read by Amira. This allows quick display and post-processing. I use the macro to export a model formed of Solid92 tetrahedrals, but only the results in the four corners are written to the file. The macro also writes the element solutions, although these are not read by Amira, but are accepted in the AVS UCD standard."
[permalink]
 
Average Rating: 10.0 (4 votes)  
Rate this item:
 
BBLDIV
  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."
[permalink]
 
Average Rating: 6.0 (5 votes)  
Rate this item:
 
CLEAN
  Tom Glade (PACCAR Technical Center)
  "Here's a macro I use to clean up TYPEs, REALs, and MPs."
[permalink]
 
Average Rating: 9.4 (8 votes)  
Rate this item:
 
CMDIF
  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"

[permalink]
 
Average Rating: 9.3 (7 votes)  
Rate this item:
 
CMGET
  John Crawford (Honeywell)
  "A macro that retrieves the components saved using cmput.mac."
[permalink]
 
Average Rating: 10.0 (1 vote)  
Rate this item:
 
CMPUT
  John Crawford (Honeywell)
  "A macro that saves all the currently selected entities in components"
[permalink]
 
Average Rating: 10.0 (3 votes)  
Rate this item:
 
CMRESU
  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."
[permalink]
 
Average Rating: 10.0 (1 vote)  
Rate this item:
 
CMREVIEW
  Tom Glade (PACCAR Technical Center)
  Reviews defined components of a specific type (node, element, keypoint, line, area, or volume components).
[permalink]
 
Average Rating: 10.0 (1 vote)  
Rate this item:
 
CMSAVE
  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."
[permalink]
 
No rating yet  
Rate this item:
 
CNF_FREQRESP
  Rick Morgans (Adelaide University)
  Outputs velocities for a single frequency analysis in COMET/Acoustics from an ANSYS harmonic analysis.
[permalink]
 
Average Rating: 10.0 (5 votes)  
Rate this item:
 
COMPMENU
  Jim Patterson (Hendrickson Trailer Suspension Systems)
  "I have a set of macros to generate toolbars based on the defined components in the db. You can then call these toolbars from the main toolbar to aid in the selecting of the components. This includes "select", "also select", and "unselect". You can also "remake" the components from the toolbar. As someone who works with assemblies of shell models almost constantly, this has been a huge time saver for me."
Tested on 5.7 through 6.1. Unzip the file and read the supplied Word document for instructions.
[permalink]
 
Average Rating: 10.0 (6 votes)  
Rate this item:
 
CPQUERY
  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.
[permalink]
 
Average Rating: 9.4 (9 votes)  
Rate this item:
 
CUBIC
  Bob Weathers (Trane)
  Performs monotonic cubic interpolation in a table.
[permalink]
 
Average Rating: 5.0 (3 votes)  
Rate this item:
 
DEMOTLBR
  (PADT)
  "To use this demonstration of the ANSYS toolbar capabilities extract these files to your working directory. You must then copy the tlbrlist61.ans file from the ANSYS installation docu/english/tlbrlist61.ans to your working directory. Add DEMO.TLB to the bottom of the file. Run ANSYS and then move the split bar at the bottom up to show the bottom pane where the demo toolbar is embedded."
Example showing how to customize the ANSYS 6.1 Toolbar.
[permalink]
 
Average Rating: 10.0 (3 votes)  
Rate this item:
 
DGNR8
  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."
[permalink]
 
Average Rating: 10.0 (2 votes)  
Rate this item:
 
DISTKP2L
  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."
[permalink]
 
Average Rating: 10.0 (1 vote)  
Rate this item:
 
DYDXI
  Bob Weathers (Trane)
  Calculates first derivative at the ith entry in a table.
[permalink]
 
Average Rating: 10.0 (2 votes)  
Rate this item:
 
elastdata_Unix.zip
  Hursha Narayan (Robert Bosch Corporation)
  Macro for a fully automated procedure for calculating M-R coefficients from Test Data
"I have developed a macro that fully automates the importing of elastomer test data into ANSYS and calculate the Mooney-Rivlin coefficients. The macro uses Lagrange interpolation technique to calculate the stress data at equal intervals of strain. This can then be read into an array in ANSYS to evaluate the M-R coeffs. I'm sending you Windows and Unix version of the macro. The difference between the two versions are in the awk and script files that I use to manipulate data. The user needs to go through all the files just to change the directories where the files will be located and accessed. The files reformat(Unix) and reformat.csh(windows) should have rwx permissions. The reformat.csh used in windows can be converted to a batch file. Awk utility should be available under windows. The procedure expects Simple Tension, Planar Tension and Biaxial Extension data to be available."
Windows version can be downloaded here.
[permalink]
 
Average Rating: 6.2 (8 votes)  
Rate this item:
 
ELEM2PT
  S. Evans (University of New South Wales)
  "I made a quick n' dirty macro a while ago for finding the element centroid nearest to a point...it doesn't QUITE solve the problem, since adjacent elements differing greatly in size can screw things up. But here it is anyway...it's a brute-force job (I used it for a couple of thousand elements)."
[permalink]
 
Average Rating: 8.8 (4 votes)  
Rate this item:
 
ELGROUP
  John Crawford (Honeywell)
  "A macro which creates a file of esel commands for the currently selected elements. The macro will prompt the user for the name of the file which will be created. The default name is 'elgroup'."
[permalink]
 
No rating yet  
Rate this item:
 
ENSIGHT
  Renato N. Elias (Federal University of Rio de Janeiro)
  This macro can be used to export tetrahedral meshes to EnSight or ParaView. This macro writes out the mesh information to a file called "jobname.geo".
For use with EnSight, also download accompanying sample EnSight case file.
[permalink]
 
Average Rating: 10.0 (4 votes)  
Rate this item:
 
ERF
  Sheldon Imaoka (CSI)
  This macro creates a table called ERF with error function values.
[permalink]
 
Average Rating: 10.0 (2 votes)  
Rate this item:
 
FCLEAR
  Chris Kennedy (Think PEAK, Inc.)
  Fast /CLEAR of ANSYS database.
[permalink]
 
Average Rating: 10.0 (5 votes)  
Rate this item:
 
FFTDFT
  Juan Carlos Lancha (OHL, S.A.)
  From the author:
"These small APDL macros perform Fourier transforms (FFT and DFT) of discrete signals. This procedure decomposes a time domain signal into a sum of harmonic (frequency domain) signals. It’s a useful APDL tool when dealing with dynamic and harmonic problems in ANSYS."
[permalink]
 
Average Rating: 10.0 (13 votes)  
Rate this item:
 
FINS
  Mike Rife (CSI)
  This macro is used to create a long cylinder with a radial, helical fin
[permalink]
 
Average Rating: 8.8 (4 votes)  
Rate this item:
 
GETDIR
  Bob Weathers (Trane)
  Returns string with current working directory
[permalink]
 
Average Rating: 5.0 (1 vote)  
Rate this item:
 
GRPH2SVG
  Sheldon Imaoka (ANSYS, Inc.)
  This is a quick hack I did to generate SVG files from within ANSYS. There are 3 macros contained in the zip file: GRPH2SVG.MAC is the main one, and the other two are called by GRPH2SVG.

The macro redirects the plot to an ANSYS Graphics file "stiplot.grph". Then, the macro parses through the GRPH file and generates an SVG file called "stiplot.svg". You can change the font, font size, etc. as you see fit from within the macro. (For details on the contents of the GRPH file, refer to the ANSYS Programmer's Guide for details.)

Because this parses the GRPH file from within ANSYS, it is slow for complex plots, so I recommend using it only for XY plots — this is only meant to serve as an example of what can be done with APDL and reading the GRPH file contents. Also, I did not bother including support for raster graphics - this macro only supports vector graphics. (If you want raster graphics, use of PNG is better. SVG is really a vector graphics implementation.)

If you're running Firefox, or if you use Internet Explorer and have the Adobe SVG Viewer Plug-in, you can see a sample contour plot and sample XY plot generated from this macro.

Because this was created by hand, there may be mistakes - you can let me know if you encounter any. Otherwise, instead of using this macro, you can create an EPS file and use your favorite illustration software to convert it to an SVG file.
[permalink]
 
Average Rating: 10.0 (2 votes)  
Rate this item:
 
GSCONTOURS
  Darrel Hill (University of Saskatchewan)
  Macro (not CMAP file) to create grayscale contours.
"I coded this version only for the win32C (X11c) Graphics device. **Will not work at all with the default win32 (X11)**. Contours in contour plots should have 100 shades of grey with the default input. Parameters can be changed in the code to darken, lighten and/or make more/less shades of grey."
[permalink]
 
Average Rating: 10.0 (6 votes)  
Rate this item:
 
GUIRESET
  (ANSYS, Inc.)
  Sometimes, it is reported that the Picker does not respond at 7.1. This macro forces a reset of the picker such that it will work again. Also, it provides diagnostic information to send to ANSYS, Inc.

Use the attached macro as follows:
  1. In ANSYS GUI, issue "guireset" and execute the macro.
  2. Then when the picker box gets stuck issue "Ctrl-Shift-Delete".This should free up the picker.
  3. Ask user to send us the diagnostic information from the ANSYS output window such as below along with details of what he/she was doing when this problem occured:
    #### PLEASE REPORT THIS INFORMATION ####
    trace for EventType?
    {w {::namespace inscope ::euidl::graphicPicking resolveEventType}}
    IgnoreCancel value is 1
    PARAMETER _BUTTON = 0.000000
    TURN OFF WORKING PLANE DISPLAY

    #### THANK YOU, AND SORRY FOR THE INCONVENIENCE ####

[permalink]
 
Average Rating: 7.6 (48 votes)  
Rate this item:
 
HELIX
  Don Shaffer (Siemens Westinghouse Power Corp)
  "Here is a helix macro worked up from some xansys discussions several years ago. Several others on the list contributed parts of this."
[permalink]
 
Average Rating: 5.4 (12 votes)  
Rate this item:
 
HSAREA
  Sheldon Imaoka (ANSYS, Inc.)
  Macro to get 'hotspot' of selected areas. Puts (x,y,z) and area numbers in an array, which can be used for selection, etc. of areas via APDL.

Note that while the 'hotspot' of areas should be the centroid, the actual hotspot slightly differs from this. Consequently, no ASUM/GSUM is required, and that is why an undocumented *VGET is used for obtaining hotspot locations.
[permalink]
 
Average Rating: 9.0 (5 votes)  
Rate this item:
 
HSVOLU
  Sheldon Imaoka (ANSYS, Inc.)
  Macro to get 'hotspot' of selected volumes. Puts (x,y,z) and volume numbers in an array, which can be used for selection, etc. of volumes via APDL.

Note that while the 'hotspot' of volumes should be the centroid, the actual hotspot slightly differs from this. Consequently, no VSUM/GSUM is required, and that is why an undocumented *VGET is used for obtaining hotspot locations.
[permalink]
 
Average Rating: 10.0 (6 votes)  
Rate this item:
 
IGESOUT
  Gabriel Arias (IDAC)
  "Macro for generating solid bodies in IGES file format directly from finite element meshes (nodes and elements) in ANSYS"
Alternative link here
[permalink]
 
Average Rating: 10.0 (9 votes)  
Rate this item:
 
IM21
  (IDAC)
  IM21 is a general utility that is used to obtain maximum numbers of all entities, with the option to merge and/or compress entity numbers before. This is useful when creating entity generation macros that work on an existing model.
[permalink]
 
Average Rating: 5.0 (2 votes)  
Rate this item:
 
IM82
  (IDAC)
  "A macro that avoids the need for repetitive work when creating areas from many closed loops of Line geometry in ANSYS. This is particularly useful when the analyst has been supplied Line geometry containing many closed loops via CAD or has created closed loops that need to be converted to Areas for element meshing purposes."
[permalink]
 
Average Rating: 10.0 (1 vote)  
Rate this item:
 
importJPEG1
  Mark Tate (Hamilton Sundstrand)
  "Here is a Word Macro that I hacked together a while back that copies a group of graphic files into Word, two per page, with figure numbers. You can change the extension from jpg to png. It looks for files with a root name and add numbers to form the full name, i.e. root001.jpg, root002.jpg, etc."
[permalink]
 
Average Rating: 9.3 (7 votes)  
Rate this item:
 
importJPEG2
  Gary Betts (Metso Minerals Ltd)
  "Here is a macro for MS Word that will count and import all the jpegs in a defined folder into Word."
[permalink]
 
Average Rating: 8.3 (3 votes)  
Rate this item:
 
importPPT
  Mark Tate (Hamilton Sundstrand)
  A visual basic PowerPoint macro to import JPEG files into PowerPoint, one image per slide. Edit the file in a text editor to change variables or directory locations, etc.
[permalink]
 
Average Rating: 8.6 (7 votes)  
Rate this item:
 
JOBNAME
  Sheldon Imaoka (CSI)
  Gets jobname, title, subtitle and puts in arrays

[permalink]
 
Average Rating: 10.0 (3 votes)  
Rate this item:
 
JS_CURVEWRITE
  Jeff Strain (PADT)
  "A macro to write output PSD data at selected nodes with the number of selected nodes varying with each run. I did the "write a macro from a macro" thing and took advantage of two fairly recently added capabilities: C formatting in *VWRITE and string arrays, mainly for the 128 character capability.

"My macro creates a character array called p (I needed to conserve characters). The top row of the array starting at the second column contains selected node numbers. The second row starting at the second column contains GRMS values at each node. Starting in the third row, the first column is filled with frequency breakpoints; the second column over contains output PSD data for each of the selected nodes."

This can be used as an example of writing output to a file.
[permalink]
 
Average Rating: 10.0 (7 votes)  
Rate this item:
 
JWASEL
  Joe Woodward (PADT)
  This macro allows you to select the 'inside' surface of a volume, in case your volume has a 'void' inside of it.
[permalink]
 
Average Rating: 10.0 (4 votes)  
Rate this item:
 
KBFOCUS
  Eric Miller (PADT)
  "Below you will find a little macro that can be run to fix the more common issues with focus on the command line not behaving as expected at 6.1. It is a partial hack that needs to be run after the GUI is up, so you can't put it in your start61.ans file (sorry). It also does not fix focus loss with the picker (which is intentional) or the pan-zoom-rotate dialog (not so intentional). Those will require more than a simple Tcl/Tk script."
[permalink]
 
Average Rating: 5.0 (7 votes)  
Rate this item:
 
L_NLIST
  Chris Bridge (2H Offshore Engineering Ltd)
  A macro to list selected nodes but in a specified format without repeated header information.
[permalink]
 
Average Rating: 10.0 (5 votes)  
Rate this item:
 
LCOLOR
  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

[permalink]
 
Average Rating: 5.0 (4 votes)  
Rate this item:
 
Legend Example
  Bob Weathers (Trane)
  Example of customizing legend with annotations. See "Read Me" file for details, along with AVI animation.

"Essentially, I turn off the legend and write annotations into this area. It gives me considerable control over what appears there. I have also found that I can better communicate results to my customers by, say, having a legend that's reads 1.23 mils rather than 0.123E-02 inches or by referencing drawing and revision numbers, test results, material properties, and so on."
"You might need to change some of the character size and line spacing dimensions in the macros. Again, though, they work just fine for my hardware."
[permalink]
 
Average Rating: 10.0 (7 votes)  
Rate this item:
 
LISTCM
  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.
[permalink]
 
Average Rating: 10.0 (7 votes)  
Rate this item:
 
LISTTYPE
  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.
[permalink]
 
Average Rating: 10.0 (6 votes)  
Rate this item:
 
LSTDBDOC
  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.
[permalink]
 
Average Rating: -5.0 (1 vote)  
Rate this item:
 
M55TO54
  (ANSYS, Inc.)
  Converts 5.5 CDB file to 5.4 format (for backwards compatibility).
[permalink]
 
Average Rating: 10.0 (4 votes)  
Rate this item:
 
MAPME
  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.

Alternate macro also available here.
[permalink]
 
Average Rating: 10.0 (27 votes)  
Rate this item:
 
MATLAB
  Rick Morgans (Adelaide University)
  "On this subject, I've been meaning to post these for ages -> we've been using these macros to transfer variables between ansys and matlab for yonks. They write and read variables from ansys and matlab -> you can check them out to see how they do it (i.e. I cant remember off of the top of my head) -> I think they write out a format header then write the rest of the variable as a single column.

varread.m
read variable into matlab

varread.mac
read variable into ansys

varreadc.m
read 2 column ansys variable into matlab as a complex variable

varreadcp.m
read "packed" 2 column variable into matlab as complex variable

varreadp.m
read "packed" variable into matlab

varreadp.mac
read "packed" variable into ansys

varwrite.m
write a variable from matlab

varwrite.mac
write a variable from ansys

varwritep.mac
write a variable from ansys in "packed" format using a vmask"
[permalink]
 
Average Rating: 10.0 (16 votes)  
Rate this item:
 
MG
  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."
[permalink]
 
Average Rating: 10.0 (4 votes)  
Rate this item:
 
MK_MWRITE
  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").
[permalink]
 
No rating yet  
Rate this item:
 
MOR for ANSYS
  Jan G. Korvink (University of Freiburg) and Evgenii B. Rudnyi (CADFEM)
  MOR for ANSYS (formerly mor4ansys) is "Model Order Reduction for ANSYS", useful to speed up transient or harmonic analyses.
[permalink]
 
Average Rating: -5.8 (6 votes)  
Rate this item:
 
MWRITE
  Matt Sutton (PADT)
  Macro to write arrays to file. This macro actually uses Tcl/Tk to write another macro, which is then invoked.
[permalink]
 
Average Rating: 8.9 (9 votes)  
Rate this item:
 
NAS2ANS
  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.
[permalink]
 
Average Rating: 10.0 (13 votes)  
Rate this item:
 
NASTEXP
  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)"

[permalink]
 
Average Rating: 8.9 (9 votes)  
Rate this item:
 
NDGROUP2
  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.
[permalink]
 
Average Rating: 10.0 (2 votes)  
Rate this item:
 
P_DIRLBL
  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! :-)

[permalink]
 
Average Rating: 10.0 (2 votes)  
Rate this item:
 
P_PROTEC
  Chris Kennedy (Think PEAK, Inc.)
  Used as a "wrapper" for SAVE and RESUME in Toolbar, so one doesn't inadvertantly overwrite stuff in memory.
[permalink]
 
No rating yet  
Rate this item:
 
PLOT_TAG
  Mark Tate (Hamilton Sundstrand)
  This macro will tag your plots with directory and jobname.
[permalink]
 
No rating yet  
Rate this item:
 
Pressure Load Macro [ZIP]
  Sheldon Imaoka (ANSYS, Inc.)
  "In ANSYS, pressure loading via the SFx family of commands allows users to apply a force per unit area in a direction normal to the surface. Structural surface effect elements SURF153 and SURF154 extend pressure loading capabilities by allowing users to specify normal, tangential, or arbitrary distributed loading. In fact, for an arbitrary ‘distributed loading vector,’ the full or projected area may be used, with or without the tangential component of load. This type of loading can be useful in mimicking a bearing load (include tangential component) or wind loading (no tangential component), to name a couple of examples.
"Because of the fact that the vector-type of pressure loading can be based on full or projected area, with or without the tangential component, trying to determine an appropriate value for the loading can be cumbersome. The author has written a simple macro which can be used as an example in utilizing surface effects more effectively by allowing the user to specify the total force instead of pressure – the macro calculates the appropriate pressure value to be applied on the surface effect elements."

(Week 27, week of 07/04/04.)
[permalink]
 
Average Rating: 8.9 (18 votes)  
Rate this item:
 
Pressure Mapping Example
  Bob Weathers (Trane)
  An example which demonstrates mapping between dissimilar meshes and element types.

At the bottom of the macro is an example of how to apply the mapped results from the first model onto the second using a TABLe. The TABLe uses the second model's node numbers (sorted and stored in ascending order) to index into the TABLe. This results in a very efficient way to map boundary conditions that's fast and uses minimum memory.


[permalink]
 
Average Rating: 7.7 (11 votes)  
Rate this item:
 
QCLEAR
  Rod Scholl (PADT)
  Does a /CLEAR without prompting the user for an OK.
[permalink]
 
Average Rating: 10.0 (2 votes)  
Rate this item:
 
RANDSEED
  Stefan Reh (ANSYS, Inc.)
  "All random number generators are only pseudo-random number generators. They use what is called a "seed" value to calculate a random number. The result is only pseudo-random because with the same seed value you will always end up with the same "random" number. So whenever you start ANSYS it initializes the seed value. If you start generating random numbers then you will always get the same sequence of "random" numbers. The solution to this problem is to randomize the seed value itself using the system-time. Enclosed is the macro "randseed" that will exactly do that. You will get "real" random numbers after you run "randseed". You might want to run this macro every time before you start with your random number generation. You can also include the macro in your "start.ans" procedure so it will be executed each time you start ANSYS."
It effectively randomizes the seed by executing the RAND an arbitrary number of times.
[permalink]
 
Average Rating: 5.0 (8 votes)  
Rate this item:
 
REASSIGN
  Sheldon Imaoka (CSI)
  Example of reassigning matrix scratch files to another directory. For this example, I also differentiate between the platform type when specifying a scratch directory since Windows and UNIX file systems are assigned differently.
Requires jobname macro.

[permalink]
 
No rating yet  
Rate this item:
 
RENAM
  John Swanson (SAS, Inc./ANSYS, Inc.)
  Renames files in working directory. For example, using "renam,'tif',_1" renames all TIF files in working directory and adds prefix "_1". Useful to rename graphics files. (Note: At 5.6.1, the undocumented command /DIRGET which this macro uses does not work on Windows and will result in an abort.)
[permalink]
 
No rating yet  
Rate this item:
 
ROUND
  Gordon May (Rolls Royce Compressor Key System)
  Macro to round a parameter to a specified number of digits.
[permalink]
 
Average Rating: 10.0 (3 votes)  
Rate this item:
 
SASEL
  Sheldon Imaoka (ANSYS, Inc.)
  Macro used to select areas based on the value of the area itself (=length^2). Can be used to select all areas of a certain surface area or a range of surface area (with tolerance).
[permalink]
 
Average Rating: 10.0 (4 votes)  
Rate this item:
 
SELECT_HEXPYRA
  Sheldon Imaoka (ANSYS, Inc.)
  Simple example to unselect tetrahedral and wedge-shaped SOLID164 degenerate elements, leaving only hexahedral and pyramid SOLID164 selected.

While this macro has limited usefulness by itself, it can be used as an example of selecting certain element shapes by nodal connectivity - very useful if you have a single element type but multiple degenerate element shapes and want to differentiate between them in your model.
[permalink]
 
Average Rating: 10.0 (1 vote)  
Rate this item:
 
SELLOC
  Don Shaffer (Siemens Westinghouse Power Corp)
  "This is a utility tool to speed up selection of model entities by location." Please read the comments in the macro file for more details on usage.
[permalink]
 
Average Rating: -5.0 (4 votes)  
Rate this item:
 
SFMAP
  (CAEAI)
  "This macro is used to map pressure from a CFD mesh onto a structural mesh. The point XYZ locations from the CFD analysis must exist in an array called cfdxyz(npts,3). A corresponding array called "cfdpres" must be exist also. This array contains the pressure values corresponding to the point locations."
Useful example of the use of *MOPER,,,MAP.
[permalink]
 
Average Rating: 6.9 (16 votes)  
Rate this item:
 
SIRESUME
  Sheldon Imaoka (CSI)
  Use this for the RESUM_DB abbreviation in the Toolbar to prevent accidental resuming (which clears contents of current database). This macro will not prompt user for confirmation is database is blank. Otherwise, it will prompt user to verify that he/she wants to resume.
[permalink]
 
Average Rating: 10.0 (2 votes)  
Rate this item:
 
SLICEPLN
  Don Shaffer (Siemens Westinghouse Power Corp)
  "This macro moves the working plane origin to the specified keypoint and orients it with wz normal to the specified cartesian axis with x=1,y=2 and z=3."
[permalink]
 
No rating yet  
Rate this item:
 
SORT2D
  Ashok K. (EACoE, Bangalore)
  Ansys macro to sort a given numeric array (2d)

I usually get all the nodal coordinates into an array (call it NodeInfo) with node numbers in col 1; X,Y and Z coords in columns 2, 3 and 4 respectively.

Then lets say I want to sort by the Z- coord followed by the X-coord and then the Y-coord I call the macro

sort_by_cols, 'NodeInfo', 4,2,3

The tolerance is something which you may or may not need. Depends on your application. If you just want to compare upto full decimal accuracy leave the tolerance value at zero.


[permalink]
 
Average Rating: 6.2 (4 votes)  
Rate this item:
 
SORTED
  Gordon May (Rolls Royce Compressor Key System)
  Example of sorting arrays using *MOPER.
[permalink]
 
Average Rating: 6.0 (5 votes)  
Rate this item:
 
SORTEM
  Rick Fischer (Marconi Communications)
  Another similar example of sorting arrays using *MOPER.
[permalink]
 
Average Rating: 10.0 (2 votes)  
Rate this item:
 
SPIDER
  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."
[permalink]
 
Average Rating: 10.0 (8 votes)  
Rate this item:
 
STIICEMFLOTRAN
  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).
[permalink]
 
Average Rating: 10.0 (6 votes)  
Rate this item:
 
SVSEL
  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).
[permalink]
 
Average Rating: 5.0 (3 votes)  
Rate this item:
 
TCHKPLOT
  Sung-Chul Lee (Engineering Systems & Consulting, Inc.)
  Macro to create shell thickness plot into 8-color contour band by respecifying element color properties.
[permalink]
 
Average Rating: 10.0 (5 votes)  
Rate this item:
 
TEXT_UNIX
  John Swanson (SAS, Inc./ANSYS, Inc.)
  This macro launches a text editor and creates a file called "jobname.inp" in the current working directory. A similar macro for Windows is also available.
[permalink]
 
No rating yet  
Rate this item:
 
TextPad APDL Syntax File
  Bob Weathers (Trane)
  APDL Syntax definitions for use with TextPad on Windows. (Modified by Sheldon)
[permalink]
 
Average Rating: 10.0 (5 votes)  
Rate this item:
 
THICKPLT
  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."
[permalink]
 
Average Rating: 8.3 (3 votes)  
Rate this item:
 
THICPLOT
  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."

[permalink]
 
Average Rating: 10.0 (1 vote)  
Rate this item:
 
THREAD
  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."
[permalink]
 
Average Rating: 10.0 (2 votes)  
Rate this item:
 
TOGIF
  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."
[permalink]
 
Average Rating: 7.2 (9 votes)  
Rate this item:
 
V2COMET
  Fern Thomassy (Southwest Research Institute)
  Creates a COMET/Acoustics results file of velocity results.
[permalink]
 
Average Rating: 10.0 (1 vote)  
Rate this item:
 
VectorRotation
  Bob Weathers (Trane)
  "These macros rotate a matrix of vectors from one set of Euler angles to another. One macro creates the rotation matrix and a second does the rotation. To test the macros, a pressurized cylinder (or optionally a sphere) is built, meshed, and solved in 6 different coordinate systems. To check accuracy, results are rotated from one CSYS to another by the macros and then compared to ANSYS. Set your text editor's tab stops to 2 for macro readability."

In the zip file, "zTestRotationVector.mac" is the test model macro, and "zRotateVector.mac" is the main macro to rotate vectors.

Update 02/07/2009: correction to zRotateVector.mac provided by David Creech.


[permalink]
 
Average Rating: 5.7 (7 votes)  
Rate this item:
 
VGET_SUBS
  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."

[permalink]
 
Average Rating: 10.0 (14 votes)  
Rate this item:
 
VIEWFACE
  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."
[permalink]
 
Average Rating: 10.0 (5 votes)  
Rate this item:
 
VRANGE
  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.
[permalink]
 
Average Rating: 5.0 (1 vote)  
Rate this item:
 
VTHICK
  Rick Fischer (Marconi Communications)
  "This macro sets variable shell thickness based on thicknesses at corners of a surface. Only problem is that the attributes are being applied as a real constant. But, rthick creates r cards, one for each element, with real numbers the same as the argument. This could overwrite the reals used for the attributes, depending on how the model is numbered."
[permalink]
 
Average Rating: 10.0 (1 vote)  
Rate this item:
 
WRITEARR
  Carl Olsard (noiseboard.com)
  "One command that is severely lacking from ANSYS is a simple way to export a matrix to a file, so that it can be imported into MATLAB. This script writearr.mac should be used with the companion MATLAB script readansysarray.m to export a matrix from ANSYS and import the array into MATLAB. At the moment the script is written to export 2D arrays of MxN (don't need to specify the dimensions). The output file contains the data i,j,data(i,j) where i and j are the array indices. The usage of the macro is:
writearr,'array','filename','ext'"

Here is the companion MATLAB script:
READANSYSARRAY
"This is the second part of the script, which uses the file exported by writearr.mac. This matlab script will import the file, and reshape the matrix into the correct format. The function is used as follows:
1. load the file into MATLAB: load press.txt
2. convert the matrix into the correct format: press2=readansysarray(press);"

[permalink]
 
Average Rating: 9.7 (17 votes)  
Rate this item:
 
X_DEMO_VREAD
  Shen-Yeh Chen (Honeywell)
  "This macro will demonstrate how to read in a matrix ZREAD(ZNNODE,3) in one *VREAD command. The macro will get coordianates from the current model first, write them into the file x_demo_vread.tmp, and read the data from the file"
[permalink]
 
Average Rating: 7.5 (6 votes)  
Rate this item:
 
X_SHL2SLD
  Shen-Yeh Chen (Honeywell)
  "This macro will sweep the currently selected or assigned SHELL elements into SOLID elements."
[permalink]
 
Average Rating: 10.0 (11 votes)  
Rate this item:
 
xPSD
  (PADT)
  "One of the most important types of mechanical simulation is the prediction of a system’s behavior due to random vibration. Almost every type of machinery, from computer circuit cards to satellite sub-assemblies, undergoes some type of random vibration, and it is the job of the analyst to determine if the system can stand up to this loading. xPSD is a tool from PADT that allows a user to take the results of a standard modal analysis and conduct fast, flexible studies on the behavior of the structure under just such loading.
"xPSD uses the "large mass method" to capture the modal response of a system to random vibration, expressed in terms of a Power Spectral Density (PSD) input. The user can quickly specify many different PSD input curves and extract the response of the system. The goal of the tool is to provide a simple - but fast and accurate - way for users to carry out PSD analyses. In fact, on a typical model (300,000 DOFs, 200+ modes), nodal response and 1-sigma values can be calculated in a matter of just minutes."

Although it is recommended to download the latest version from PADT's website above, there is an alternative download here.
[permalink]
 
Average Rating: 9.4 (8 votes)  
Rate this item:
 
YZCURV
  Bill Bulat (OMM)
  "Here's something I used recently (NOT FULLY TESTED!!). Edit as needed to obtain curvature in other global planes (I wrote this to obtain curvature in global yz plane - a symmetry plane in a half symmetry model I recently created). Also reports the average radius of curvature if you're inclined to ignore the speed control bumps. My intention was to make this applicable to arbitrarily large deformations."
[permalink]
 
Average Rating: 8.8 (4 votes)  
Rate this item: