vbnetcad,vbnetcad图块文字

VB.NET连接AutoCAD出错

这个是vb.net教材里面的吧,我也是前两天刚下的。遇到类似的问题,下面是我的解决办法

成都创新互联公司专注于企业全网营销推广、网站重做改版、浈江网站定制设计、自适应品牌网站建设、H5响应式网站购物商城网站建设、集团公司官网建设、成都外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为浈江等各大城市提供网站开发制作服务。

首先要参考引用Autodesk.AutoCAD.Interop.dll还有Autodesk.AutoCAD.Interop.Common.dll

然后代码有两处也需要相应修改,我用的是.NET 的 vb2008

'Dim AcadApp As AutoCAD.AcadApplication

Dim AcadApp As Autodesk.AutoCAD.Interop.AcadApplication

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Call 连接AutoCAD()

End Sub

Sub 连接AutoCAD()

On Error Resume Next

AcadApp = GetObject(, "AutoCAD.Application")

If Err.Number Then

Err.Clear()

AcadApp = CreateObject("AutoCAD.Application")

If Err.Number Then

MsgBox("不能运行AutoCAD,请检查是否安装了AutoCAD")

Exit Sub

End If

End If

AcadApp.Visible = True '界面可视

'AcadApp.WindowState = AutoCAD.AcWindowState.acMax '界面最大化

AcadApp.WindowState = Autodesk.AutoCAD.Interop.Common.AcWindowState.acMax

AppActivate(AcadApp.Caption) '显示AutoCAD界面

End Sub

vb.net打开cad画图的问题?

你去查查书吧,书上挺详细的,在这说不好说,你先在项目里引用。然后 Dim acadapp As AcadApplication Dim acaddoc As AcadDocument On Error Resume Next AcadApp = GetObject(, "AutoCAD.Application") If Err.Number Then Err.Clear() AcadApp = CreateObject("AutoCAD.Application") If Err.Number Then MsgBox("不能运行AutoCAD,请检查是否安装了AutoCAD") Exit Sub End If End If AcadApp.Visible = True '界面可视

如何使用vb.net调用cad进行绘图

你去查查书吧,书上挺详细的,在这说不好说,你先在项目里引用。然后 Dim acadapp As AcadApplication Dim acaddoc As AcadDocument On Error Resume Next AcadApp = GetObject(, "AutoCAD.Application") If Err.Number Then Err.Clear() AcadApp = CreateObject("AutoCAD.Application") If Err.Number Then MsgBox("不能运行AutoCAD,请检查是否安装了AutoCAD") Exit Sub End If End If AcadApp.Visible = True '界面可视

vb.netcadgetpoint如何只能选切点

利用CAD对象捕捉功能。通过查询netcadgetpoint官网得知,vbnetcadgetpoint可以利用CAD对象捕捉功能才能选切点,vbnetcadgetpoint在新基建工程对话框当选择工程部类为Visual Basic工程。

VB.Net读取AutoCAD图纸

如果可以的话请把分给我

以下是cad2007版的,引用autocad 2007 type library 和autocad/objectdbx common 17如果是04或者版本更低的只要引用autocad 2007 type library,代码的话大同小异,思路是一样的

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

On Error Resume Next

Dim acadapp As Autodesk.AutoCAD.Interop.AcadApplication

acadapp = GetObject(vbNullString, "autoCAD.application")

Dim acaddoc As Autodesk.AutoCAD.Interop.AcadDocument

acaddoc = acadapp.ActiveDocument

Dim Ms As Autodesk.AutoCAD.Interop.Common.AcadModelSpace

Ms = acaddoc.ModelSpace

Dim acadObjectI As Autodesk.AutoCAD.Interop.Common.AcadObject

Dim Linei As Autodesk.AutoCAD.Interop.Common.AcadLine

Dim Circlei As Autodesk.AutoCAD.Interop.Common.AcadCircle

Dim Polylinei As Autodesk.AutoCAD.Interop.Common.AcadPolyline

Dim pt As Autodesk.AutoCAD.Interop.Common.AcadPoint

For Each acadObjectI In Ms

Debug.Print(acadObjectI.ObjectName)

Select Case acadObjectI.ObjectName

Case "AcDbLine"

Linei = acadObjectI

Debug.Print("X =" Linei.StartPoint(0).ToString)

Debug.Print("Y =" Linei.StartPoint(1).ToString)

Case ""

Case ""

End Select

Next

End Sub

如何将CAD窗口显示在VB.NET窗体下

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Runtime.InteropServices;

using Autodesk.AutoCAD.Interop;

namespace WindowsFormsApplication1

{

public partial class Form1 : Form

{

AcadApplication app;

public Form1()

{

InitializeComponent();

}

[DllImport("user32.dll", SetLastError = true)]

static extern IntPtr SetParent(IntPtr child, IntPtr newParent);

[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]

public static extern IntPtr GetParent(IntPtr hWnd);

private void Form1_Load(object sender, EventArgs e)

{

app = (AcadApplication)Marshal.GetActiveObject("AutoCad.Application");

SetParent(new IntPtr(app.HWND), this.Handle);

}

}

}


本文标题:vbnetcad,vbnetcad图块文字
文章源于:http://scyanting.com/article/hseios.html