明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2320|回复: 1

初学vb.net,在2010里画线的例子

[复制链接]
发表于 2011-9-10 08:30 | 显示全部楼层 |阅读模式
本帖最后由 shirazbj 于 2011-9-10 18:56 编辑
  1. Public Class Form1

  2.     Dim acadapp As Autodesk.AutoCAD.Interop.AcadApplication

  3.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  4.         End
  5.     End Sub

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

  7.         Call bj_linkautocad()
  8.         Call bj_draw()

  9.     End Sub
  10.     Sub bj_linkautocad()

  11.         On Error Resume Next

  12.         acadapp = GetObject(, "autocad.application")
  13.         If Err.Number Then
  14.             Err.Clear()
  15.             acadapp = CreateObject("autocad.application")
  16.             If Err.Number Then
  17.                 MsgBox("Can't start AutoCAD")
  18.                 Exit Sub

  19.             End If
  20.         End If

  21.         acadapp.Visible = True
  22.         AppActivate(acadapp.Caption)

  23.     End Sub
  24.     Sub bj_draw()

  25.         Dim points(3) As Double
  26.         Dim plineobj(1) As Autodesk.AutoCAD.Interop.Common.AcadLWPolyline

  27.         points(0) = 0 : points(1) = 0
  28.         points(2) = 100 : points(3) = 100
  29.         plineobj(0) = acadapp.ActiveDocument.ModelSpace.AddLightWeightPolyline(points)

  30.     End Sub
  31. End Class

用的vb.net express 2008, 在autocad 2010里从(0,0)-(100,100)画了一条线.

发表于 2011-9-12 01:16 | 显示全部楼层
发贴何意?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-6-13 16:48 , Processed in 0.123689 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表