The Wedge

The AddWedge method creates a wedge with edges parallel to the WCS axes.

Set 3DSolidObject = Object.AddWedge(FaceCenter, Length, Width, Height)

Table 9-6 presents the AddWedge method's parameters, and Figure 9-6 shows an example of a wedge in AutoCAD.

Table 9-6. The AddWedge Method's Parameters

Name

Data Type

Description

FaceCenter4

Variant

A three-element array of doubles specifying the bounding box's center in WCS coordinates. This corresponds to the sloping face's center as well.

Length

Double

A positive value representing the wedge base's length (X-axis).

Width

Double

A positive value representing the wedge base's width (Y-axis).

Height

Double

A positive value representing the wedge base's height (Z-axis).

Auto Cad Vba Acad3dsolid

This example creates a wedge based on user input:

Public Sub TestAddWedge()

Dim varPick As Variant Dim dblLength As Double Dim dblWidth As Double Dim dblHeight As Double Dim dblCenter(2) As Double Dim objEnt As Acad3DSolid

'' set the default viewpoint SetViewpoint

'' get input from user With ThisDrawing.Utility .InitializeUserInput 1

varPick = .GetPoint(, vbCr & "Pick a base corner point: ") .InitializeUserInput 1 + 2 + 4, ""

dblLength = .GetDistance(varPick, vbCr & "Enter the base X length: ") .InitializeUserInput 1 + 2 + 4, ""

dblWidth = .GetDistance(varPick, vbCr & "Enter the base Y width: ") .InitializeUserInput 1 + 2 + 4, ""

dblHeight = .GetDistance(varPick, vbCr & "Enter the base Z height: ") End With

'' calculate center point from input dblCenter(0) = varPick(0) + (dblLength / 2)

'' draw the entity

Set objEnt = ThisDrawing.ModelSpace.AddWedge(dblCenter, dblLength, dblWidth, dblHeight)

objEnt.Update

ThisDrawing.SendCommand "_shade" & vbCr End Sub

Was this article helpful?

0 0

Post a comment