|
Sub creatEndRect()
+ g- ~# `6 ]: a+ q( ], p
6 f0 a5 |9 D1 Y; n Dim line2 As AcadLine
0 t$ Z+ Y& b. d$ h ThisDrawing.Utility.GetEntity line2, basePnt, "Select an line:"3 `) s1 {# q: C% ?
4 y+ O' X3 j7 x3 [6 X Dim p1
* K; Z$ T( ` k( p9 n# t' P p1 = line2.startPoint
- m. @! F' I6 Y1 } Dim p2
% P7 D' y6 Z, x( c% R0 [ p2 = line2.endPoint
' p$ R4 {5 }8 n6 I : d- O6 R1 L7 I7 x
Dim angle2 As Double
' Z) L3 A8 ]. R$ K angle2 = line2.angle+ p4 b( t8 J I& q6 h ]
, U, i Z0 Q* x" e7 J3 L8 w( Z Dim pts1(0 To 7) As Double* W6 U$ ?; o: F' [ t) P
Dim pts2(0 To 7) As Double/ \. g! n) |. d4 c/ s
5 z' o% c8 p1 h2 T1 s+ ]
pts1(0) = CDbl(p1(0)) + 0.5 * Sin(angle2): pts1(1) = CDbl(p1(1)) - 0.5 * Cos(angle2)( p# G( d j6 _ j1 }! I) b
pts1(2) = pts1(0) + 5 * Cos(angle2): pts1(3) = pts1(1) + 5 * Sin(angle2)
) ]) z. ]- v+ F pts1(4) = pts1(2) - 1 * Sin(angle2): pts1(5) = pts1(3) + 1 * Cos(angle2)$ ?- o4 F1 d, j
pts1(6) = pts1(4) - 5 * Cos(angle2): pts1(7) = pts1(5) - 5 * Sin(angle2): k! ~" g# j [# h7 |3 u- [
; i/ [* U5 G- z3 R0 \% e
pts2(0) = CDbl(p2(0)) + 0.5 * Sin(angle2): pts2(1) = CDbl(p2(1)) - 0.5 * Cos(angle2)
& ^! P6 b# h0 C# { pts2(2) = pts2(0) - 5 * Cos(angle2): pts2(3) = pts2(1) - 5 * Sin(angle2); z4 R/ a9 a# {9 s( B
pts2(4) = pts2(2) - 1 * Sin(angle2): pts2(5) = pts2(3) + 1 * Cos(angle2)( e; u/ i" J0 ?- D) J [1 x
pts2(6) = pts2(4) + 5 * Cos(angle2): pts2(7) = pts2(5) + 5 * Sin(angle2)
; L3 B3 c" K+ n
. j, _8 U7 T/ X3 E. T( R6 G Dim pl0 As AcadLWPolyline
3 V& q6 ^# W; M8 |/ B$ ?+ Y: C Set pl0 = ThisDrawing.ModelSpace.AddLightWeightPolyline(pts1)
9 M8 N0 F* |" n, D Dim pl1 As AcadLWPolyline
+ I8 h, z6 U+ q Set pl1 = ThisDrawing.ModelSpace.AddLightWeightPolyline(pts2)3 B9 D F1 W. X8 q/ K
^' y" Y- B; o1 o
pl0.Closed = True
3 v P/ s* i2 V5 |4 C! B pl1.Closed = True8 Q! M& ]1 {; r% p: \2 M
2 S# C2 Z' w- mEnd Sub |
|