lygjianzhu08 发表于 2008-10-6 09:36:00

求助

<div>我用以下VBA编程:</div><div><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Sub </font>画点编程<font face="Times New Roman">()</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Dim startPoint(0 To 2) As Double</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Dim OjtPoint As AcadPoint</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">startPoint(0) = 100 'X</font>值</p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">startPoint(1) = 10000 'Y</font>值</p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">startPoint(2) = 0 'Z</font>值</p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Set OjtPoint = ACADProject.ThisDrawing.ModelSpace.AddPoint(startPoint)</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">End Sub</font></p></div><div>我已置我的用户坐标为当前坐标,但结果却是画点仍以世界坐标值画.我买了一本《AutoCAD VBA二次开发教程》看,但从中未找到启发,请高手百忙中指点一下好吗?以上编程语言,要作什么修改才可以是以UCS坐标画点呢?</div>

lygjianzhu08 发表于 2008-10-6 14:05:00

<p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">' </font>将点的<font face="Times New Roman">UCS</font>坐标转化到<font face="Times New Roman">WCS</font>坐标</p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Private Function PtUcs2Wcs(ptUcs As Variant) As Variant</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; PtUcs2Wcs = ThisDrawing.Utility.TranslateCoordinates(ptUcs, acUCS, acWorld, False)</font></span></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">End Function</font></p><div style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0mm; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 0mm; PADDING-BOTTOM: 0mm; BORDER-LEFT: medium none; PADDING-TOP: 1pt; BORDER-BOTTOM: medium none; mso-element: para-border-div; mso-border-top-alt: solid windowtext .5pt;"><p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0mm; BORDER-TOP: medium none; PADDING-LEFT: 0mm; PADDING-BOTTOM: 0mm; MARGIN: 0mm 0mm 0pt; BORDER-LEFT: medium none; PADDING-TOP: 0mm; BORDER-BOTTOM: medium none; mso-border-top-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 0mm 0mm 0mm;"><p><font face="Times New Roman">&nbsp;</font></p></p></div><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Sub </font>画点编程<font face="Times New Roman">081007()</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Dim startPoint(0 To 2) As Double</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Dim OjtPoint As AcadPoint</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">'Dim ptStart As Variant</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">'Dim ptEnd As Variant</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Dim ptStart(0 To 2) As Double</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Dim ptEnd(0 To 2) As Double</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">ptStart(0) = 0 ''40''X</font>值</p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">ptStart(1) = 100 ''Y</font>值</p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">ptStart(2) = 0 '400'''Z</font>值</p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Dim ptStUcs As Variant</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">ptStUcs = PtUcs2Wcs(ptStart)</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">Set OjtPoint = ThisDrawing.ModelSpace.AddPoint(ptStUcs)</font></p><p class="MsoNormal" style="MARGIN: 0mm 0mm 0pt;"><font face="Times New Roman">End Sub</font></p><div style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0mm; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 0mm; PADDING-BOTTOM: 0mm; BORDER-LEFT: medium none; PADDING-TOP: 1pt; BORDER-BOTTOM: medium none; mso-element: para-border-div; mso-border-top-alt: solid windowtext .5pt;"><p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0mm; BORDER-TOP: medium none; PADDING-LEFT: 0mm; PADDING-BOTTOM: 0mm; MARGIN: 0mm 0mm 0pt; BORDER-LEFT: medium none; PADDING-TOP: 0mm; BORDER-BOTTOM: medium none; mso-border-top-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 0mm 0mm 0mm;"><p><font face="Times New Roman">&nbsp;</font></p></p></div>
页: [1]
查看完整版本: 求助