官方说法是VBA6的发布授权已经结束,AutoDesk 只能继续发布AutoCAD 2014及以后的支持VBA7.1的版本。
搜了下,之前的虽然不公开,但是链接仍然能找到。
AutoCad VBA 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 enabler
Below you find the links to enable AutoCad vba from 2010 to 2016.
AutoCAD 2010 VBA module 32-bit (exe - 91158Kb) | |
AutoCAD 2010 VBA module 64-bit (exe - 91433Kb) | |
AutoCAD 2011 VBA module 32-bit (exe - 72064Kb) | |
AutoCAD 2011 VBA module 64-bit (exe - 72304Kb) | |
AutoCAD 2012 VBA module 32-bit (exe - 123941Kb) | |
AutoCAD 2012 VBA module 64-bit (exe - 123991Kb) | |
AutoCAD 2013 VBA module 32-bit (exe - 126868Kb) | |
AutoCAD 2013 VBA module 64-bit (exe - 127134Kb) | |
AutoCAD 2014 VBA module 32-bit (exe - 68236Kb) | |
AutoCAD 2014 VBA module 64-bit (exe - 108797Kb) |
AutoCAD 2015 VBA module 32-bit (exe - 67570Kb) | |
AutoCAD 2015 VBA module 64-bit (exe - 107720Kb) |
AutoCAD 2016 VBA module 32-bit (exe - 70206Kb) | |
AutoCAD 2016 VBA module 64-bit (exe - 110828Kb) |
AutoCAD 2017 VBA module 32-bit (exe - 70400Kb) | |
AutoCAD 2017 VBA module 64-bit (exe - 110000Kb) |
Links are copied from the Autodesk website. check the full articlehere:
How To Manipulate ACAD 3D Shapes Via VBA Language
hi everybody.
I need to manipulate 3D shapes (eg. cubes, cylinders, cones) by using VBA code. for instance: I have a rope that I drew in ACAD 3D on a vertical position (90° from the x axis, 0° from y axis). I need to make this rope 10°, 20°, 30°, etc... from the y axis via VBA code. How can I do it in ACAD/VBA? Do you have any book to recommend me? I'd appreciate your help.
Sub Example_ArrayPolar()
' This example creates a circle and then performs a polar array
' on that circle.
' Create the box
Dim boxobj As Acad3DSolid
Dim center(0 To 2) As Double
Dim wid As Double
center(0) = 2#: center(1) = 2#: center(2) = 0#
wid = 0.5
Set boxobj = ThisDrawing.ModelSpace.AddBox(center, wid, wid, wid)
ZoomAll
MsgBox "Perform the polar array on the circle.", , "ArrayPolar Example"
' Define the polar array
Dim noOfObjects As Integer
Dim angleToFill As Double
Dim basePnt(0 To 2) As Double
noOfObjects = 35
angleToFill = 3.14 * 2# ' 360 degrees
basePnt(0) = 3#: basePnt(1) = 3#: basePnt(2) = 0#
' The following example will create 35 copies of an object
' by rotating and copying it about the point (3,3,0).
Dim retObj As Variant
retObj = boxobj.ArrayPolar(noOfObjects, angleToFill, basePnt)
ZoomAll
MsgBox "Polar array completed.", , "ArrayPolar Example"
End Sub
Option Explicit
Sub Example_Draw3dSolids()
' This example creates a polyline in model space.
Dim plineObj As AcadLWPolyline
Dim points(0 To 7) As Double
' ' Define the 2D polyline points
points(0) = 0#: points(1) = 0#
points(2) = 7.5: points(3) = 0#
points(4) = 7.5: points(5) = 2.5
points(6) = 0#: points(7) = 2.5
Dim curves(0 To 0) As AcadEntity
' Create a lightweight Polyline object in model space
Set curves(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
curves(0).Closed = True
curves(0).SetBulge 1, 1#
Dim conepts(0 To 7) As Double
Dim bigRad As Double, smallRad As Double, height As Double
bigRad = 6.5: smallRad = 1.25: height = 60#
conepts(0) = 0#: conepts(1) = 0#
conepts(2) = 0#: conepts(3) = conepts(1) - height
conepts(4) = conepts(0) + smallRad: conepts(5) = conepts(3)
conepts(6) = conepts(0) + bigRad: conepts(7) = 0#
Dim conecurves(0 To 0) As AcadEntity
' Create a lightweight Polyline object in model space
Set conecurves(0) = ThisDrawing.ModelSpace.AddLightWeightPolyline(conepts)
conecurves(0).Closed = True
' Define the rotation axis
Dim axisPt(0 To 2) As Double
Dim axisDir(0 To 2) As Double
Dim angle As Double
axisPt(0) = 0#: axisPt(1) = 0#: axisPt(2) = 0#
axisDir(0) = 0#: axisDir(1) = 1#: axisDir(2) = 0#
angle = 6.28
' Create the regions
Dim regionObj1 As Variant, regionObj2 As Variant
regionObj1 = ThisDrawing.ModelSpace.AddRegion(curves)
regionObj2 = ThisDrawing.ModelSpace.AddRegion(conecurves)
' Create the solids
Dim solidObj1 As Acad3DSolid
Set solidObj1 = ThisDrawing.ModelSpace.AddRevolvedSolid(regionObj1(0), axisPt, axisDir, angle)
Dim solidObj2 As Acad3DSolid
Set solidObj2 = ThisDrawing.ModelSpace.AddRevolvedSolid(regionObj2(0), axisPt, axisDir, angle)
' Union 2 solids
solidObj1.Boolean acUnion, solidObj2
regionObj1(0).Delete
regionObj2(0).Delete
curves(0).Delete
conecurves(0).Delete
Dim center(0 To 2) As Double
' Define the array center
center(0) = 0#: center(1) = -height - 80#: center(2) = 0#
' Add polar array
solidObj1.ArrayPolar 35, 6.28, center
ZoomAll
MsgBox "Solid Array created.", , "Draw3dSolids"
End Sub