.NET

Reply
New Member
zwq740414
Posts: 2
Registered: ‎07-11-2006
Message 1 of 3 (344 Views)

how to use acedSetCurrentView function?

344 Views, 2 Replies
07-11-2006 02:59 AM
hello
i want to Zoom or pan the current view(in modelSapce), and i find a function - acedSetCurrentView ,but it does not work,where error?

the program is :

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;

namespace ClassLibrary2
{
public static class Class1
{
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl, EntryPoint = "#500")]
private static extern bool acedVportTableRecords2Vports();

//[DllImport("acad.exe")]//, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="?acedVports2VportTableRecords@@YA?AW4ErrorStatus@Acad@@XZ")]
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl, EntryPoint = "#501")]
private static extern bool acedVports2VportTableRecords();

//[DllImport("acad.exe")]//, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="?acedSetCurrentView@@YA?AW4ErrorStatus@Acad@@PAVAcDbViewTableRecord@@PAVAcDbViewport@@@Z")> _
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl, EntryPoint = "#444")]
private static extern int acedSetCurrentView(IntPtr viewTableRec, int viewport);

[CommandMethod("MyZoom")]
public static void MyZoom()
{
MyZoom(new Point2d(100, 100), 10, 10);
}
private static Autodesk.AutoCAD.Runtime.ErrorStatus MyZoom(Point2d CenterPt, double Height, double Width)
{
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
DocumentLock docLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();

ErrorStatus es;
ViewTableRecord view = new ViewTableRecord();
view.CenterPoint = CenterPt;
view.FrontClipAtEye = false;
view.Height = Height;
view.Width = Width;
es = (ErrorStatus)acedSetCurrentView(view.UnmanagedObject, 0);
try
{
HostApplicationServices.WorkingDatabase.UpdateExt(true);
}
catch (Autodesk.AutoCAD.Runtime.Exception ex)
{
MessageBox.Show(ex.Message);
}

ed.UpdateScreen();
docLock.Dispose();

return es;
}
}
}
Distinguished Contributor
Alexander Rivilis
Posts: 303
Registered: ‎09-26-2004
Message 2 of 3 (344 Views)

Re: how to use acedSetCurrentView function?

07-11-2006 09:15 AM in reply to: zwq740414
Look at this topic and I think you find solution:
http://www.theswamp.org/index.php?topic=10475.0
New Member
zwq740414
Posts: 2
Registered: ‎07-11-2006
Message 3 of 3 (344 Views)

Re: how to use acedSetCurrentView function?

07-11-2006 05:49 PM in reply to: zwq740414
Thank you very much!

I think i find a good site again,thinks!

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community