The Extruded Solid Along a Path

You use the AddExtrudedSolidAlongPath method to create a new 3DSolid object that represents the extrusion of a closed planar region along a given path. This path may take the form of a polyline, spline, circle, ellipse, or arc. The new solid is extruded from the current location of the region using the translation of the path to the region's Centroid.

Set 3DSolidObject = Object.AddExtrudedSolidAlongPath(Region, Path)

Table 9-10 presents the AddExtrudedSolidAlongPath method's parameters, and Figure 9-10 shows an example of an extruded solid along a path.

Table 9-10. The AddExtrudedSolidAlongPath Method's Parameters

Name

Data Type

Description

Region

Region object

A closed planar region to be extruded.

Path

Polyline, Spline, Circle,

The path along which the plane region is to be

Ellipse, or Arc object

extruded. This path can't lie in the same plane as the

region to be extruded.

Region o

Solid extruded along path

Figure 9-10. An extruded solid along a path

Figure 9-10. An extruded solid along a path

As with the extruded solid, the newly created object may not intersect itself. Therefore, you should avoid self-intersecting paths or those with sections of high curvature.

The following example extrudes a circular region into a solid along the path of a spline specified by the user:

Public Sub TestAddExtrudedSolidAlongPath() Dim objPath As AcadSpline Dim varPick As Variant Dim intI As Integer Dim dblCenter(2) As Double Dim dblRadius As Double Dim objCircle As AcadCircle Dim objEnts() As AcadEntity Dim objShape As Acad3DSolid Dim varRegions As Variant Dim varItem As Variant

'' set default viewpoint

SetViewpoint

'' pick path and calculate shape points

With ThisDrawing.Utility

'' pick the path On Error Resume Next

.GetEntity objPath, varPick, "Pick a Spline for the path" If Err Then

MsgBox "You did not pick a spline" Exit Sub End If objPath.Color = acGreen

dblCenter(intI) = objPath.FitPoints(intI)

Next

.InitializeUserInput 1 + 2 + 4

dblRadius = .GetDistance(dblCenter, vbCr & "Indicate the radius: ") End With

'' draw the circular region, then extrude along path With ThisDrawing.ModelSpace

'' draw the outer region (circle) ReDim objEnts(0)

Set objCircle = .AddCircle(dblCenter, dblRadius)

objCircle.Normal = objPath.StartTangent

Set objEnts(0) = objCircle

'' create the region varRegions = .AddRegion(objEnts)

Set objShape = .AddExtrudedSolidAlongPath(varRegions(0), objPath) objShape.Color = acRed End With

'' 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

+1 0

Post a comment