Author Topic: How to zoom extend in a new created dwg?  (Read 1764 times)

0 Members and 1 Guest are viewing this topic.

netcai

  • Mosquito
  • Posts: 12
How to zoom extend in a new created dwg?
« on: April 25, 2018, 10:46:10 AM »
I create a new dwg by c#, I wish to zoom extend this dwg through side database, anybody knows how can I realize it?

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: How to zoom extend in a new created dwg?
« Reply #1 on: April 25, 2018, 04:31:09 PM »
It's not worth pursuing IMO. You don't get any preview icon and have to handle a bunch of low level system details.
I make good use of core console for things like this you want hidden from the user.
Code - C#: [Select]
  1. public void StartAutoCAD(string dwgPath)
  2.         {
  3.             var DirInfo = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
  4.             DirInfo = DirInfo.GetDirectories("Autodesk").FirstOrDefault();
  5.             var exefiles = DirInfo.GetFiles("accoreconsole.exe", SearchOption.AllDirectories);
  6.             string exepath = null;
  7.             if (exefiles.Length > 0)
  8.             {
  9.                 exepath = exefiles[0].FullName;
  10.             }
  11.  
  12.             var scriptpath = Path.Combine(Path.GetTempPath(), "Temp.scr");
  13.             using (var writer = File.CreateText(scriptpath))
  14.             {
  15.                 writer.WriteLine("ZOOM");
  16.                 writer.WriteLine("EXTENTS");
  17.                 writer.WriteLine("QSAVE");
  18.             }
  19.             var p = new System.Diagnostics.Process();
  20.             p.StartInfo.FileName = exepath;
  21.             p.StartInfo.Arguments = string.Format("/i \"{0}\" /s \"{1}\"", dwgPath, scriptpath);
  22.             p.StartInfo.UseShellExecute = false;
  23.             p.StartInfo.CreateNoWindow = true;
  24.             p.Start();
  25.         }

Elisendaz

  • Guest
Re: How to zoom extend in a new created dwg?
« Reply #2 on: May 23, 2018, 12:07:38 AM »
The main forum of this forum is usually where to find it.