Converting From Microstation to Autocad

Converting From Microstation to Autocad

abel_henok
Contributor Contributor
2,563 Views
24 Replies
Message 1 of 25

Converting From Microstation to Autocad

abel_henok
Contributor
Contributor

 

In Microstation, I ran a batch process from dgn to dwg. I have all of my newly converted dwg files but my paperspace page layout is set to 8.5x11 and does not contain a viewport. I would like to know the quickest way to set page layouts for all files to 11x17 along with creating batch viewports (single, FIT) for a set of project drawings.

The reason I need for viewports set to FIT is because some drawings in Model Space are not located at the same coordinates as other drawings.

 

Can someone please provide a lisp to do this or perhaps suggest another efficient method?

 

 

 

Two separate methods I was thinking on how to create a viewport:

1) Going from Microstation to AutoCad: Level map the Microstation titleblock "level x" to an Autocad layer "titleblock_x". Then in AutoCad, create a single viewport, FIT, to layer "titleblock_x". Doing this would create a viewport specific to the layer.

 

2) In AutoCad, run a lisp to freeze all layers except for the layer "titleblock_x". Then create a single viewport, FIT.  Afterwards, unfreeze everything.

 

note:

I have created an 11x17 dwt file which contains a viewport. 

 

 

I look forward to hearing from you and hope you help me reach a solution.

 

Thanks!

 

 

0 Likes
2,564 Views
24 Replies
Replies (24)
Message 2 of 25

paullimapa
Mentor
Mentor

could you share your converted dwg?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 25

abel_henok
Contributor
Contributor

Hi Paul, unfortunately I am unable to share my drawings. However, the process I'm looking for would apply for any set of dwg drawings. Essentially, my goal is to apply an 11x17 page layout and viewport MVIEW, FIT to an entire set of drawings in a directory. Would you know a method? This would save a lot of time for me. Thanks!

0 Likes
Message 4 of 25

paullimapa
Mentor
Mentor

Little more challenging now if you can't share any sample drawings.

First, I'm not sure about the FIT to Layer "titleblock_xpart.

If it was set to the lower left & upper right window coordinates of a Block named "titleblock_x" in model space then that would be easily doable.

Also here are more questions relating to your 11x17.dwt template:

1. Have you created a page setup with a specific name that you would like to be imported?

2. What is the name the of the Layout that you have the 11x17 vport already created to be inserted?

3. What version of AutoCAD are you running?

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 25

abel_henok
Contributor
Contributor

Understandable. The goal is to batch MVIEW, FIT on 11x17 landscape for all drawings in the directory. Below are my responses to your questions:

 

1) I have created a "new" page layout here:

abel_henok_0-1727133962996.png

 

2) The name of the layout after the conversion is Layout1 (this applies for all of the drawings as well). Each file has one Model and one Layout1 tab

abel_henok_1-1727134109268.png

 

3) AutoCad Electrical 2022

0 Likes
Message 6 of 25

paullimapa
Mentor
Mentor

Ok, back to the FIT question.

In AutoCAD language that would be ZOOM Extents.

So whatever objects are in the model will determine the extents of the display.

Or do you have a specific title block which is a block that you want to zoom window into?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 7 of 25

abel_henok
Contributor
Contributor

The way these drawings were converted from MicroStation...the titleblock along with the designs are all in modelspace in AutoCad. The titleblock is on a reference file. Some drawings are on different coordinates in comparison to other drawings. However, if I freeze all layers in all drawings with a Lisp (except the xref border layer). We can find a method to set all page layouts to 11x17 followed by MVIEW or Zoom Extents for all drawings. The viewports will then be created based on the border. Afterwards, I plan to unfreeze all layers with the lisp you created.

 

For future drawings, we will have our titleblocks in Paperspace with dwt files. Though for now, we have way too many files to convert so we would just like to convert our drawings into Autocad by the above process. Please let me know your thoughts. Thanks!

0 Likes
Message 8 of 25

paullimapa
Mentor
Mentor

Unzip the attached 11x17.scr file and with one of the converted dwgs opened enter the SCRIPT command and select this 11x17.scr file to see if it works.

FYI: Your 11x17.dwt needs to be saved in a location AutoCAD Electrical can find like with the other template files.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 9 of 25

abel_henok
Contributor
Contributor

The first time I entered "SCRIPT" in the command line, a window prompt appeared allowing me to choose the 11x17.scr file. However, now I do not receive a window prompt and instead receive the following message in the command prompt:

 

abel_henok_0-1727139180419.png

 

It is displaying the dwg file name and location and doesn't allow me to select or enter the 11x17.scr file.

 

0 Likes
Message 10 of 25

paullimapa
Mentor
Mentor

This means the script I provided did not complete but crashed somewhere.

Enter at the command prompt:

FILEDIA

1

CMDDIA

1

