|
发表于 2019-5-8 20:33:40
|
显示全部楼层
来自: 中国北京
以下内容译自 AutoCAD 帮助>资源>开发人员文档>ActiveX: Reference Guide(ActiveX:参考指南)>Methods(方法)>AddBox Method (ActiveX)(AddBox方法(ActiveX)),其中长方体的长、宽、高参数有修改
2 w7 Y: M1 d( y; j! L4 h- Sub Example_AddBox()
; @( f; [" Z: x1 Q9 k - ' 此示例在模型空间中创建一个长方体。
$ j% g' H8 c* Y9 Q; k' d& w. H - 4 ^% {* F7 O4 l: J D- N
- Dim BoxObj As Acad3DSolid
@5 P8 c/ Z9 u5 m - Dim Length As Double, Width As Double, Height As Double" u2 m; x* g) q3 b3 x
- Dim Center(0 To 2) As Double
& Q/ Z/ t, |+ E - 4 J& o1 I. l/ ]1 u- m" W1 h$ q& b
- ' 定义长方体* C. z% F* ?6 U3 G$ I+ @& S! B
- Center(0) = 5#: Center(1) = 5#: Center(2) = 0, d0 @! v7 u7 v3 [" ]& Y7 M" p
- Length = 100#: Width = 50#: Height = 120#
- G5 T8 z4 p# j5 b& \3 P -
" l1 Y; z+ X; { - ' 在模型空间中创建长方体(3dsolid)对象
7 ~) `" Q; O5 U' e - Set BoxObj = ThisDrawing.ModelSpace.AddBox(Center, Length, Width, Height)
" D& N$ t, F. t+ e - * H2 |* ~6 m. o1 l9 x
- ' 更改视口的观察方向以更好地查看长方体6 C) m0 M0 J0 K8 p
- Dim NewDirection(0 To 2) As Double" j4 G7 p* T, {) p' u& S
- NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 14 M) }6 u- f. J/ ~
- ThisDrawing.ActiveViewport.Direction = NewDirection* V, b2 R2 {; A: }
- ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport: D3 q5 D; Z, X3 d% K0 k
- ZoomAll
- K! S3 f! g; \ - 5 [* m- ~) ~ @: a9 N
- End Sub
复制代码
0 ?: Z# D& [6 f8 N" W4 i
7 \+ N# r' w& h5 o) W, i' P2 {) e) U6 }) m0 }4 W% O+ [. I
|
评分
-
查看全部评分
|