明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3071|回复: 9

[求助]

[复制链接]
发表于 2005-12-17 18:29 | 显示全部楼层 |阅读模式

各位大虾:

为什么没人理我?现在各位大虾的豪爽都到哪里去了?请帮个忙吧,为什么我这段程序运行时能通过,就是不给我在CAD下画多义线?

发表于 2005-12-17 18:56 | 显示全部楼层

你的程序在哪里呢?

 楼主| 发表于 2005-12-17 22:07 | 显示全部楼层

你好:我的程序在此:

Private Sub Command1_Click()
 On Error Resume Next
  Dim acadApp As AcadApplication
 Set acadApp = GetObject(, "AutoCAD.Application")
    acaApp.Command = script.exe
    If Err Then
        Err.Clear
      Set acadApp = CreateObject("AutoCAD.Application")
        If Err Then
            MsgBox Err.Description
            Exit Sub
        End If
    End If
Dim plineobj As Autocad.AcadLWPolyline
 Dim points(0 To 5) As Double
 points(0) = 1: points(1) = 1
 points(2) = 100: points(3) = 100
 points(4) = 200: points(5) = 200
 Set plineobj = acadApp.ActiveDocument.ModelSpace.AddlightweightLWPolyline(points)
 plineobj.Closed = ture
   ZoomExtents
 ZoomAll
acadApp.Visible = True
End Sub

谢谢你!总算有侠义之士了

发表于 2005-12-17 23:25 | 显示全部楼层

改好了,:)

 On Error Resume Next
  Dim acadApp As AcadApplication
  Dim acaddoc As AcadDocument
 Set acadApp = GetObject(, "AutoCAD.Application")
'    acaApp.Command = script.exe
    If Err Then
        Err.Clear
      Set acadApp = CreateObject("AutoCAD.Application")
      Set acaddoc = acadApp.ActiveDocument
      acadApp.Visible = True
        If Err Then
            MsgBox Err.Description
            Exit Sub
        End If
    End If
Dim Plineobj As AcadLWPolyline
 Dim points(0 To 5) As Double
 points(0) = 1: points(1) = 1
 points(2) = 100: points(3) = 100
 points(4) = 200: points(5) = 200
 Set Plineobj = acaddoc.ModelSpace.AddLightWeightPolyline(points)
 lineobj.Closed = ture
   ZoomExtents
 ZoomAll

End Sub

 楼主| 发表于 2005-12-18 09:30 | 显示全部楼层

真的很好用,谢谢呀!热心的大虾能留个联系方式么?好以后向你请教问题,不过在上面的问题中您能否解释一下为什么要加这些呢?是在不好意思,我还有个问题请教:我编写两段段插块的程序,圆我能插到指定点,为什么线的不能?程序如下:

'创建直线块
 Dim sblockobj(0) As AcadBlock
    Dim insertionpoint(0 To 2) As Double
    insertionpoint(0) = 2014#: insertionpoint(1) = 1436.5: insertionpoint(2) = 0#
    Set sblockobj(0) = acadApp.ActiveDocument.Blocks.Add(insertionpoint, "lineblock") '创建直线块
    Dim stp0(0 To 2) As Double
 Dim enp0(0 To 2) As Double
  stp0(0) = 2014: stp0(1) = 1436.5: enp0(2) = 0
 enp0(0) = 2016: enp0(1) = 1436.5: enp0(2) = 0
 Set plnObj = acadApp.ActiveDocument.ModelSpace.AddLine(stp0, enp0)
 Dim sblockRefobj As AcadBlockReference
insertionpoint(0) = 2014#: insertionpoint(1) = 1436.5: insertionpoint(2) = 0#
Set sblockRefobj(0) = acadApp.ActiveDocument.ModelSpace.InsertBlock(insertionpoint, "lineblock", 1#, 1#, 1#, 0) '插入块

'插入直线块

insertionpoint(0) = 2038.8: insertionpoint(1) = 1436.5: insertionpoint(2) = 0#
Set sblockRefobj(0) = acadApp.ActiveDocument.ModelSpace.InsertBlock(insertionpoint, "lineblock", 1#, 1#, 1#, 0)

为什么不能插到我指定的(2038.8,1436.5)点?

还有如果我想镜像很多对象时,我该怎么办?谢谢!

我的联系方式:E-mail:wfcst2004@163.com qq:46184430,您的那,能同您联系么?

发表于 2005-12-18 17:45 | 显示全部楼层

我的信箱:my9683@163.com

 楼主| 发表于 2005-12-18 20:16 | 显示全部楼层
朋友,你好,谢谢你的回复了,实在不好意思我上面的问题麻烦你再看一下好么?我插不到指定点(程序能通过,但在找不到所插的线)
发表于 2005-12-18 21:13 | 显示全部楼层

你在定义块的时候是怎么定义的?

 楼主| 发表于 2005-12-18 21:30 | 显示全部楼层
就是创建块之间的--定义?我不知道你是怎样收费的?如果你有能力解决让我同时镜像很多内容的话,我可以付费?不过我知道这(同时镜像很多内容)很不好办?你必须让我知道你的实力,谢谢
发表于 2005-12-18 22:39 | 显示全部楼层

嗯,把你的要求写详细些,最好附上例图,寄到我的信箱,我的QQ:1161713,解决不了你的问题我也不好意思收费,呵~~

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-19 08:46 , Processed in 0.340436 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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