You'll have to run the 11x17.scr file again and then hit F2 to see the Text screen and see where it failed.

Perhaps it could not find your 11x27.dwt which would cause it to fail?

Difficult to troubleshoot also without your dwt/dwg files.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 11 of 25

abel_henok
Contributor
Contributor

The commands you mentioned resolved the issue after setting values to 1.

 

However, what's the intent of the script?

 

I noticed it does create a view port on a single drawing. However, the page layout is now 11x17 but it is not fit and is not applying to the entire set of drawings in the directory.

 

Please look at the below image for reference of the viewport in Paperspace page layout and let me know your thoughts.

abel_henok_0-1727141514678.png

 

Thank you!

 

0 Likes
Message 12 of 25

abel_henok
Contributor
Contributor

I think we're getting closer.

When I run your script, it's using the dwt file to which contains the 11x17 layout and viewport on a per drawing basis. Afterwards, when I run the attached zoome lisp, it performs a zoom extents within the viewports for multiple page layouts within the same drawing.

If we can have this apply for an entire directory of files, that would be awesome!

0 Likes
Message 13 of 25

paullimapa
Mentor
Mentor

Since something is crashing with the script file I provided and you don't know how to troubleshoot it on your end,

you can test by executing each line at a time by copying it to AutoCAD's command prompt to see where it fails.

But per your post it looks like it imported the layout from your 11x17.dwt properly.

So with that in mind we can assume at least up to this point it works.

Here's one method to run a series of commands on a set of dwgs in a folder:

Script Writer | Lee Mac Programming (lee-mac.com)

What you can try is fill out the Script Line on Lee Mac's program like this (assume your Zoome.lsp is in a File Support Path location):

_.Open *file* _.TILEDMODE 1 _.FILEDIA 0 _.CMDDIA 0 _.-LAYOUT _D Layout1 _.-LAYOUT _T 11x17.dwt Layout1 _.-LAYOUT _D Layout2 _.CTAB Layout1 _.FILEDIA 1 _.CMDDIA 1 (load"zoome") ZoomE _.Qsave _.Close

paullimapa_0-1727146720995.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 14 of 25

abel_henok
Contributor
Contributor
I haven't tested the above method yet simply because of an IT block on script files running in an entire directory.

However, as of now, when I type "SCRIPT" into the command line...it creates a new layout tab "Layout2-Layout1" which is correct (11x17 with viewport) but the current existing layout tab, Layout1 will be correct after running the "SCRIPT" command a second time.

If it's possible, I'd like to see if we can just have "SCRIPT" modify "Layout1" using the dwt and possibly rename "Layout1" tab to "11x17". (The renaming is not as important but would be nice)

Our stakeholders would prefer to have one Layout Tab instead of creating a new Layout Tab called, "Layout2-Layout1".

Afterwards, we may still need this command to be executable in a LISP so that we can batch apply it to a directory.

Please let me know your thoughts and I truly appreciate you!

Thank you.
0 Likes
Message 15 of 25

paullimapa
Mentor
Mentor

Hopefully your IT staff will make an exception in this case to allow script files to run on dwgs in an entire folder for batch processing.

As for the Layout name, my original script file purposely deletes Layout1 so the Layout1 can be imported from your 11x17.dwt template file.

But this didn't work (again I'm guessing here since I don't have your converted dwgs to test with) could be because your drawing is currently set with Layout1 current.

I've modified the attached script files in 2 versions for you to test this theory.

Both of them goes to Model tab using Tilemode 1 before running the rest of the commands.

11x17-1.scr would then delete current drawing's Layout1, imports Layout1 from your 11x17.dwt template and also deletes Layout2 if any. Then it sets Layout1 current, goes to Mspace, does a Zoom Extents and ends in Pspace

paullimapa_0-1727196934042.png

 

11x17-2.scr first renames Layout1 to Layout0, imports Layout1 from your 11x17.dwt template, and then deletes Layout2 if any and Layout0 leaving the dwg with just Layout1. Next it sets Layout1 current, goes to Mspace, Layer Thaws & Sets to 0, Freezes *, Thaws Layer *titleblock_x and then does a Zoom Extents and ends by Layer Thaw * and returns to Pspace. This version should take care of properly zooming the pspace vport to your layer *titleblock_x.

paullimapa_1-1727196945422.png

 

Let me know how these work out for you.

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 16 of 25

abel_henok
Contributor
Contributor

Hey Paul,

 

Thanks for providing the additional scripts!

 

First, I would like to provide my steps to you just to be sure I executed your process correctly...the following were my steps:

1) Download, unzip and place .scr files in a trusted location.

2) Added the location of all files in a trusted location in AutoCad (11x17.dwt is located in the templates location and also in the location with the folder containg directory of .dwg files)

3) Appload DwgAccPikScrA.lsp and entered DwgAccPikScrA in command line

