AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Autocad P&ID How to open DWG in modelspace

7 REPLIES 7
Reply
Message 1 of 8
110000474593
2218 Views, 7 Replies

Autocad P&ID How to open DWG in modelspace

Hello everbody,

 

I have a simple question I think, though I can't find the answer with Google or on this forum.

 

I have a self made application that talks to Autocad P&ID 2014 with commands and a self made .dll which is loaded in autocad. Depending on some actions in my application, autocad must open a drawing like this:

 

doc = AcadApp.DocumentManager.Open(dwg.ResolvedFilePath, false);

 

Autocad always open drawings in de paperspace I think (PID ANSI D Title Block, white background)?? But I always want to open the drawings in modelspace (drawing with blue background). How do I do that? Can I handle this in my C# code?

 

I hope someone can help me. Thanks in advance.

7 REPLIES 7
Message 2 of 8
testsubject
in reply to: 110000474593

While this is Autocad Electrical, not ACDA P&ID, I might still be able to help you.

 

Autocad will open any DWG in the last state it was saved in. If it was saved in Modelspace, it opens in Modelspace. Same thing with Paperspace.

 

If you want to make sure you are in Modelspace after opening the drawing you can have your code written to set to Modelspace upon opening the dwg. I am not sure of the API call for that though.



Bob Hanrahan
Ace User since 1998
If this answered your question, please click on "Accept Solution"
Message 3 of 8
110000474593
in reply to: testsubject

Thanks for your reply Bob. What you say is true, autocad opens the drawing in the last state it was saved.

 

I will give it a try. But how do I do that? With the 'DocumentManager.Open()' method I can't give in a parameter to open de drawing in paperspace or modelspace. Has this to be done with viewports? Thats what I can found about changing to modelspace of paperspace.

 

And what really is a modelspace or paperspace? What should I do in modelspace and what should I do in paperspace? Paperspace is with title block and modelspace without title block?

Message 4 of 8
testsubject
in reply to: 110000474593

The Modelspace/Paperspace debate rears its ugly head from time to time.

 

I am a Paperspace advocate. I have a good reason to use it. Others disagree.

 

Here is a post I was involved with about the pluses and minuses.

 

http://forums.autodesk.com/t5/AutoCAD-Electrical/Title-Block-paper-space-or-model-space/m-p/1326657/...

 

I would like to point out that for panel layouts, I love using Paperspace. I create the main panel in one drawing and then xref it into all the extra drawings to show detail. Then when I change the original all the detail drawings update automatically.

 

AutoCAD Electrical's plot function only allows you to select one layout for the bulk printing. That is why I use Paperspace for all dwgs.

 

As for helping you with the code needed, that one is beyond me. Sorry I could not be of more help.



Bob Hanrahan
Ace User since 1998
If this answered your question, please click on "Accept Solution"
Message 5 of 8
110000474593
in reply to: testsubject

Thanks for your reply Bob. This week I'll read the post you send.

Anyone else who can help me to open dwg's in modelspace by C# code??
Message 6 of 8
rwydesk500
in reply to: 110000474593

As stated earlier, AutoCAD always opens a drawing in the state it was last saved in.

 

If I want to make sure all the drawings I have in a particular project are all in Model Space (MS), or Paper Space (PS) I sometimes run a simple script with ACE. Tilemode is the system variable. If Tilemode is set to 0 (zero), then PS is the result. If Tilemode is set to 1, MS is the result. A script like this...

 

TILEMODE

0

PSPACE

MVIEW

LOCK

ON

ALL

ZOOM

EXTENTS

[place blank line here for a final return]

 

...sets a drawing into PS, ensures the viewport in PS is with PS current, Locks all Viewports, Zooms the drawing to Extents.

 

One nice feature of ACE is that you can select the Project tab > Project Tools. In the Project-Wide Utilities dialog  "For each drawing..." section and check the "Run command script file" box, path out to where your script resides and Open it. In the Batch Process Drawings dialog select Project > OK and just pick all the drawings in your project you wish to run this script on. Select OK and watch the computer go to work for you! It will open each drawing and save it as the script directed.

 

If you want to make the script change all drawings to the MS tab, simply change the Tilemode number from 0 (zero) to 1, resave it as a .scr in Notepad as a different name and rerun the new script with Batch Process Drawings process outlined above.

 

...scripts rock - especially with ACE. Smiley Happy

 

 

 

Regards,

Rick Yoerger

AutoCAD Electrical 2016
Message 7 of 8
rwydesk500
in reply to: rwydesk500

Oops. That was quite the rabbit trail since the original question was about AutoCAD PID. I'm not sure if that program has Batch script functionality like ACE.

Regards,

Rick Yoerger

AutoCAD Electrical 2016
Message 8 of 8
110000474593
in reply to: rwydesk500

Thankst for your reply Rick. I also don't know if AutoCAD P&ID supports batch scripts, but maybe I can change the tilemode trough my C# code! So thank you for putting me in the right direction, I'll have a look if I can do something with this system variable.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost