你的问题的答案可能会有所不同,这取决于你计划在日常生活中做什么。
确定圆柱体方向的最常用方法是:
- Sub OrientCylinder()
- Dim SolidObject As Acad3DSolid
- Dim CylinderCenter(0 To 2) As Double
- Dim Radius As Double
- Dim Height As Double
- Dim dblAngle As Double
- Dim dblPivot(0 To 2) As Double
- Radius = 10#
- Height = 100#
- dblAngle = 2 * Atn(1) '90 degrees
- dblPivot(0) = CylinderCenter(0) + 1# 'the flat ends of the cylinder are parallel to XZ
- Set SolidObject = ThisDrawing.ModelSpace.AddCylinder(CylinderCenter, Radius, Height)
- SolidObject.Rotate3D CylinderCenter, dblPivot, dblAngle
- End Sub
对于更具交互性的内容(即,您希望用户选择一个点,并根据当前UCS创建圆柱体),您必须使用以下组合。GetUCSMatrix和。通过方法转换。
另一种情况可能是,您有许多线,可能是桁架系统的线框,您希望将管状构件与之对齐。最好通过以下方式解决该问题:
设置3DSolidObject=Object。AddExtrudedSolidAlongPath(轮廓,路径) |