Create an orthographic view via the C# API

Create an orthographic view via the C# API

annh2Q9TB
Explorer Explorer
720 Views
2 Replies
Message 1 of 3

Create an orthographic view via the C# API

annh2Q9TB
Explorer
Explorer

Dear All!
How can I create an orthographic view via the C# API? I'm trying to use the PnP3dOrthoDrawingsUI.dll, which has a CreateOrthos() function. However, I'm having some problems: I cannot programmatically select the viewport placement points on the drawing using the C# API. Currently, I have to use the mouse to pick the points manually.

public static void CreateOrthoView()
{
 var doc = Application.DocumentManager.MdiActiveDocument;
 var db = doc.Database;
 var ed = doc.Editor;

 try
 {
   var selectedModels = new StringCollection();

   selectedModels.Add(@"D:\Annh\Plant3D Tool\Plant 3D Project\Test_Project_001\Plant 3D Models\001.dwg");
   string viewName = "FrontView";

   double scale = 0.5;

   double viewportWidth = 250;
   double viewportHeight = 250;
   double viewportDepth = 500.0;

   Commands.ViewType viewType = Commands.ViewType.Front;
   string strViewType = "FrontView";

   Vector3d viewDir = new Vector3d(1, 0, 0);

   Vector3d upVector = new Vector3d(0, 0, 1);

   Point3d lowerLeftPt = new Point3d(0, 0, -250);

   Point3d upperRightPt = new Point3d(500, 500, 250);

   var cubeSolid = new Solid3d();

   cubeSolid.CreateBox(500, 500, 500);

   var orthoView = new PlantOrthoView();

   orthoView.CreateOrthos(
     selectedModels, viewName, scale, viewportWidth, viewportHeight, viewportDepth, viewType,
     strViewType, viewDir, upVector, lowerLeftPt, upperRightPt, cubeSolid);

 } 
   catch (Exception ex)
 { 
    ed.WriteMessage("\n Error: " + ex.Message);
 }
}


Thank you very much for your support!

721 Views
2 Replies
Replies (2)
Message 2 of 3

jomar_hipolito
Participant
Participant

Have you solved your problem?

0 Likes
Message 3 of 3

Logesh_MarimuthuGJ3SM
Participant
Participant

Hi @annh2Q9TB ,

Did you resolve this issue?

0 Likes