Sunteți pe pagina 1din 2

The DWG2CellLib Example

This example illustrates how to create or append a cell library then populate it with an AutoCad block library. The example will use the mdlWorkDgn_XXX() functions to create the cell library and open each DWG for processing. The function MdlModelRef_copyModel() will copy only the 'Model' from each DWG into the new cell library. This example will work in graphics mode or out of graphics mode.

Instruction for the example's use in graphics mode:


To create or append one cell library and populate it with a directory of DWGs use this syntax: mdl load dwgcell2celllib c:\folder\library.cel c:\folder\folder\*.dwg The above will also work if you specify one DWG instead of *.dwg. To create or append multiple cell libraries you can pre-define an ASCII text file that would contain a similar syntax as above. For example: c:\folder\library01.cel, c:\folder\*.dwg c:\folder\library02.cel, c:\folder\folder\*.dwg c:\folder\library03.cel, c:\folder\folder\folder\*.dwg c:\folder\library04.cel, c:\folder\folder\folder\folder\*.dwg There are two methods that can be used to process a text file from the keyin browser: 1. Specify the word textfile. A dialog box will open so that you can browse and select the text file, for example: mdl load dwgcell2celllib textfile 2. Specify the full path and file name of the text file. For example: mdl load dwgcell2celllib c:\folder\dwgcopy.txt If you process in graphics mode or in non-graphics mode a log file will be created called BatchLog.txt that is located in C:\. If a text file is specified per the above syntax a message box will display if the cell library with the specified name already exists. To bypass the message box specify either 'overwrite' or 'append' as a third parameter. See the below instructions for use in non-graphics mode for more information.

Instruction for the example's use in non-graphics mode:


To create multiple cell libraries that would each contain a set of DWG's: 1. Create a text file with the same syntax as if you were processing in graphics mode except add a 3rd parameter to each statement, either 'overwrite' or 'append'. For example: c:\folder\library01.cel, c:\folder\*.dwg, overwrite c:\folder\library01.cel, c:\folder\folder\*.dwg, append If the 3rd parameter is used but it isn't exactly like one of the above options, 'overwrite' is used by default. 2. Open the MicroStation Development Shell. 3. Change the current directory in the MicroStation Development Shell to where the text file is or specify the full path. 4. In the MicroStation Development Shell use the syntax: ustation -wadwgcell2celllib myTextfile.txt If append is specified and the cell library doesnt already exist, it will be created. If a statement in the text file is invalid, a message will be printed to the BatchLog.txt specifying which line number it is. Each paragraph or block of messages in the BatchLog.txt represents one statement in the text file. For example: Cell Library created: 'd:\cell01.cel' Model added is: 'Dimension-33' Model added is: 'dimension' Model added is: 'Dim-33' Model added is: 'dwcimal' Model added is: 'wall' Line: 2 of text file: 'c:\BatchLog.txt' does not have the required arguments Cell Library opened: 'd:\cell04.cel' File is invalid: D:\support\test\DWGCopy\testfiles01\BatchLog.dwg Model added is: 'dwcimal' Model added is: 'ceiling' Model added is: 'Fraction' Model added is: 'R10' Model added is: 'R14-lines' 10 models are processed successfully 2

S-ar putea să vă placă și