|
|
发表于 2019-5-6 19:37:41
|
显示全部楼层
来自: 中国北京
以下内容译自 AutoCAD 帮助>资源>开发人员文档>ActiveX: Reference Guide(ActiveX:参考指南)>Methods(方法)>AddCylinder Method (ActiveX)(AddCylinder方法(ActiveX))/ x5 I; ~! [# S0 X# C0 H
- Sub Example_AddCylinder()5 L4 M5 a: z: M
- ' 此示例在模型空间中创建一个圆柱体。
& U7 K! ~* J+ ?: I i, e - 0 m! Q" P; S9 u) r1 M7 X
- Dim CylinderObj As Acad3DSolid$ t. W1 V. @1 ?- w0 p
- Dim Radius As Double4 B" n- c. O$ B0 N5 {
- Dim Center(0 To 2) As Double/ B) z4 p" G6 o2 i
- Dim Height As Double
; c: }8 f1 k- R/ d) i9 A -
, U+ H* Z, g. e9 B/ c. }" f - ' 定义圆柱体- M" Q: e0 v& q/ n
- Center(0) = 0#: Center(1) = 0#: Center(2) = 0#
* t* v. B, q7 V4 o9 i0 U- ` - Radius = 5#$ t# ?7 E) R, h
- Height = 20#1 y) o) Z0 Y o% Z
- / S/ I2 N7 {, g5 k5 H% R: C q
- ' 在模型空间中创建圆柱体(3dsolid)对象
3 [ C: E5 U4 Y- u - Set CylinderObj = ThisDrawing.ModelSpace.AddCylinder(Center, Radius, Height)# G0 i1 s% h2 _1 v8 M3 G
- $ e x: p, y$ n" D$ Y$ f: V
- ' 更改视口的观察方向以更好地查看圆柱体' Y4 ?3 }- x# \6 l
- Dim NewDirection(0 To 2) As Double
' C) g; P4 B& `: `8 F3 C& I. L, i - NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1" ?$ F% t0 M! |: O) W
- ThisDrawing.ActiveViewport.Direction = NewDirection
" W; t( b3 ~4 e0 O - ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport* J! E# e5 E$ P
- ZoomAll
1 K# e0 S* a! x. S' j - End Sub
复制代码 6 }, r, ]" v3 i8 I
. C' M/ ~3 w: v; _
' C6 H/ M; ] i+ C- S2 f8 h- D8 @ |
评分
-
查看全部评分
|