Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Articles

Extrusion - AutoCAD VBA

Extrusion - AutoCAD VBA

Hi, I'm very new to AutoCAD VBA programming. I have made some code to draw a flat polyline using coordinates, now i want to extrude it by a text box value. I was looking for the download section to see how this works but cant seem to see it at all... any help would be massively appreciated. Iain

Private Sub CommandButton1_Click()
Me.Hide
Dim varCenter(0 To 2) As Double
Dim dblRadius As Double
Dim dblHeight As Double
Dim dblTaper As Double
Dim strInput As String
Dim varRegions As Variant
Dim objEnts() As AcadEntity
Dim objEnt As Acad3DSolid
Dim varItem As Variant
Dim rad As Integer
Dim height As Integer
On Error Resume Next
''values from text boxes
rad = TextBox1.Text
height = TextBox2.Text
'' define center point
varCenter(0) = 0: varCenter(1) = 0: varCenter(2) = 0
'' draw the entities
With ThisDrawing.ModelSpace
'' draw the outer region (circle)
ReDim objEnts(0)
Set objEnts(0) = .AddCircle(varCenter, rad) ' radius
'' create the region
varRegions = .AddRegion(objEnts)
'' extrude the solid
Set objEnt = .AddExtrudedSolid(varRegions(0), height, 0) '10 extrude height and 0 taper angle
'' update the extruded solid
objEnt.Update
End With

If Err Then MsgBox Err.Description
'' delete the temporary geometry
For Each varItem In objEnts
varItem.Delete
Next
For Each varItem In varRegions
varItem.Delete
Next
ThisDrawing.SendCommand "_shade" & vbCr
End Sub

caa October 25 2023 137 reads 0 comments Print

0 comments

Leave a Comment

Please Login to Post a Comment.
  • No Comments have been Posted.

Sign In
Not a member yet? Click here to register.
Forgot Password?