4) Selected the folder with directory of .dwg files

5) Selected and tested individually: 11x17.scr11x17-1.scr, 11x17-2.scr

 

 

All three scripts run as intended. I can see the commands in the .exe as shown in the image below:

abel_henok_0-1727218010094.png

 

However, I don't see any changes to the drawings in the directory. Notice the timestamps on the drawings below:

abel_henok_2-1727219131019.png

 

Though, I do notice files did populate in the temp folder with filetypes set to "file". Please see the image below:

abel_henok_1-1727218215021.png

 

Perhaps the script is not overwriting the existing files in the directory?

 

Please let me know your thoughts.

 

*Note: 11x17-2.scr works great on a single drawing when I enter script in the command line and select11x17-2.scr. It uses the dwt and also performs zoom extents.

 

Thanks again!

0 Likes
Message 17 of 25

paullimapa
Mentor
Mentor

That's because none of the scripts I gave you provided a QSAVE command at the end to save all the changes.

I've now added that which should now save the dwg before closing.

Let me know if 11x17-2.scr now properly zooms the vport location.

paullimapa_0-1727219813091.pngpaullimapa_1-1727219818310.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 18 of 25

abel_henok
Contributor
Contributor

Paul,

 

It worked! You are truly amazing. Page Layout1 for all drawings in directory are 11x17 and viewports are FIT.

 

Though I would like to mention a few things:

 

1) We now have Layout2 tab in all drawings. Do you think we can modify 11x17-2.scr to delete Layout 2?

 

2) In the directory, we have our updated .dwg files along with .bak, .dwl and .dwl2. Is it possible to remove .bak, .dwl and .dwl2 from the directory?

abel_henok_0-1727222311445.png

 

3) Can we modify the Layout1 tab to say "11x17"?

 

4) Is it possible to incorporate a freeze command to freeze layers "level10, level11, level12,level13,level14"? We have the lisp file layfrzdwgdir which can be executed after 11x17-2.scr is complete but it would be even more incredible if we can incorporate this into the script.

 

Please let me know your thoughts.

 

Thank you so much!

0 Likes
Message 19 of 25

paullimapa
Mentor
Mentor

I've attached updated 11x17-2.scr for you to try.

paullimapa_1-1727224675044.png

 

But here are my responses to your requests:

1) We now have Layout2 tab in all drawings. Do you think we can modify 11x17-2.scr to delete Layout 2?

Answer: The script already contains the command to delete Layout2. But from your screen capture you provided earlier it seems to not be able to locate such a layout so I don't have a solution to this problem. 

paullimapa_1-1727223966812.png

 

2) In the directory, we have our updated .dwg files along with .bak, .dwl and .dwl2. Is it possible to remove .bak, .dwl and .dwl2 from the directory?

The dwl & dwl2 files are used by AutoCAD when a particular drawing is opened so it locks the file to prevent another user from accessing it. When AutoCAD successfully closes out of that dwg file then those file types would automatically be romoved.

Answer: The bak file is generated after AutoCAD performs a Save on a dwg. The previous dwg version is renamed now using the .bak. Since the lisp code already finished running but the accoreconsole (black dos box) have not, it will not find the .bak files to delete. I'd also advised against deleting these incase the dwg gets corrupted. You can then always rename the .bak file to .dwg to use.

 

3) Can we modify the Layout1 tab to say "11x17"?

Answer: Yes, the updated script now includes the rename.

 

4) Is it possible to incorporate a freeze command to freeze layers "level10, level11, level12,level13,level14"? We have the lisp file layfrzdwgdir which can be executed after 11x17-2.scr is complete but it would be even more incredible if we can incorporate this into the script.

Answer: The layfrzdwgdir.lsp code actually uses another method to access the dwgs without opening them for processing. That method cannot be mingled with this accoreconsole method. But what I have done is again updated the script to include freezing those layers you specified. 

 

See if these modifications works out for you.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 20 of 25

abel_henok
Contributor
Contributor

Thank you for all your responses, Paul.

 

The previous 11x17-2.scr works. Afterwards, I am able to run the layfrzdwgdir.lsp to freeze specified layers.

 

Though, the latest version of 11x17-2.scr doesn't zoom extents like the previous version and does not overwrite existing files in directory. However, the layout tab does change to 11x17 and also deletes Layout2 tab. I'm not too concerned if we can't make an additional revision to the script but it would have been great.

 

I do have just two more questions about this topic.

 

1) We have other groups in our company which will have to have some variation of the script you've created. For instance, page layouts may differ from 11x17 so they will not be able to use this script. What will be the steps they can take so I can assist them in their conversion efforts?

 

2) Lastly, can you please provide a line for line explanation of the script and perhaps summarize our accomplishment for my full understanding of how the previous 11x17-2.scr works?

0 Likes