ÔÆÌ⺣ - רҵÎÄÕ·¶ÀýÎĵµ×ÊÁÏ·ÖÏíÆ½Ì¨

µ±Ç°Î»ÖãºÊ×Ò³ > CAD - VBAÀý×Ó

CAD - VBAÀý×Ó

  • 62 ´ÎÔĶÁ
  • 3 ´ÎÏÂÔØ
  • 2026/4/27 22:32:28

ThisDrawing.ModelSpace.AddLightWeightPolyline(Pnts)

StrLineType = \ LLineColor = 3

MyPln.LineType = StrLineType MyPln.color = LLineColor '¿í¶ÈÉ趨

MyPln.SetWidth 0, DLineWidth, DLineWidth

Case \

Pns = ExpObj(J).Coordinates ExpObj(J).Delete

ThisDrawing.ModelSpace.AddPoint (Pns) Case Else

ExpObj(J).Delete 'ÆäËûÈçÎÄ×Ö¡¢µã²»ÔÙ½øÐд¦Àí End Select Next End If

'²»ÊÇ¿éµÄ²»´¦Àí

Next End Sub

16¡¢ÔËÐкê

¡®¡¯¡¯-vbarun Sub hong()

ThisDrawing.Application.RunMacro \End Sub

VBϵÄAutoCAD×Ô¶¯»¯

Ò»¡¢¸ÅÄî

×Ô¶¯»¯¼¼ÊõÔÊÐíÒ»¸öÓ¦ÓóÌÐòÇý¶¯ÁíÍâÒ»¸ö³ÌÐò¡£Çý¶¯³ÌÐò±»³ÆÎª×Ô¶¯»¯¿Í»§£¬ÁíÒ»¸öΪ×Ô¶¯»¯·þÎñÆ÷¡£

VB»·¾³ÏµÄAutoCAD×Ô¶¯»¯¾ÍÊÇÖ¸ÓÃVBÇý¶¯ºÍ²Ù×ÝAutoCAD¡£VBΪ×Ô¶¯»¯¿Í»§

¶Ë£¬AutoCADΪ×Ô¶¯»¯·þÎñÆ÷¡£

³ÌÐò½çÃæ

**********************³ÌÐòÔ´´úÂë***************************

Dim nn As Integer Dim RS As Recordset

Private Sub CommandButton1_Click() Dim I As Integer

Const PDBCN As String = \

Set PCN = New ADODB.Connection Set RS = New ADODB.Recordset

PCN.Open PDBCN + \and Settings\\yb.LH\\×ÀÃæ\\ÒÆ¶¯ÄâºÏ·¨ÄÚ²å\\data1.mdb\

RS.Open \ Set Me.Adodc1.Recordset = RS ' Me.DataGrid1.DataSource = RS nn = RS.RecordCount

If RS.RecordCount > 0 Then MSFlexGrid1.Rows = RS.RecordCount + 1 Else Exit Sub

Me.MSFlexGrid1.ColWidth(0) = 500 Me.MSFlexGrid1.ColAlignment(0) = 3 For I = 1 To 3

Me.MSFlexGrid1.ColWidth(I) = 2500 Me.MSFlexGrid1.ColAlignment(I) = 3 Next

Me.MSFlexGrid1.TextMatrix(0, 0) = \µãºÅ\ Me.MSFlexGrid1.TextMatrix(0, 1) = \ Me.MSFlexGrid1.TextMatrix(0, 2) = \ Me.MSFlexGrid1.TextMatrix(0, 3) = \

RS.MoveFirst I = 0

Do While Not RS.EOF I = I + 1

