bill165 发表于 2015-7-28 17:56:00

C#开发CAD这么弱吗?zoom都这么难解决

C#开发CAD这么弱吗?zoom都这么难解决
大家是怎么解决的?

sxpd 发表于 2015-8-1 08:47:00

可以调用com库的zoom×××

guohq 发表于 2015-8-1 15:41:00

_
    Private Shared Function acedCmd(ByVal rbp As IntPtr) As Integer
         
    End Function
    Public Shared Sub ZoomWindow(ByVal Point1 As Point3d, ByVal Point2 As Point3d)
      Dim res As New ResultBuffer
      res.Add(New TypedValue(Autodesk.AutoCAD.Runtime.LispDataType.Text, "._ZOOM"))
      res.Add(New TypedValue(Autodesk.AutoCAD.Runtime.LispDataType.Text, "_W"))
      res.Add(New TypedValue(Autodesk.AutoCAD.Runtime.LispDataType.Point3d, Point1))
      res.Add(New TypedValue(Autodesk.AutoCAD.Runtime.LispDataType.Point3d, Point2))
      acedCmd(res.UnmanagedObject)
    End Sub
平台调用,很方便!!

hnzgs 发表于 2015-8-10 11:06:00

Autodesk.AutoCAD.Internal.Utils.ZoomAuto(1, 1, 1, 1, 1)

Real_King 发表于 2015-9-6 20:46:00


guohp仁兄能否用C#改写下?感谢,感觉用.NET的ZE不准确,我都是通过com的

guohq 发表于 2015-9-9 10:37:00



private static extern int acedCmd(IntPtr rbp);
public static void ZoomWindow(Point3d Point1, Point3d Point2)
{
      ResultBuffer res = new ResultBuffer();
      res.Add(new TypedValue(Autodesk.AutoCAD.Runtime.LispDataType.Text, "._ZOOM"));
      res.Add(new TypedValue(Autodesk.AutoCAD.Runtime.LispDataType.Text, "_W"));
      res.Add(new TypedValue(Autodesk.AutoCAD.Runtime.LispDataType.Point3d, Point1));
      res.Add(new TypedValue(Autodesk.AutoCAD.Runtime.LispDataType.Point3d, Point2));
      acedCmd(res.UnmanagedObject);
}

革天明 发表于 2015-10-6 18:17:00


Autodesk.AutoCAD.Runtime.LispDataType.Text
这介.net 4.0的功能吧?
.net 2.0显示没有这个

cdinten 发表于 2015-10-8 09:07:00

这个……。NET相比较之前的ARX还是有很多地方没有完善的,如果不将之前的ARX打包,则自己实现起来就比较麻烦了

cairunbin 发表于 2016-1-13 21:10:00

C#没有这么弱。
Zoom,需要对底层的视口记录操作,如下面代码,获取到ViewTableRecord 对象后,对其CenterPoint、Width、Height属性进行设计即可。复制代码

125plus225 发表于 2016-3-1 17:08:00


cad2006呢,Editor貌似没有GetCurrentView()和SetCurrentView()方法啊
页: [1]
查看完整版本: C#开发CAD这么弱吗?zoom都这么难解决