Converting From Microstation to Autocad

Converting From Microstation to Autocad

abel_henok
Contributor Contributor
2,579 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,580 Views
24 Replies
Replies (24)
Message 21 of 25

paullimapa
Mentor
Mentor

I know the mistake I made that prevented Zoom Extents from working. I renamed the Layout to 11x17 but failed to set the CTAB to 11x17 instead of Layout1. So download the attached updated version which looks like this now:

paullimapa_1-1727231142317.png

 

I'll again go over line by line what the script file does. But basically this is like a macro running the commands in AutoCAD one line after another. So it should not be too difficult to modify with any text editor like Notepad.
Here goes:

Line 1: _.TILEMODE 1

This executes Tilemode and sets it to 1 so that the current tab is on Model

Line 2: _.-LAYOUT _R Layout1 Layout0

This executes the command line version of Layout command and Renames Layout1 to Layout0

Line3: _.-LAYOUT _T 11x17.dwt Layout1

This executes the command line version of Layout command again and inserting from Template file 11x17.dwt  Layout1 

Line4: _.-LAYOUT _D Layout2

This executes the command line version of Layout command again and Deletes Layout2

Line5: _.-LAYOUT _D Layout0

This executes the command line version of Layout command again and Deletes Layout0 which was renamed at the beginning

Line6: _.-LAYOUT _R Layout1 11x17

This executes the command line version of Layout command again but this time Renames Layout1 to name of 11x17

Line7: _.CTAB 11x17

This executes Ctab setting the current layout to 11x17

Line8: _.Mspace

This executes Mspace command changing the current space to inside the vport in layout 11x17

Line9: _.-Layer _T 0

This executes the command line version of Layer and then Thaws layer 0

Line10: _S 0

This continues with the Layer command by setting the current layer as 0

Line11: _F *

This continues with the Layer command and Freezes (* = All layers) except the current layer which is set as 0

Line12: _T *titleblock_x

This continues with the Layer command and Thaws layer matching name: *titleblock_x

Line13: 

Empty line = Return which completes the Layer command

Line14: _.Zoom _E

This executes Zoom command and then Extents while still inside the vport

Line15: _.-Layer _T *

This executes the command line version of Layer again but this time Thaws all (* = All layers)

Line16: _F level10,level11,level12,level13,level14

This continues with the Layer command and Freezes layers matching names: level10,level11,level12,level13,level14

Line17: 

Empty line = Return which completes the Layer command

Line18: _.Pspace

This executes Pspace command to return back to Layout from inside vport

Line19: _.Qsave

This executes the Qsave command

Line20: 

Empty line = Return which executes the previous last command

 

 

 


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

paullimapa
Mentor
Mentor

Ok, I figured out how to delete Layout2. Somehow AutoCAD does not technically recognize this layout until it's manually set active. But another way is to use Lisp to do it which I've now included in the first line in the updated 11x17-2.scr attached.

FYI: Now this updated script as well as the previous one I posted only works on drawings that have a Layout1. Since drawings you've already ran the script on previously renamed Layout1 to 11x17, then the script will no longer have any impact. This updated script needs to be applied on the original converted set of drawings that still have Layout1.

Once again here's the line by line explanation of the updated 11x17-2.scr:

paullimapa_0-1727243490708.png

Line1: (foreach x(dictsearch(namedobjdict)"acad_layout")(if(= (car x)3)(setvar"CTAB"(cdr x))))

This is a series of lisp functions that activates all layouts by setting each current including Layout2

Line2: _.TILEMODE 1

This executes Tilemode and sets it to 1 so that the current tab is on Model

Line3: _.-LAYOUT _D Layout1

This executes the command line version of Layout command to Delete Layout1

Line4: _.-LAYOUT _T 11x17.dwt Layout1

This executes the command line version of Layout command again inserting from Template file 11x17.dwt  Layout1

Line5: _.-LAYOUT _R Layout1 11x17

This executes the command line version of Layout command again but this time Renames Layout1 to name of 11x17

Line6: _.-LAYOUT _D Layout2

This executes the command line version of Layout command this time to Delete Layout2

Line7: _.CTAB 11x17

This executes Ctab setting the current layout to 11x17

Line8: _.Mspace

This executes Mspace command changing the current space to inside the vport in layout 11x17

Line9: _.-Layer _T 0

This executes the command line version of Layer and then Thaws layer 0

Line10: _S 0

This continues with the Layer command by setting the current layer as 0

Line11: _F *

This continues with the Layer command and Freezes (* = All layers) except the current layer which is set as 0

Line12: _T *titleblock_x

This continues with the Layer command and Thaws layer matching name: *titleblock_x

Line13: 

Empty line = Return which completes the Layer command

Line14: _.Zoom _E

This executes Zoom command and then Extents while still inside the vport

Line15: _.-Layer _T *

This executes the command line version of Layer again but this time Thaws all (* = All layers)

Line16: _F level10,level11,level12,level13,level14

This continues with the Layer command and Freezes layers matching names: level10,level11,level12,level13,level14

Line17: 

Empty line = Return which completes the Layer command

Line18: _.Pspace

This executes Pspace command to return back to Layout from inside vport

