25 | 03 | 2017

Extrude Polyline

Before creating a solid 3d object we have to start of with creating a 2d closed polyline, circle, square etc. From here we can start the extrude command and create the 3d object.

 

Sub CreateExtrusionObjects()

'****************************************
'*** Code from VisibleVisual.com ********
'****************************************

Dim Points(0 To 11) As Double
Dim Pline As AcadLWPolyline
Dim aEntity(0) As AcadEntity

'1.Create a 2d closed object. This could be anything as long as its a closed figure.
Points(0) = 0: Points(1) = 0
Points(2) = 0: Points(3) = 100
Points(4) = 50: Points(5) = 150
Points(6) = 100: Points(7) = 100
Points(8) = 100: Points(9) = 0
Points(10) = 0: Points(11) = 0

Set Pline = ThisDrawing.ModelSpace.AddLightWeightPolyline(Points())
Set aEntity(0) = Pline

'2.Create a region from the polylines
Dim regionObj As Variant
regionObj = ThisDrawing.ModelSpace.AddRegion(aEntity)

'Extrusion Details
Dim height As Double
Dim taperAngle As Double
height = 100
taperAngle = 0

'3.Create the extrusion
Dim solidObj As Acad3DSolid
Set solidObj = ThisDrawing.ModelSpace.AddExtrudedSolid(regionObj(0), height, taperAngle)

ZoomAll
End Sub


 
The result is shown below:
 
extrudeobject
 

 

Login

Sign up now and upload your code to the website.

Help us to continue.....
Statistics
Articles View Hits
2208303
Latest Articles