alwsu666 发表于 2004-9-8 14:06:00

VBA中的几点问题向大侠请教

1).vb60中的相对路径app.path在CAD2004的VBA中怎么不能用,如果要达到类示效果应该怎么做。


2).CAD2004的VBA中image的click事件怎么不能用。


3).怎样在VBA中刷新坐标


4).在图形中修改原点或坐标后所编的VBA程序却不认应该怎么做。


我用的是autocad2004中文版

bluelover 发表于 2004-9-8 15:38:00

第一个问题:用application.path

雪山飞狐_lzh 发表于 2004-9-8 17:52:00

1、看看VBE对象模型


3、设置对象的坐标属性


4、看看你的代码?

alwsu666 发表于 2004-9-9 15:24:00

1).application.path的格式怎么写


3). 我是在窗体中需要改变ucs坐标,但我用sendcommand方法程序执行完后才改变啦坐标,我需要中途改变。


4).如画一条线, 程序在窗体里


Private Sub CommandButton1_Click()


dim ptst(0 to 2)        as double


dim pten(0 to 2) as double


ptst(0)=0:ptst(1)=0:ptst(2)=0


pten(0)=10:pten(1)=10:pten(2)=0


thisdrawing.modelspace.addline ptst,pten


End Sub


我再回到cad中改变ucs坐标再运行刚才的程序哪条直线却还是画在原来的位置


应该怎样让直线随着坐标的变动而变动。

雪山飞狐_lzh 发表于 2004-9-9 15:28:00

<P class=body>You define a UCS to change the location of the (0, 0, 0) origin point and the orientation of the XY plane and the Z axis. You can locate and orient a UCS anywhere in 3D space, and you can define as many UCSs as you require.
<P class=body>All coordinates in ActiveX Automation are entered in the world coordinate system (WCS). Use the <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_getucsmatrix.htm" target="_blank" >GetUCSMatrix</A> method to return the transformation matrix of a given UCS. Use this transformation matrix to find the equivalent WCS coordinates.
<P class=body>Use the <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_ucsiconon.htm" target="_blank" >UCSIconOn</A> property to turn the UCS icon on or off for a given viewport.
<P class=body>To make a UCS active, use the <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_activeucs.htm" target="_blank" >ActiveUCS</A> property on the Document object. If changes are made to the active UCS, the new UCS object must be reset as the active UCS for the changes to appear. To reset the active UCS, simply call the ActiveUCS property again with the updated UCS object.
<P class=body>To add a new UCS to the drawing, use the <A href="mk:@MSITStore:D:\Program%20Files\AutoCAD%202005\help\acadauto.chm::/idh_add.htm" target="_blank" >Add</A> method off the UCSs Collection. To edit or query an existing UCS, use the following methods and properties:

雪山飞狐_lzh 发表于 2004-9-9 15:30:00

另外,VBA的坐标只对应WCS坐标


要在UCS中画图用下列函数转换坐标


RetVal = object.TranslateCoordinates(OriginalPoint, From, To, Disp[, OCSNormal])

alwsu666 发表于 2004-9-10 11:35:00

谢谢。
页: [1]
查看完整版本: VBA中的几点问题向大侠请教