Line19: _.Qsave

This executes the Qsave command

Line20: 

Empty line = Return which executes the previous last command

 

PS:

1. All main commands begin with an underscore "_" and a period "."

The "_" tells AutoCAD to use its native language commands which is English

The "." tells AutoCAD to use the built-in command even if it has been undefined

2. Sub command prompts only need to include "_" because these can't be undefined but do still have the native English language command names.

3. Some main commands when preceded with a hyphen "-" executes without invoking a dialog box allowing the user to respond to the subsequent prompts at the command line


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

paullimapa
Mentor
Mentor

If for some reason you needed to rename the Layout from 11x17 back to Layout1, attached is script file 11x17-0.scr that does exactly that:

paullimapa_0-1727245391216.png

Line1: _.TILEMODE 1

This executes Tilemode and sets it to 1 so that the current tab is on Model

Line2: _.-LAYOUT _R 11x17 Layout1

This executes the command line version of Layout command and Renames 11x17 to Layout1

Line3: _.Qsave

This executes the Qsave command

Line4: 

Empty line = Return which executes the previous last command


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

abel_henok
Contributor
Contributor

Hey Paul,

 

Thank you for all of your help!

 

I ran this script here:

abel_henok_2-1727458324840.png

 

I would like to see if we can run the command ZEAVP some time after the viewport is created but before we Qsave. I tried adding "_.ZEAVP" like the image below (but it did not overwrite the existing files)

abel_henok_3-1727458503728.png

 

The reason I would like to add "ZEAVP" is because I am sampling drawing conversions from other groups and I'm noticing our original script is not zooming the viewports consistently across their files, but "ZEAVP" helps every time. My thought process was that if I add "zoome.lsp" to the Startup Suite then I can add "_.ZEAVP" to the .scr file then ZEAVP can be executed within the script zooming all sheets at the viewports at the same time but that didn't work.

abel_henok_0-1727459806420.png
abel_henok_1-1727459844867.png

 

I have attached the zoome.lsp file here for you to see.

 

Also, can we please add 2 additional tabs to be created for page layouts 8.5x11 and 24x36? If so, I can create the template files..."8.5x11.dwt" and "24x36.dwt". So pretty much, we would like to have 8.5x11 tab, 11x17 tab and 24x36 tab per drawing.

 

Please let me know.

 

Thanks again!

0 Likes
Message 25 of 25

paullimapa
Mentor
Mentor

If the zoom e in the vport is not always working that just means manipulating the "titleblock_x" layer should be not done at all. But instead just do a zoom extents which is what the zoome.lsp accomplishes.

But since you're adding more layouts each with their own vports from 8.5x11.dwt24x36.dwt then the script file should just run the lisp file's function zeavp which cycles through all layout vports doing the zoom extents command.

I also would not rely on what is placed in Startup Suites for Accoreconsole to load the zoome.lsp file properly.

Instead make sure zoome.lsp is located in one of the folders listed under AutoCAD's Options>Files>Support File Search Path & Trusted Locations. Then include the load lisp function in the script to load zoome.lsp and then execute.

Here's the updated script I'm now calling 11x17-3.scr

paullimapa_0-1727462865827.png

Line1: (foreach x(dictsearch(namedobjdict)"acad_layout")(if(= (car x)3)(setvar"CTAB"(cdr x))))

This is a series of lisp functions that activates all layouts by setting each current including Layout2

Line2: _.TILEMODE 1

This executes Tilemode and sets it to 1 so that the current tab is on Model FYI: This is same as: _.CTAB Model

Line3: _.-LAYOUT _D Layout1

This executes the command line version of Layout command to Delete Layout1 first before importing from template

Line4: _.-LAYOUT _T 11x17.dwt Layout1

This executes the command line version of Layout command again inserting from Template file 11x17.dwt  Layout1

Line5: _.-LAYOUT _R Layout1 11x17

This executes the command line version of Layout command again but this time Renames Layout1 to name of 11x17

Line6: _.-LAYOUT _T 8.5x11.dwt Layout1

This executes the command line version of Layout command again inserting from Template file 8.5x11.dwt  Layout1

Line7: _.-LAYOUT _R Layout1 8.5x11

This executes the command line version of Layout command again but this time Renames Layout1 to name of 8.5x11

Line8: _.-LAYOUT _T 24x36.dwt Layout1

This executes the command line version of Layout command again inserting from Template file 24x36.dwt  Layout1

Line9: _.-LAYOUT _R Layout1 24x36

This executes the command line version of Layout command again but this time Renames Layout1 to name of 24x36

Line10: _.-LAYOUT _D Layout2

This executes the command line version of Layout command this time to Delete Layout2

Line11: _.-Layer _F level10,level11,level12,level13,level14

This executes the Layer command and Freezes layers matching names: level10,level11,level12,level13,level14

Line12: 

Empty line = Return which completes the Layer command

Line13: (load"zoome")

This performs the load lisp file function

Line14: (c:zeavp)

This runs the zeavp function

Line15: _.CTAB 11x17

This sets the current layout tab to 11x17

Line16: _.Qsave

This executes the Qsave command

Line17: 

Empty line = Return which executes the previous last command

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes