The purpose of this document is to answer some of the frequently asked questions regarding EdG.
- Is there a way to fix a file that is giving me problems in MicroStation (for example, cannot snap to an element)?
- Where is EdG located?
- How do I run EdG?
- How do I stop EdG?
- Which commands can I use safely on all files?
- How do I repair element range errors?
- How do I repair/replace a missing design file header?
- What is a recursive nested cell and how do I repair it?
- How do I repair an End of File Missing error?
- How can I undelete elements in a file that were accidentally deleted in MicroStation?
- Is there a way to run a sequence of commands on every design file you open without needing to type them manually?
- I have an entire server of files that I want to check for corruption or edit en masse. Can EdG be run in batch mode?
- How do I keep track of the commands I used to repair a file?
- How can I see a list of the elements that are contained in my file?
- How can I see all available information on any given element?
- What are some of the common searches in EdG?
- My file contains locked elements. How can I unlock them?
- Can I remove attribute linkages from elements?
- Can I search for text and modify it using EdG?
- Can I compress a design file using EdG?
- Can I change element types using EdG?
- What are the element types and the numbers associated to them?
- Does EdG run on all types/versions of MicroStation files?
- I am unable to run EdG on my computer. I receive memory/application errors.
- I am unable to run EdGbatch on my computer. I receive the following error: "The name specified is not recognized as an internal or external command, operable program or batch file."
- EdG crashes when I run any commands on a file. Why?
- How do I find out more about EdG?
Question 1: Is there a way to fix a file that is giving me problems in MicroStation (for example, cannot snap to an element)?
Answer: Yes, you can use MicroStation's EdG (Edit Graphics) utility, which allows you to display, search and modify a design file or cell library in a non-graphical command line environment. There are several types of file problems that are easy to repair with EdG.
Answer: In MicroStation/J, EdG is installed in the \Bentley\program\EdG directory. In versions prior to MicroStation/J, EdG is installed in the \USTATION\EDG\ directory.
Back to Index
Answer: Before you modify a design file or cell library with EdG, it is strongly recommended that you make a backup copy of the file. There is no undo buffer in EdG.
To start EdG from the command line prompt:
- Move to the ..\Bentley\program\EdG directory (...\USTATION\EDG\ directory using MicroStation SE or earlier)
- Type:
EdG <filename>
Where <filename> is the name of the design file or cell library and the full path specification for that file. If the design file or cell library is not specified with a full path, EdG searches for the file in the directory assigned to the MS_DEF environment variable.
When EdG starts, it displays element data for the first element in the file, followed by the EdG> prompt. The first element is always the type 9 header element and should look like:
EDIT GRAPHICS -- Version nnn
2d Design file <dgn_file.dgn>
1 (9) FILE HEADER Level = 8
EdG>
When an element is displayed, its element sequence number appears in the leftmost column of the display. EdG reads and manipulates elements using element sequence numbers. Each element is assigned a number. EdG commands are entered at the EdG> prompt. When entering a command, it is only necessary to enter enough characters to uniquely specify the command (for example, repair can be invoked with r).
Answer: <Control-C> will stop an operation in progress. However, the operation may not stop immediately, but will stop once it reaches the next logical beak point. To exit EdG from the EdG> prompt simply type EXIT.
Back to Index
Question 5: Which commands can I use safely on all files?
Answer: There is a definite sequence of commands that should be followed to successfully repair a file. A common command that is used is repair or repair whole. The repair command will, in some cases, successfully repair a file. However, users should take caution when using this command; in some instances repair or repair whole can damage a file more. Becoming familiar with EdG and the various error types will clarify when it is appropriate to use the repair and repair whole commands. These two commands should not be used before verifying the errors in a file.
WTF (Words to Follow) errors should be fixed first because a false WTF value could point to an element much deeper in the file than the element that is actually next. This results in lost elements. Repair whole will not correct this problem. WID (Words in Description) errors should be repaired next. For complex elements, WID identifies where the next non-complex element begins. Repair whole will not correct these errors, either. The repair command will probably fix most other errors.
Keep the following steps in mind when you are using EdG:
- Evaluate the overall condition of the file using
verify whole/none.
- If there are many errors, try executing the automatic repair sequence outlined below:
EdG>set search/all
EdG>set verify/all
EdG>verify whole/none
EdG>patch wtf/auto whole
EdG>repair whole
EdG>verify whole/none
- If there are not too many errors, try looking at each error type individually starting with the worst one first. Remember to address the WTF and WID errors first.
repair should be executed last and the sum of the good and deleted elements should equal the total number of elements in the file. For example:
EdG> verify whole/none
3521 <<END OF DESIGN>>
Total of 3520 elements verified
2972 good, 548 deleted
Note: Improper use of EdG commands, particularly modify, can corrupt the design file. Always make a backup of your design file before attempting any modifications.
Question 6: How do I repair element range errors?
Answer: Range errors can be caused by various operations such as file translation, referencing and copying elements, clipping and/or manipulation of large design files. Most of the time, range block errors can be repaired directly in MicroStation by using an MDL application called fixrange.ma. This application will scan all of the elements in your active design file (not reference files) and will verify and repair the range blocks of each element. This tool can be run via the key-in mdl load fixrange. Once MicroStation notifies you in the status bar or command window "Fixrange Complete", updating the view will sometimes eliminate the problem.
If the problem still persists, then it is more than likely time to run EdG on the file.
One major rule to remember with EdG, especially for a beginner, is that the first 2 commands that should always be entered are:
set search/all
set verify/all
These 2 commands will set the Search and Verify criteria to locate all elements in the design file. Without running these 2 commands, it is likely that EdG will not find all of the errors, leaving a file that is still corrupted.
Illustrated below, you will see some examples of range errors:
In this instance, you can see two cells called "Bubble" and "A". We can determine at this point that both cells have range problems in the X-axis and Y-axis making it likely that this element is either not operating or displaying correctly.
In the image below, we can actually see what the element states that its range values are and what EdG says they should actually be.
Typically, range errors can be repaired easily with the repair command. This command will actually adjust the X and Y values to what EdG says this element should be set at.
Note: If you have a large number of range errors in your file that will need to be repaired, you can issue a repair whole command and this will normally repair all of the range errors in the file.
If EdG tells you that elements have been repaired, it is likely that the elements that were not functioning properly will now work normally. Occasionally, range errors are not repairable or EdG states they were repaired but a verify on the element still reports errors. Nesting problems in the element usually causes these errors and these cases should be handled on a one-by-one basis.
Back to Index
Question 7: How do I repair/replace a missing Design File Header?
Answer: The "Not a Design File" error that occurs when opening corrupted files in MicroStation is a result of the Vital Type 9, Design File Header being lost and/or corrupt.
Follow these steps in order:
- Create a good file using the same settings as the file that has gone bad. The preferred method is to copy the original seed file to a new file named GOOD.DGN.
- It is recommended that you copy both the bad and good files into the EdG directory (the default is \win32app\ustation\EdG or \Bentley\program\EdG). This will save the trouble of entering path statements.
- Backup the bad design file. There is no undo function in EdG.
- Change to the EdG directory.
- At the command prompt, enter the following commands:
edg good.dgn |
(Enter the EdG environment with the good file) |
open new.dgn |
(Create a new output within EdG) |
edg bad.dgn |
(Open the damaged file; substitute the name of your corrupted file) |
patch wtf |
(Enter the patch facility of EdG) |
0 |
(Zero sets the Words-to-Follow value to zero) |
a 5 |
(Instruct EdG to search and not stop until 5 valid elements are found) |
save |
(Exit the patch facility and save the patched element) |
type next |
(Move one element further into the design) |
write rest |
(Write all elements into NEW.DGN) |
close |
(Close NEW.DGN) |
exit |
(Exit EdG) |
The file NEW.DGN will be your new, good file.
Question 8: What is a recursive nested cell and how do I repair it?
Answer: A recursive nested cell is a cell nested inside another cell of the same name. This corrupt cell is created when a user modifies an existing cell in a library by placing it in a design, making changes to it, deleting the cell in the library and putting the new cell back in it's place.
The most critical step missing in this routine is the dropping of the cell. If the cell is not dropped this is what causes the cell to be nested. After editing the cell and placing it back into the library under the same name, the cell is now nested inside the new cell, thus creating a recursive nested cell. Nested cells are supported within MicroStation but recursive nested cells cause corruption and the user needs to pay close attention to drop all cells before putting them into a cell library.
The following commands can be used to clean up recursive nested cells in a design file without losing any visible data. The first commands that you should always enter inside EdG are:
set search/all
set verify/all
verify whole/none
These commands set your search and verify commands to all elements in the file, and also show you how many errors exist in the file.
Next, to find the corrupt cells, you simply need to use the command:
vw/invalid
Recursive nested cells will always show up as an invalid element because when one exists in a file, the file generally will not open or will cause errors and not function properly. The error should appear something like this:
Once you have located the error and you can see the cell name, you can begin to repair those cells. The process we are going to do will find those cells, and drop the cell to components without losing any visible data.
Use the following commands:
set search/type=2/cellname="door2"/nest=0
modify status=delete whole
To finish up the repair process, the last few commands will repair those elements we dropped so that MicroStation knows that they are no longer part of a complex element:
set search/all
repair whole
And finally, we can verify the integrity of the file again by keying in:
verify whole/none
Note: You'll notice after the verify whole/none command we entered there are 12 deleted elements. These are the 12 cells that we dropped--there is no data missing from the file. If we deleted those cells in their entirety, you would see deleted lines and/or other displayable elements that were components of those cells.
Back to Index
Question 9: How do I repair an End of File Missing error?
Answer: When a design file loses it's End of File marker, it's typically because either MicroStation terminated abnormally causing the EOF marker to not be written to the file or the file possibly resides on a server and there are conflicts between the server and the client that caused an interruption in the connection to the file. You can use the following commands to repair a file that has lost its End of File marker:
set search/all
set verify/all
end
undemarcate
end
demarcate
end
show size
undemarcate
repair whole
You will want to continue using the undemarcate command until EdG tells you "No elements found past EOF marker."
Question 10: How can I undelete elements in a file that were accidentally deleted in MicroStation?
Answer: Occasionally users delete elements unintentionally in MicroStation and the Undo Buffer isn't set high enough to recover those elements. In most cases the data is still stored in the file, unless it has been compressed. You can use the following commands to recover those deleted elements as long as the file has not been compressed.
set search/all
set verify/all
modify status=active whole
repair whole
vwn
The vwn command will verify the contents of the file and allows you to see if there is any remaining corruption in the file. If there is, you can run the commands listed in Question #5.
Back to Index
Question 11: Is there a way to run a sequence of commands on every design file you open without needing to type them manually?
Answer: EdG lets you create a text file to store your frequently used commands and run them on every file you open in EdG. To do this, you need to create a text file using Notepad or a similar ASCII text editor that contains the commands you wish to use on every file. Many users simply place the following 2 commands in their text file because these should always be used first when running EdG:
set search/all
set verify/all
Once you've created your text file and listed your commands, separated by only a carriage return, you need to save this file into your EdG directory and call it edgdgn.edg. You must name it this or EdG will not see the file and will not run those initial commands.
Question 12: I have an entire server of files that I want to check for corruption or edit en masse. Can EdG be run in batch mode?
Answer: Yes, you can run EdG in batch mode. Simply create a text file (using Notepad, preferably) and enter the commands you wish to run on the files. The last line in the text file should be "exit". For ease, this file should be saved to your EdG directory and with whatever name you choose. For this example we will call the script file repair.txt.
Once your script file is finished, you need to open a command prompt (DOS prompt) and change directory to your EdG directory. Inside the EdG directory enter the following:
edgbatch repair.txt c:\files\*.dgn
In this example, c:\files\*.dgn represents the full path and wildcard to where your design files are stored. You may use *.*, but make sure that all files in the specified directory are MicroStation design files. If they are not all design files, EdG can corrupt those files even if they are binary.
Back to Index
Question 13: How do I keep track of the commands I used to repair a file?
Answer: One of the commands you can use in EdG is the set journal command. If you wish to track commands when you begin a session of EdG, simply type set journal as the first command and EdG will create a *.jnl file in your EdG directory. By default, this file will be called by the same name as the design file on which you're running EdG. You can specify the name of your journal file by using a command like set journal journal.txt. This is a simple text file and can be associated to and read using Notepad.
Question 14: How can I see a list of the elements that are contained in my file?
Answer: Using the summary command, you can see a complete, summarized listing of the elements in your design file. You can customize this command with the following search criteria. Using these commands will summarize all elements on level 1 for you.
set search/level=1
summary whole
By itself, summary whole will give you information including all occupied levels, colors, weights and styles used, element types used and totals for each of the element types.
Back to Index
Question 15: How can I see all available information on any given element?
Answer: /full will show you all the details of an element that EdG can provide. This information is given to you in standard text format and is readable by anyone. If you understand MicroStation element formats, you can see the binary information that composes an element by using the /dump command.
Question 16: What are some of the common searches in EdG?
Answer: Some of the common searches that you can use are:
-
-
set search/level= |
Search for elements on a particular level |
set search/type= |
Search for elements of a particular type |
set search/cellname=" " |
Search for cells of a particular name |
set search/color= |
Search for elements of a particular color |
set search/class= |
Search for elements of a particular class |
Back to Index
Question 17: My file contains locked elements. How can I unlock them?
Answer: You can use the following commands to unlock elements in your file.
set search/pbits=lock
modify pbits=nolock whole
Note: Do NOT use these commands on a MicroStation TriForma file. MicroStation TriForma elements must remain locked to be supported by the software.
Question 18: Can I remove attribute linkages from elements?
Answer: Using the following commands, you can strip elements of any attribute linkage information:
set search/pbits=attr
modify pbits=noattr whole
set repair/attrflag=remove
repair whole
Back to Index
Question 19: Can I search for text and modify it using EdG?
Answer: Yes, you can search for text and modify characters as well.
set search/characters="map" (this will search for all text elements containing ONLY the word "map")
modify characters="maps" whole (this will change all those "map" elements to "maps")
Question 20: Can I compress a design file using EdG?
Answer: You cannot technically compress a design file using EdG, but you can remove all deleted elements with the following commands:
set search/status=delete
remove whole
Note: Because elements can be nested in complex, you will need to use the remove whole command a few times until it indicates there are no more elements to remove.
Back to Index
Question 21: Can I change element types using EdG?
Answer: No, you cannot change any element from one type to another using EdG. EdG can drop complex elements like line strings, shapes, complex shapes and complex chains. The following commands will drop the complex header of the elements in your search criteria and leave the nested components behind.
modify status=delete whole
repair whole
The repair whole must be done afterward to repair the complex bit that is set on each of those nested elements.
Question 22: What are the element types and the numbers associated to them?
Answer: A Microsoft Excel spreadsheet is available (20Kb) that lists the element types and their numbers.
Back to Index
Question 23: Does EdG run on all types/versions of MicroStation files?
Answer: EdG will run on all MicroStation/J v7.1 design files and earlier. Files that are created or edited using MicroStation V8 will not be recognized in EdG due to the new file format. EdG will also run on MicroStation cell libraries up to and including files created/edited using MicroStation/J v7.1.
Question 24: I am unable to run EdG on my computer. I receive memory/application errors.
Answer: Because EdG runs inside of a DOS shell or window, it's possible to receive errors due to insufficient memory allocated to that command window. To change these settings right-click on your DOS prompt icon and select Properties.
- Using a Windows NT machine, on the Options Tab you should set your Buffer Size = 500 and your
Number of Buffers = 40.
- Using a Windows 98/95 machine, go to the Memory Tab and set the Total Conventional Memory to 200. When you click Apply, it will tell you that you need to Close and restart the DOS window for those changes to take effect.
Because systems vary, we suggest trying these settings first. It's always possible that you may need to set these higher depending on the amount of memory you have available.
Back to Index
Question 25: I am unable to run EdGbatch on my computer. I receive the following error: "The name specified is not recognized as an internal or external command, operable program or batch file."
Answer: EdGbatch does not support files or directory structures that contain spaces or special characters like "\". Because this is a DOS application, it's limited to standard alphanumeric names with no spaces. Removing spaces and special characters will allow the application to run properly.
Question 26: EdG crashes when I run any commands on a file. Why?
Answer: Depending on the severity of corruption in your design file, EdG may crash with a Dr. Watson error or Abnormal Program Termination errors. If this happens, you may need to step through your file until you reach the offending element and delete it. The most common command to crash EdG is repair whole. To step through repairing elements, you can use the following commands to try and pinpoint which element is causing the problem.
repair 1:500 (This will only repair elements 1 through 500.)
If EdG doesn't crash with this command then you know that the offending element is past element 500. You can then use:
repair 500:1000 (This will only repair elements 500 through 1000.)
Continue to increase the range until EdG crashes. Once you've determined what range of elements causes the crash, you can decrease the range you're searching until you get down to a certain few elements and can delete the element.
Back to Index
Question 27: How do I find out more about EdG?
Answer: A help file, edghelp.txt, is delivered in the same directory as the EdG executable file. Help is also available from within EdG, by typing help at the EdG> prompt.
To effectively use EdG, you must understand the MicroStation design file format and element structures. These topics are covered in Chapter 18, "Types of Files", in the MicroStation On-line Reference Guide at http://docs.bentley.com/product.php?prod=1&. EdG is also discussed in Chapter 10, "EdG", in the MicroStation Administrator's Guide.