wfcst2004 发表于 2005-12-17 18:29:00

[求助]

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

小顽童 发表于 2005-12-17 18:56:00

<P>你的程序在哪里呢?</P>

wfcst2004 发表于 2005-12-17 22:07:00

<P>你好:我的程序在此:</P>
<P>Private Sub Command1_Click()<BR>&nbsp;On Error Resume Next<BR>&nbsp; Dim acadApp As AcadApplication<BR>&nbsp;Set acadApp = GetObject(, "AutoCAD.Application")<BR>&nbsp;&nbsp;&nbsp; acaApp.Command = script.exe<BR>&nbsp;&nbsp;&nbsp; If Err Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Err.Clear<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set acadApp = CreateObject("AutoCAD.Application")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Err Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox Err.Description<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Sub<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<BR>&nbsp;&nbsp;&nbsp; End If<BR>Dim plineobj As Autocad.AcadLWPolyline<BR>&nbsp;Dim points(0 To 5) As Double<BR>&nbsp;points(0) = 1: points(1) = 1<BR>&nbsp;points(2) = 100: points(3) = 100<BR>&nbsp;points(4) = 200: points(5) = 200<BR>&nbsp;Set plineobj = acadApp.ActiveDocument.ModelSpace.AddlightweightLWPolyline(points)<BR>&nbsp;plineobj.Closed = ture<BR>&nbsp;&nbsp; ZoomExtents<BR>&nbsp;ZoomAll<BR>acadApp.Visible = True<BR>End Sub</P>
<P>谢谢你!总算有侠义之士了</P>

小顽童 发表于 2005-12-17 23:25:00

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

wfcst2004 发表于 2005-12-18 09:30:00

<P>真的很好用,谢谢呀!热心的大虾能留个联系方式么?好以后向你请教问题,不过在上面的问题中您能否解释一下为什么要加这些呢?是在不好意思,我还有个问题请教:我编写两段段插块的程序,圆我能插到指定点,为什么线的不能?程序如下: </P>
<P>'创建直线块<BR>&nbsp;Dim sblockobj(0) As AcadBlock<BR>&nbsp;&nbsp;&nbsp; Dim insertionpoint(0 To 2) As Double<BR>&nbsp;&nbsp;&nbsp; insertionpoint(0) = 2014#: insertionpoint(1) = 1436.5: insertionpoint(2) = 0#<BR>&nbsp;&nbsp;&nbsp; Set sblockobj(0) = acadApp.ActiveDocument.Blocks.Add(insertionpoint, "lineblock") '创建直线块<BR>&nbsp;&nbsp;&nbsp; Dim stp0(0 To 2) As Double<BR>&nbsp;Dim enp0(0 To 2) As Double<BR>&nbsp; stp0(0) = 2014: stp0(1) = 1436.5: enp0(2) = 0<BR>&nbsp;enp0(0) = 2016: enp0(1) = 1436.5: enp0(2) = 0<BR>&nbsp;Set plnObj = acadApp.ActiveDocument.ModelSpace.AddLine(stp0, enp0)<BR>&nbsp;Dim sblockRefobj As AcadBlockReference<BR>insertionpoint(0) = 2014#: insertionpoint(1) = 1436.5: insertionpoint(2) = 0#<BR>Set sblockRefobj(0) = acadApp.ActiveDocument.ModelSpace.InsertBlock(insertionpoint, "lineblock", 1#, 1#, 1#, 0) '插入块</P>
<P>'插入直线块</P>
<P>insertionpoint(0) = 2038.8: insertionpoint(1) = 1436.5: insertionpoint(2) = 0#<BR>Set sblockRefobj(0) = acadApp.ActiveDocument.ModelSpace.InsertBlock(insertionpoint, "lineblock", 1#, 1#, 1#, 0) </P>
<P>为什么不能插到我指定的(2038.8,1436.5)点?</P>
<P>还有如果我想镜像很多对象时,我该怎么办?谢谢!</P>
<P>我的联系方式:E-mail:wfcst2004@163.com qq:46184430,您的那,能同您联系么?</P>

小顽童 发表于 2005-12-18 17:45:00

<P>我的信箱:my9683@163.com</P>

wfcst2004 发表于 2005-12-18 20:16:00

朋友,你好,谢谢你的回复了,实在不好意思我上面的问题麻烦你再看一下好么?我插不到指定点(程序能通过,但在找不到所插的线)

小顽童 发表于 2005-12-18 21:13:00

<P>你在定义块的时候是怎么定义的?</P>

wfcst2004 发表于 2005-12-18 21:30:00

就是创建块之间的--定义?我不知道你是怎样收费的?如果你有能力解决让我同时镜像很多内容的话,我可以付费?不过我知道这(同时镜像很多内容)很不好办?你必须让我知道你的实力,谢谢

小顽童 发表于 2005-12-18 22:39:00

<P>嗯,把你的要求写详细些,最好附上例图,寄到我的信箱,我的QQ:1161713,解决不了你的问题我也不好意思收费,呵~~</P>
页: [1]
查看完整版本: [求助]