Me.MSFlexGrid1.TextMatrix(I, 0) = RS.Fields(\ Me.MSFlexGrid1.TextMatrix(I, 1) = RS.Fields(\ Me.MSFlexGrid1.TextMatrix(I, 2) = RS.Fields(\ Me.MSFlexGrid1.TextMatrix(I, 3) = RS.Fields(\ RS.MoveNext Loop ' RS.Close

CommandButton2_Click End Sub

Private Sub CommandButton2_Click() Dim meshObj As AcadPolygonMesh Dim mSize, nSize, count As Integer

'Create the matrix of points ' For I = 0 To nn

mSize = Int(Sqr(nn) - 1): nSize = Int(Sqr(nn) - 1) ReDim points(mSize * nSize * 3 - 1) As Double

If RS.RecordCount > 0 Then RS.MoveFirst For I = 0 To mSize - 1 For J = 0 To nSize - 1

points((I * nSize + J) * 3) = I: points((I * nSize + J) * 3 + 1) = J: points((I * nSize + J) * 3 + 2) = RS.Fields(\ RS.MoveNext Next Next

'creates a 3Dmesh in model space

Set meshObj = ThisDrawing.ModelSpace.Add3DMesh(mSize, nSize, points) 'Change the viewing direction of the viewport to better see the polygonmesh Dim NewDirection(0 To 2) As Double

NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1 ThisDrawing.ActiveViewport.Direction = NewDirection

ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport ZoomAll End Sub

Private Sub CommandButton3_Click()

ThisDrawing.SendCommand Chr(27) + Chr(27) ThisDrawing.SendCommand \ ThisDrawing.Regen acActiveViewport End Sub

Private Sub CommandButton4_Click()

ThisDrawing.SendCommand Chr(27) + Chr(27) ThisDrawing.SendCommand \ ThisDrawing.Regen acActiveViewport End Sub

Private Sub CommandButton5_Click() Unload Me End Sub

**********************³ÌÐòÔ´´úÂë***************************

ËÑË÷¸ü¶à¹ØÓÚ£º CAD - VBAÀý×Ó µÄÎĵµ
  • ÊÕ²Ø
  • Î¥¹æ¾Ù±¨
  • °æÈ¨ÈÏÁì
ÏÂÔØÎĵµ10.00 Ôª ¼ÓÈëVIPÃâ·ÑÏÂÔØ
ÍÆ¼öÏÂÔØ
±¾ÎÄ×÷Õߣº...

¹²·ÖÏí92ƪÏà¹ØÎĵµ

Îĵµ¼ò½é£º

ThisDrawing.ModelSpace.AddLightWeightPolyline(Pnts) StrLineType = \ LLineColor = 3 MyPln.LineType = StrLineType MyPln.color = LLineColor '¿í¶ÈÉ趨 MyPln.SetWidth 0, DLineWidth, DLineWidth

¡Á ÓοͿì½ÝÏÂÔØÍ¨µÀ£¨ÏÂÔØºó¿ÉÒÔ×ÔÓɸ´ÖƺÍÅŰ棩
µ¥Æª¸¶·ÑÏÂÔØ
ÏÞÊ±ÌØ¼Û£º10 Ôª/·Ý Ô­¼Û:20Ôª
VIP°üÔÂÏÂÔØ
ÌØ¼Û£º29 Ôª/Ô ԭ¼Û:99Ôª
µÍÖÁ 0.3 Ôª/·Ý ÿÔÂÏÂÔØ150·Ý
ȫվÄÚÈÝÃâ·Ñ×ÔÓɸ´ÖÆ
VIP°üÔÂÏÂÔØ
ÌØ¼Û£º29 Ôª/Ô ԭ¼Û:99Ôª
µÍÖÁ 0.3 Ôª/·Ý ÿÔÂÏÂÔØ150·Ý
ȫվÄÚÈÝÃâ·Ñ×ÔÓɸ´ÖÆ
×¢£ºÏÂÔØÎĵµÓпÉÄÜ¡°Ö»ÓÐĿ¼»òÕßÄÚÈݲ»È«¡±µÈÇé¿ö£¬ÇëÏÂÔØÖ®Ç°×¢Òâ±æ±ð£¬Èç¹ûÄúÒѸ¶·ÑÇÒÎÞ·¨ÏÂÔØ»òÄÚÈÝÓÐÎÊÌ⣬ÇëÁªÏµÎÒÃÇЭÖúÄã´¦Àí¡£
΢ÐÅ£ºfanwen365 QQ£º370150219
Copyright © ÔÆÌ⺣ All Rights Reserved. ËÕICP±¸16052595ºÅ-3 ÍøÕ¾µØÍ¼ ¿Í·þQQ£º370150219 ÓÊÏ䣺370150219@qq.com