|
|
发表于 2019-5-6 19:37:41
|
显示全部楼层
来自: 中国北京
以下内容译自 AutoCAD 帮助>资源>开发人员文档>ActiveX: Reference Guide(ActiveX:参考指南)>Methods(方法)>AddCylinder Method (ActiveX)(AddCylinder方法(ActiveX))
- t% b/ @$ S7 V" q$ \: u- Sub Example_AddCylinder()( Y% q( L- M" s* V/ S4 {8 [; [
- ' 此示例在模型空间中创建一个圆柱体。, F, Z& H1 E* _8 K
-
0 n4 e9 w! Q1 l8 |8 p7 l - Dim CylinderObj As Acad3DSolid, T C+ m4 g9 h* c5 S& W
- Dim Radius As Double
4 ?8 \! K4 E+ S- M" |. }( h - Dim Center(0 To 2) As Double- }; B8 N% n) ]& i
- Dim Height As Double6 F' T; h& c1 I9 `$ F* M
- 3 N7 Z& E+ g& F# ^8 h8 s
- ' 定义圆柱体
- w# a3 Z6 z1 N) N6 R' z! v5 L' t - Center(0) = 0#: Center(1) = 0#: Center(2) = 0#/ @4 d5 V7 l1 E+ r4 R# F* f* }
- Radius = 5#5 R0 }$ b" {" L7 k
- Height = 20#$ J' {) l5 k+ g# P0 z
- % n7 X9 _& M* x: |. s+ \4 k
- ' 在模型空间中创建圆柱体(3dsolid)对象
* D a6 s5 G8 L6 M; t9 y - Set CylinderObj = ThisDrawing.ModelSpace.AddCylinder(Center, Radius, Height)
# J4 n8 A+ ~. z! J# ^ -
4 @5 P/ ]) |" m4 z7 l8 L - ' 更改视口的观察方向以更好地查看圆柱体
; T; G/ r7 O) R( I$ h - Dim NewDirection(0 To 2) As Double
2 R, T( d3 Q3 g) s# S8 | - NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1) B5 v% ?" L. n! g8 A7 ?
- ThisDrawing.ActiveViewport.Direction = NewDirection, O) ^1 _0 W1 A" |: w* O- L1 c
- ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport/ P) }2 t' k% U0 \
- ZoomAll
$ E( a2 V" J& W1 v# i* C) F& h: [ - End Sub
复制代码
4 b7 f5 C; x0 v
3 P7 K7 S5 `1 d$ x" b J- D
, O& q2 U, ?- k- O! @' }- Z' X |
评分
-
查看全部评分
|