.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CHSPACE in Viewport programmatically?

3 REPLIES 3
Reply
Message 1 of 4
NayaraFJ
681 Views, 3 Replies

CHSPACE in Viewport programmatically?


Need to get inside the viewport in paperspace and run the command CHSPACE to bring some layers to the modelspace viewport. How to do this programmatically?

The
principle is as follows:


[CommandMethod("ChangeViewports")] public static void ChangeViewports() { Document document = Application.DocumentManager.MdiActiveDocument; Database database = document.Database; Editor editor = document.Editor; using (Transaction transaction = database.TransactionManager.StartTransaction()) { ObjectIdCollection objectIdCollection = database.GetViewports(false); foreach (ObjectId id in objectIdCollection) { Viewport viewport = transaction.GetObject(id, OpenMode.ForWrite) as Viewport; if (viewport.StandardScale == StandardScaleType.Scale1To1) viewport.Erase(); else { //Run this command CHSPACE viewport } } transaction.Commit(); } }

 

 

 

 

Thank you!

3 REPLIES 3
Message 2 of 4
philippe.leefsma
in reply to: NayaraFJ

Hi

 

You can run a command using Document.SendStringToExecute. However I don't really understand the point of your question as same layers exist in both model and paper spaces, I don't see how you're going to use CHSPACE to import a layer from model to paper, this command only applies to entities...

 

Regards,

Philippe.

 

 

 

 

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
matt.worland
in reply to: NayaraFJ

Is this what you are after?

Selecting Model Space entities from Paper Space

 

If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
Message 4 of 4

I need the same. I think he means copy objects (not just layers) from MS to PS. My need is to copy a selected closed polyline from MS to PS, suitably scaled to match the VP. [Selecting Model Space entities from Paper Space] just creates a selection set based on the viewport window. Not quite the same. Dale




______________
Yes, I'm Satoshi.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost