- Last modified: March 25th 1999 -

Programs, Macros and useful information

  • MedusaNT integration into existing unix installations Updated 25th March 1999

  • Plotting directly from the UI to the plotter (no need to run a plotting queue system) Updated 25th March 1999

  • Apply fits to a bearing housing or shaft Press , Transitional or Sliding fits from the RHP technical sheet

  • A set of parametric ballrace symbols Accurate for size.

  • A set of parametric keyway symbols Accurate for size. caters for shafts and bores up to 85mm diameter. Automatically draws the correct keyway chosen from the British Standard. Should be the same as the ISO standard.

  • An alternative dimensioning system for complex plates When designing prototype machinery we often find ourselves drawing large backplates with a lot of different types of holes and features scattered all over. In the past it has been common for a Draftsman to allocate a unique reference to each hole or feature and to give the actual size and position in the form of a separate table on the drawing. This method has been proved to be less confusing to the Artisan engaged in the ritual of realising the drawing in metal. The version given here is a recent conversion from an old and well tried tool we built for our Classic" installation into the brave new world of the " Graphic User Interface".

  • Parametric cap head screws Parametric cap head screws and BaCIS1 programs to deliver them to users. Originally done for Classic Medusa but adapted to make available in NG. Updated 8th Jan 98

  • Implementation of VMS style file saving -

  • The whys and wherefores of using PERL to compliment bacis1 in medusa


    Integrating NT Medusa into a unix installation

    Description of Cambridge Consultants Medusa installation

    Pre-requisites

    The necessary networking software must be in place to enable the NT machines to mount a unix file system
    At CCL we started off with "PCNFS" from Intergraph which needed to be installed on each of the PC needing access to the UNIX machines. This became quite expensive both in license costs and support effort so last year we converted to Samba, a free utility which runs on the UNIX machine and servers selected filing systems to the NT PCs. This is currently working extremely well and more information can be obtained from this web page

    WIndows explorer

    This is how the Explorer looks on my NT machine. The top level directory "mcad" located on our main server "odin" is mounted on the NT machine. as drive M: (this used to be T: and may be referred to as this in some of the information here). This directory contains all of the directories a user will need.
    Of the ones shown the "ccl_products" directory and the "license" directory are the most important to running Medusa on a mixed system. The "alpha", "sgi" and "nt" directories contain the Medusa installation and project for Digital Alpha, SIlicone Graphics and WindowsNT respectively.
    NOTE we no longer use the NT version files served from the UNIX machine as it can be quite slow on a busy network. I keep it there as I still have some people with old machines and insufficient disk space for a proper installation.
    NT based users can access their UNIX based files under the "people" directory (the top level users directory on the UNIX machine is "linked" into the "mcad" folder). The central drawing files are accessible the same way although we have a mature reliable central filing system for medusa that automated the opening and closing of sheets.

    A few simple rules:-

    Making the site specific "product" visible to the NT machines

    At our site our "product is called "ccl_products" and is located on the UNIX machine that has the main Medusa installation.  The /mcad partition of the machine is exported and mounted on the NT machines as drive T: using PC-NFS. The "product_list.dat file looks thus:-

    -- Product_list.dat (created by Medinstall)
    -- Date: Tues. 21-Jan-1997 14:55
    c:\medusa\medsys
    c:\medusa\med2d
    c:\medusa\medplot c:\medusa\medplot_winplot
    c:\medusa\medapi_demo
    m:\medusa\ccl_products\med2d
        This is the UNIX based product

    I have experimented with locating the Medusa system software on our main unix machine and this can work successfully. the only limitation I found was that the startup time for the Medusa application on the PC was increased. The medusa installation on the NT machine is very small (just 1Kb) as all that is needed is a startup batch file. The startup batch file I use looks thus:-

    rem c:\scripts\runmed.bat
    rem command to run medusaNG for NT from the Unix server
    rem Set environment variables here to import into Medusa
    rem Medusa setup files
    call m:\medusa\nt\medusa\projects\ccl2\login
    call m:\medusa\nt\medusa\projects\ccl2\m2d\command\medusa

    Making the uid files non operating system specific

    If the .icon: entry in the uid file has the name of the icon only (no file extension) AND both the .bmp and the .xpm versions of the icons are in the directory THEN the uid file will be compatible with both the NT and the UNIX versions of Medusa.

    NOTE

    When customising the menu definition .uid files and the icon .bmp files for the NT version of Medusa you don't have to use medconfig to recompile them (Or even delete the med2d.bic file). just Make the change, restart Medusa and the new version is current.


    Enable an NT installation to pickup its licence from a UNIX host

    The Medusa FlexLN license system can support all of the current platforms (with the possible exception of VMS - I never got it to work). To the best of my knowledge Medusa can be run on any unix or NT machine that PTC approve of and, providing the application can read a valid license on startup all will be well.
    My rather simplistic understanding of the mechanism is as follows:-
    Flexlm must be running on a UNIX machine and started up using a valid license located in a directory on the UNIX machine (the server). The same license file must be accessible from the calling machine (the client). I achieve this by mounting the server directory on the client machine. I have the license file in /mcad/medusa/license on the server. The /mcad directory contains all the medusa installation under the correct operating system name - /mcad/alpha/medusa... for the alpha machines, /mcad/sgi/medusa... for the skis and /mcad/Sun./medusa... for the suns
    The /mcad directory is mounted on all of the UNIX machines (SGIs and ALPHAs). there is a symbolic link in the top directory "/" on all the UNIX machines mapped thus for the alphas:-
    medusa -> /mcad/medusa/alpha
    thus for the SGIs:-
    medusa -> /mcad/medusa/sgi
    and thus for the suns:-
    medusa -> /mcad/medusa/sun
      1)  Mount the UNIX server Medusa directory as a drive on the NT machine (I have /mcad on the UNIX machine mounted as M: on the NT box)

      2) Make sure the DAEMON line in the license file looks thus:-
      DAEMON epd /medusa/license

      3) Modify the Medusa project login.bat file on the NT machine to create the system variable MEDUSA_LICENSE_PATH and LM_LICENSE_FILE these are both set to "M:\MEDUSA\license\epd.dat" at startup time thus simplifying the installation. There is now no need to modify the system variables.
      My project login.bat looks as follows:-
      @echo off
      rem C:\MEDUSA\PROJECTS\CCL2\LOGIN.BAT
      rem login to MEDUSA product environment
      set MEDUSA_MESSAGE_PATH=%HOMEDRIVE%\MEDUSA\PROJECTS\CCL2\MED\MESSAGE;%HOMEDRIVE%\MEDUSA\MEDSYS\MED\MESSAGE
      set MED_PATH=%HOMEDRIVE%\medusa\projects\ccl2\M2D\COMMAND;
      set MED_PATH=%MED_PATH%%HOMEDRIVE%\medusa\projects\ccl2\MDB\COMMAND;
      set MED_PATH=%MED_PATH%%HOMEDRIVE%\medusa\projects\ccl2\MED\COMMAND;
      set MED_PATH=%MED_PATH%%HOMEDRIVE%\medusa\projects\ccl2\MEDDOC\COMMAND;
      set MED_PATH=%MED_PATH%%HOMEDRIVE%\medusa\projects\ccl2\PLOT\COMMAND;
      set MED_PATH=%MED_PATH%%HOMEDRIVE%\medusa\projects\ccl2\TEST\COMMAND;
      set MED_PATH=%MED_PATH%M:\medusa\ccl_products\med2d\m2d\command;
      set MED_PATH=%MED_PATH%%HOMEDRIVE%\MEDUSA\MEDSYS\med\command;
      set MED_SHARE=%HOMEDRIVE%\MEDUSA\MEDSYS\MED\SHARE;
      PATH %MED_PATH%%MED_SHARE%%path%
      set MEDUSA_LICENSE_PATH=M:\MEDUSA\license\epd.dat
      set LM_LICENSE_FILE=M:\MEDUSA\license\epd.dat
      set MED_TEMP=c:\temp

      4)   To check that the license is visible Open a DOS session, run the project login.bat file to set up all the paths and environment variables. Type the following:- c:\medusa\medsys\med\license\testsecurity
      and you should get :-
      MED2D_DRAFT license obtained
      If that works you should be able to type "medusa" and Medusa should fire up


    To make the running of various DOS and Perl scripts on the NT machine easy and transparent to the users.

      Create a scripts directory on the C drive "C:\scripts" and put it in the path using the control panel/system utility
    On my machine I put it as the first non operating system item in the path so that scripts put in it get first priority even is there are scripts with the same name later in the path. You don't need to worry about Medusa system files as the Medusa login sets up the required path in front of the system path so Medusa always gets priority!


    Multi-version file saving

    Until December of 1996 Cambridge Consultants ran it's Classic Medusa system on Digital VAX workstations running VMS. One of the blessings of the VMS system is that, unlike UNIX, each time a file is saved a new version is created. The version of a file is represented by a semicolon (;) followed by a number for example 1.she;3 or 1.sym;3.
    Following our upgrade to UNIX and NT most of the users have lost files at some time or other and I have been under some pressure to try to implement some form of safety net to protect the user from the accidental overwriting of files.
    Another reason for attempting this is the use of such a system on Pro/Engineer (CCL's other CAD system). In the case of Pro/Engineer files are saved with a .(number) extension thus:- monster_part.prt.1 or complex_drawing.drg.2. PTC provide a tool to purge their files down to the latest single copy but we felt this was too draconian to use on a regular bacis so I have created a purge facility replicating the sort of facilities that the VMS purge gave (user input for the number of old versions to keep, outputting the result as it purges etc). Because this tool is created in PERL it is cross-platform compatible and able to work with any file extensions.

    The process I have running works as follows:-

    Saving an new version of the file

    Bacis1 button in custom tool tray save button
      Calling
    wrapper macro for the bacis1 programs ava.mac
      Running
    The Program that does the work put_multiple.prg
      and
    The Perl sorting program ensures that, regardless of how many version you create, the program copes without error

    Getting the latest version of the an existing file

    Bacis1 button in custom tool tray sheet open button
      Calling
    wrapper macro for the bacis1 programs geta.mac
      Running
    The Program that does the work get_multiple.prg
      and
    The Perl sorting program ensures that, regardless of how many version you have created, the program copes without error and always knows which is the latest version


    bearing.gifdim.gif

    Modify the dimension on a hole or shaft diameter to show the correct fit for a bearing


    When Dimensioning a shaft or housing bore that has to fit correctly to a ballrace, we found that most of the time a draftsman would guess the tolerance for the dimension. We had quite a number of problems with bearing assemblies that did not perform as well as expected due to inappropriate bearing fits (usually too loose). This set of programs and macros is based on the solution that we created for our "Classic" Medusa installation. Following the provision of this facility about 12 years ago we have had few problems with bearing fits.
    The only real difference between the code provided here and our previous "Classic" version is that the NG version takes an existing dimension and converts it to a toleranced, diameter type, dimension. Where as the previous "Classic" version started with the LCN seed line.
    There are 3 fits provided. Sliding fit, Transition fit, and press fit. The tolerances for each fit are selected automatically to suit the actual size of the shaft or housing.

    I have used the information from a fairly old version of the RHP catalogue that has stood me in good stead for many years. If local needs are different it is easy to make the changes to the data to allow a different set of tolerances to be applied.

    How it works

    This
    baCIS1 button added to the dimension tool tray calls brg_housing.mac the housing fit macro or brg_shaft.mac the shaft fit macro.
    These call brg_fits.mac which sets up the variables for the fits and then runs fit.prg to hold the users hand while the dimension to be modified is selected
    The program works by finding, undimensioning the selected dimension, noting its size and rebuilding it with the tolerances.

    caphead_para.gifcaphead.gif

    Parametric cap head screws

    This set of BaCIS1 macros, programs and parametric symbols deliver a cap head screw accurately drawn from the "Unbrako" catalogue. The thread lengths are selected from the catalogue and if a thread length that is non- standard is input the program will select the next standard size above. The thread lengths and the unthreaded portion of the shank are accurately drawn.
    If you use a different supplier with a different set of thread lengths you can edit the variable "lens" and "thd" to reflect these standards. The resulting symbol is a clump type set and is drawn in a single Sl0 line to make editing easy. There is a centre line as a separate sl2 line. shoulder.gif

    How it works

    The Macro
    screw.mac is called from the BaCIS1 button.
    This prompts the user for the type of screw ( standard cap head or cap head shoulder screw) and then calls the appropriate BaCIS1 program cap.prg or shoulder.prg
    The program uses a macro for each of the sizes that sets up the arguments for the parloa.
    The macro is selected by combining the users input with either an "m" or an "s" for example for an M6 shoulder screw the user inputs a "6" in response to the first question "Enter Thread Size >M". The macro for an M6 cap head would be m6.mac and would set up the appropriate variables for the program cap.prg to use in parloa'ing the symbol cap.sym and Shol.sym
    To get all the macros (M3 to M12 and s8 to s16) down load the zip file caphd.zip and place them in the appropriate folder

    NOTE

    I have provided the parametric symbols in Flattened sheet file form zipped into syms1.zip. You will need to recreate them and save them back into symbols.


    caphead_para.gifball2.gifball1.gif

    Parametric ballrace symbols


    We had a need for a set of ballrace symbols to speed up the drafting of bearing housings etc so I put these together. The sizes chosen represented the main sizes used at CCL and may need to be changed to suit local needs. The "type" input is the 4 digit "ISO" code.

    The sizes in the supplied table are as follows:-
    607,608,609, 6000 to 6010, 6200 to 6210, and 6300 to 6310.

    How it works

    The Macro
    ballrace.mac contains all the code. I have included the flattened sheet file Ball.txt containing the info to reconstitute the Medusa sheet enabling the symbols ball1.sym and ball2.sym to be saved

    The symbol gets its size information from the table included with it. If you want a different set of ballraces to better reflect the needs of your company, all you need to do is to edit this table and resave the symbol.
    I prefer the table method for inputting the data to the Parloa when there is a small range of simple geometry.

    On a Classic Medusa tablet menu the command we used for many years is as follows:-
    MEN 59 3 1 pre '@@e-@@[probe posn @@]@@k@@i parloa @@vproj$.symbols]'
    pos '@@e-redra'
    FIE 1 1 'ball1.sym @@n arg g = @@vprobu$ @@n arg type = @@[type @@]"@@k@@i" @@n cal'
    etc


    keyway.gifkey1.gifkey2.gif

    Parametric keyway symbols (shaft and hole)


    When drawing keyways it can be time consuming to have to look up the recommended size key, for a chosen diameter shaft or hole, in the appropriate standard. We found that the designers and draftsmen often guessed due to the pressure of time or the unavailability of the standard. When the correct sizes are used the resulting design is correct and defendable. The standard used for the data is British Standard 4325 Part 1 1972 - Metric Keys and Keyways. The standard is also in line with ISO Recommendations R 773.

    How it works

    All of the working code is contained in the BaCIS program
    keyway.prg.
    The program will prompt the user for a decision on "shaft" or "internal" keyway and also if the dimensions should be shown or not.
    To reconstitute the parametric symbol run the macro key_flat.txt. You should create 2 symbols. The first should be called "key1,sym and have the dimensions on layer 14. This will remove the dimensions before the symbol is loaded into the sheet. The second symbol "key2,sym" should have the dimensions that should be shown moved onto a different layer (I use layer 4 the default dimension layer).
    These dimensions will then appear on the drawing complete with the recommended tolerances as specified by the standard.


    ord.gif

    Dimensioning of holes in plates via a list of X Y coordinates

    When designing prototype machinery we often find ourselves drawing large complex backplates with a lot of different types of holes and features scattered all over them. In the past it has been common for a Draftsman to allocate a unique reference to each hole or feature and to give the actual size and position in the form of a separate table on the drawing. This method has been proved to be less confusing to the Artisan engaged in the ritual of realising the drawing in metal. The version given here is a recent conversion, from an old and well tried tool we built for our Classic" installation, into the brave new world of the " Graphic User Interface".

    How it works

    There are 2 programs that run.
    ord.prg that controls the placing of the identification code and the feature details onto the sheet and ord1.prg which scans that sheet, writes the text file containing the information and creates the table in symbol form for placing on the sheet. It is likely that these programs could be combined in to one program. The symbol that is placed on the sheet is a clump type "set" containing a clump type "ter" containing one prim type "hol" placed exactly on the datum position of the feature, one piece of text type "TSA" that holds the identification of the feature e.g. "A5", and one piece of text type "TSB" with it's height set to the minimum (in my case 0.01mm) containing the description of the feature e.g. "HOLE TAPPED M6 THROUGH". For easy manipulation I have grouped the 3 elements into a clump type "ter" this may not suit other installations.
    Because of the difficulty I have had with both unix, DOS,and VMS text file sorting routines I have used a "PERL" program to do the sorting of the text file prior to reading into the symbol. I am sure that there are other ways of achieving this type of "sort" and If any one has a bacis2 text file sort program I would be happy to make it available. If you are able to use the excellent PERL programming tools on your installation, the code for the sort program for the text file generated by the above program can be found here in a unix version .
    To see how to convert it into a DOS "bat" file see Mike Nelson's Perl page


    Automatic modification of existing dimension to apply British Standard (or ISO) limits and fits

    This is not available here yet

    At CCL we have been using this system for about 10 years with our Classic Medusa installation. The code has been modified to work in the NG environment and the main difference is that in the Classic environment the program started with the Medusa LCN seed line and then proceeded to calculate the tolerance and create the dimension. In the NG environment this method of dimension creation, although still available, is not the best way of working so I have rewritten the front end of the program so that an existing dimension is selected and processed. To use the program the fit is input e.g. H7 (for a hole) or h7 (for a shaft) and the program extracts the actual size of the dimension, looks up the appropriate set of limits for that fit at that size, them reconstitutes the dimension with the new information.

    Coming soon:-
    Classic version including the tablet menu entries.

    and

    NG version (really a "modified for NG" classic version)

    NOTE

    This is not a replacement for the CV Mechdes product and does not have the slick functionality of that product. This is aimed at either existing Classic sites or sites where the cost of sufficient licenses for Mechdes are hard to justify.


    Contributed by Don Cole - Australian Arrow Pty. Ltd.

    I don't know if anyone else has hassles with Medusa loops - but this little trick can help simplify your code. Sure, there are other ways around this situation, but this one keeps the bacis1 code simple.

    Try running the following program.......

    200 LET X = 0
    300 LET X = (X + 1)
      IF (X .LT. 100) THEN
        WRITE 'X=@vX'
        GOTO 300
      ELSE
        WRITE 'Made it!'
      ENDIF
      ENDRUN

    After about 48 iterations the program will crash with the following message **** Superstructure nesting too deep ****
    Now try it with a small modification on line 1 and 5

    100 LET NDF = 'ENDIF'
    200 LET X = 0
    300 LET X = (X + 1)
      IF (X .LT. 100) THEN
        WRITE 'X=@vX'
        XQT NDF
        GOTO 300
      ELSE
        WRITE 'Made it!'
      ENDIF
      ENDRUN

    We have tricked medusa into thinking it is processing an ENDIF within the IF block - even though it never really gets to the true ENDIF statement. If the guts of the IF block are not executed, Medusa never evaluates the variable called NDF so it doesn't see the hidden ENDIF command. It's simple and it works perfectly in every situation that we have encountered. Also, we initialise our NDF variable (which could be any other valid variable name) inside our medstart.mac file. That way we can use XQT NDF from anywhere.


    Cambridge Consultants Medusa installation

    Computers used for running Medusa at CCL

    • Silicon Graphics Indigo 2 running IRIX 5.3
    • Silicon Graphics O2 running IRIX 5.3
    • Digital Alpha 500/333 running Digital Unix V4.0a
    • Digital Personal Workstation Intel P200 running NT 4 (service pack3) and NT 3.51
    • Intergraph TD30 Intel P133 running NT 4 (service pack3)
    All of the Medusa UNIX installation is located on one of the SGI's (Called ODIN)in a /mcad partition

    Go back to Mike Nelsons CAD Page

    This site is created and maintained by Mike Nelson for his own pleasure

    © 1997 mike.nelson@camcon.co.uk