|
发表于 2024-2-8 18:18:18
|
显示全部楼层
Sub creatEndRect()/ A5 o U+ Q* R8 T& Z
* r. p6 P# {* N- J
Dim line2 As AcadLine# |5 y* {# Y. K4 n8 z
ThisDrawing.Utility.GetEntity line2, basePnt, "Select an line:"
% ~$ W, p* E& l- n8 [ 2 L. v4 |. f4 D7 x) F0 G+ E- W8 Z
Dim p1
7 [4 W! Q/ H; v$ ]1 |0 } p1 = line2.startPoint; \* O C" d9 ^
Dim p2
. h0 T" ~5 Y: @ p2 = line2.endPoint
9 Q7 K/ M. [+ c T* M
- e9 Q" D& {7 |- h6 }) ]+ O3 v J Dim angle2 As Double
6 d0 i J4 t- X a# C+ y angle2 = line2.angle1 @3 Q: h7 v/ F r; q, T
4 t9 W8 W. x9 T6 U: \9 _ Dim pts1(0 To 7) As Double0 X) ]/ l9 V% k5 X2 `+ u
Dim pts2(0 To 7) As Double* j T' O; \8 {
- `. j+ }( R: @( [2 s pts1(0) = CDbl(p1(0)) + 0.5 * Sin(angle2): pts1(1) = CDbl(p1(1)) - 0.5 * Cos(angle2)& L5 e1 B- Z+ g& X9 s1 [1 t2 x% ] x
pts1(2) = pts1(0) + 5 * Cos(angle2): pts1(3) = pts1(1) + 5 * Sin(angle2)
$ l L9 @, C% q: T: g- B( [ pts1(4) = pts1(2) - 1 * Sin(angle2): pts1(5) = pts1(3) + 1 * Cos(angle2)
' Q% O6 Z4 K+ n* ~. | pts1(6) = pts1(4) - 5 * Cos(angle2): pts1(7) = pts1(5) - 5 * Sin(angle2)! d, K, P6 K" W. A9 P1 A
6 L5 @$ W U- V% G) l( ^
pts2(0) = CDbl(p2(0)) + 0.5 * Sin(angle2): pts2(1) = CDbl(p2(1)) - 0.5 * Cos(angle2): P& @+ h5 X. o
pts2(2) = pts2(0) - 5 * Cos(angle2): pts2(3) = pts2(1) - 5 * Sin(angle2)
# b0 T) L$ {( [ pts2(4) = pts2(2) - 1 * Sin(angle2): pts2(5) = pts2(3) + 1 * Cos(angle2) |" a: |9 s, J# P- E/ f
pts2(6) = pts2(4) + 5 * Cos(angle2): pts2(7) = pts2(5) + 5 * Sin(angle2)! j/ m) h/ l8 i$ N( P/ p( d
) N9 [8 @& i# \( k
Dim pl0 As AcadLWPolyline2 O1 n1 R; n" F5 d4 x6 @
Set pl0 = ThisDrawing.ModelSpace.AddLightWeightPolyline(pts1)$ q3 V$ A& q+ N* Y1 F
Dim pl1 As AcadLWPolyline
- x; r/ _$ r1 O6 h. a- S+ ` Set pl1 = ThisDrawing.ModelSpace.AddLightWeightPolyline(pts2)+ F |+ q+ Z( j6 S
2 q; T2 Q0 d J6 z* c" y6 ^! B pl0.Closed = True! G1 p! N/ i/ a2 H
pl1.Closed = True% f" T# c8 Z/ J5 }6 S, e
+ _5 `6 q# @: I0 `
End Sub |
|