C#开发CAD这么弱吗?zoom都这么难解决
C#开发CAD这么弱吗?zoom都这么难解决大家是怎么解决的? 可以调用com库的zoom×××
_
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
平台调用,很方便!! Autodesk.AutoCAD.Internal.Utils.ZoomAuto(1, 1, 1, 1, 1)
guohp仁兄能否用C#改写下?感谢,感觉用.NET的ZE不准确,我都是通过com的
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);
}
Autodesk.AutoCAD.Runtime.LispDataType.Text
这介.net 4.0的功能吧?
.net 2.0显示没有这个 这个……。NET相比较之前的ARX还是有很多地方没有完善的,如果不将之前的ARX打包,则自己实现起来就比较麻烦了 C#没有这么弱。
Zoom,需要对底层的视口记录操作,如下面代码,获取到ViewTableRecord 对象后,对其CenterPoint、Width、Height属性进行设计即可。复制代码
cad2006呢,Editor貌似没有GetCurrentView()和SetCurrentView()方法啊
页:
[1]