tiancao1001 于 2008-07-19 01:15 PM 发表评论: |
|
查看所评论的日志:CAD VBA 也能画出这样的样条曲线spirograph万花尺螺旋曲线 |
hgh 于 2008-07-18 08:15 PM 发表评论: |
|
查看所评论的日志:CAD VBA DVB文件加密和解密 |
tiancao1001 于 2008-07-17 09:03 PM 发表评论: |
Private Sub CommandButton2_Click() Dim i As Long Dim n As Integer Dim Pi As Double Pi = 4# * Atn(1#) Dim R As Long Randomize R = Int(Rnd * 100) Dim R1 As Long R1 = (0.5 - Rnd) * 199 Dim L As Long L = Int(Rnd * 200) Dim S As Long S = Int(Rnd * 50) Dim M As Long M = Int(Rnd * 100) Dim A1 As Double Dim A2 As Double Dim P(2) As Double Dim P0(2) As Double Dim x As Double Dim y As Double Dim Fit() As Double Dim Sp As AcadSpline ReDim Fit(2) i = i + 1 n = n + 1 A1 = i * Pi / 180 A2 = (R1 / R) * A1 x = (-(R1 - R) * Cos(A1) - S * Cos(A2 - A1) + 100) * M y = ((R1 - R) * Sin(A1) - S * Sin(A2 - A1) + 100) * M P0(0) = x: P0(1) = y Fit(0) = x: Fit(1) = y: Fit(2) = 0 'ThisDrawing.ModelSpace.AddPoint P0 Do DoEvents i = i + 1 n = n + 1 ReDim Preserve Fit(n * 3 - 1) A1 = i * Pi / 180 A2 = (R1 / R) * A1 x = (-(R1 - R) * Cos(A1) - S * Cos(A2 - A1) + 100) * M y = ((R1 - R) * Sin(A1) - S * Sin(A2 - A1) + 100) * M P(0) = x: P(1) = y Fit(n * 3 - 3) = x: Fit(n * 3 - 2) = y: Fit(n * 3 - 1) = 0 If n = 359 Then Set Sp = ThisDrawing.ModelSpace.AddSpline(Fit, Point3D(0, 0, 0), Point3D(0, 0, 0)) Randomize 'Sp.color = Int(Rnd * 255) n = 0 End If If Abs(P(0) - P0(0)) < 10 ^ -2 And Abs(P(1) - P0(1)) < 10 ^ -2 Then Exit Do 'If i > 10 ^ 4 Then Exit Do Loop MsgBox "R=" & R & "/ R1=" & R1 & "/ L=" & L Prompt "R=" & R & "/ R1=" & R1 & "/ L=" & L & "/ S=" & S & vbCrLf End End Sub |
|
查看所评论的日志:CAD VBA 也能画出这样的样条曲线spirograph万花尺螺旋曲线 |
田草 于 2008-07-17 11:48 AM 发表评论: |
<SCRIPT type=text/javascript> var tips1;var tips2; var zh_theTop = 180/*这是默认高度*/; var old = zh_theTop; function initFloatTips() { tips1 = document.getElementById('adleft'); tips2 = document.getElementById('adright'); moveTips(); };
var zh_pos; function moveTips() { var tt=50; if (window.innerHeight) { zh_pos = window.pageYOffset } else if (document.documentElement && document.documentElement.scrollTop) { zh_pos = document.documentElement.scrollTop } else if (document.body) { zh_pos = document.body.scrollTop; } zh_pos=zh_pos-tips1.offsetTop+zh_theTop; zh_pos=tips1.offsetTop+zh_pos/5; if (zh_pos < zh_theTop) zh_pos = zh_theTop; if (zh_pos != old) { tips1.style.top = zh_pos+"px"; tips2.style.top = zh_pos+"px"; tt=10; } old = zh_pos; setTimeout(moveTips,tt); } initFloatTips() ; </SCRIPT>
<DIV id=adleft style="RIGHT: 2px; LINE-HEIGHT: 150%; POSITION: absolute; TOP: 150px; left: 910px; float:right"> <TABLE cellSpacing=0 cellPadding=0 width=100 border=0> <TBODY> <TR> <TD vAlign=top height=108> <TABLE cellSpacing=0 cellPadding=0 width=93 border=0> <TBODY> <TR> <TD width=107><EMBED src='EccoolAda.swf' wmode='transparent' quality=high WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=EccoolAd></EMBED></TD> </TR> </TBODY> </TABLE> </TD> </TR> </TBODY> </TABLE> </DIV> <DIV id=adright style="LEFT: 1px; LINE-HEIGHT: 150%; POSITION: absolute; TOP: 150px"> <TABLE cellSpacing=0 cellPadding=0 width=100 border=0> <TBODY> <TR> <TD vAlign=top height=108> <TABLE cellSpacing=0 cellPadding=0 width=97 border=0> <TBODY> <TR> <TD colSpan=6 height=93><EMBED src='EccoolAdb.swf' wmode='transparent' quality=high WIDTH=100 HEIGHT=300 TYPE='application/x-shockwave-flash' id=EccoolAd></EMBED></TD> </TR> </TBODY> </TABLE> </TD> </TR> </TBODY> </TABLE> </DIV> |
|
查看所评论的日志:支持IE、Firefox、Opera的对联广告(来自网易) |
田草 于 2008-07-17 10:22 AM 发表评论: |
Function ImportWMF(P As String) '输入文件 If Dir(P) <> "" Then '判断文件是否存在 ThisDrawing.Import P, Point3D(0, 0, 0), 2 Else Prompt "程序使用的临时文件不存在,请重新运行程序!" Exit Function End If End Function |
|
查看所评论的日志:CAD VBA 输出WMF文件 和导入WMF文件 |
tiancao1001 于 2008-07-16 02:58 PM 发表评论: |
Sub DeleteMenu() '读取有那些菜单 Dim i As Integer Dim i1 As Integer Dim i2 As Integer Dim index() As Long Dim DataString As String Set FSO = CreateObject("Scripting.FileSystemObject") Set FSO_File = FSO.OpenTextFile(GetPath & "menu.txt", ForReading, True) Do While Not FSO_File.AtEndOfStream DataString = FSO_File.ReadLine i = inStr_n(DataString, ",", index) If i = 0 Then i1 = Val(DataString) ElseIf i = 1 Then DataString = Left(DataString, Len(DataString) - 1) For Each TG In ThisDrawing.Application.MenuGroups For Each T In TG.Toolbars If T.Name = DataString Then T.Delete i2 = i2 + 1 If i2 = i1 Then Exit Do End If Next Next End If Loop FSO_File.Close End Sub |
|
查看所评论的日志:ACAD vba CreateMenu2.0 自动生成CAD工具栏 |
tiancao1001 于 2008-07-15 05:31 PM 发表评论: |
'样条曲线转化为直线(针对上面函数转化后的样条曲线) Sub SPlineToLine() Dim E As AcadEntity Dim L As AcadLine Dim SP As AcadSpline Dim StartP As Variant Dim EndP As Variant For Each E In ThisDrawing.ModelSpace 'DoEvents 'ThisDrawing.Utility.Prompt E.ObjectName If E.ObjectName = "AcDbSpline" Then Set SP = E StartP = SP.GetFitPoint(0) EndP = SP.GetFitPoint(2) Set L = ThisDrawing.ModelSpace.AddLine(StartP, EndP) L.Layer = SP.Layer L.color = SP.color SP.Delete End If Next E End Sub |
|
查看所评论的日志:VBA将所有的直线转换成样条曲线 |
田草 于 2008-07-15 08:54 AM 发表评论: |
'创建匿名块 Function NiMingKuai(S As String) As String Dim blockObj As AcadBlock Dim n As Long NiMingKuai = S & "_0" Block: For Each blockObj In ThisDrawing.Blocks If blockObj.Name = NiMingKuai Then NiMingKuai = S & "_" & CStr(n) Prompt NiMingKuai n = n + 1 GoTo Block End If Next blockObj End Function |
|
查看所评论的日志:Auto CAD vba 怎样 创建匿名块 |