|
Sub creatEndRect()" d4 J. w; J0 {8 ^2 m C! X, W: q, B
8 W( Q+ G, Y* M5 z* r Dim line2 As AcadLine
9 W5 k0 o" q8 h ThisDrawing.Utility.GetEntity line2, basePnt, "Select an line:"
' W: P Z- v2 z/ l/ e, `) {6 ? - S, K7 i2 F$ T3 L, X! ~& v
Dim p1) W# W* x6 Q5 [
p1 = line2.startPoint
v* x" u# K! @ G1 O3 ^' q Dim p2
: M" N5 u1 I( ~8 i+ j8 H p2 = line2.endPoint
& |, K9 `& X9 @; F6 d1 Z3 C 6 ?2 [) b4 N. [ y0 w
Dim angle2 As Double" P- a8 [: p3 |9 f/ G( d4 I8 `% [
angle2 = line2.angle8 G' O) g. }* w7 y, s o
5 ?4 _/ R9 j* L$ T/ C! `1 {4 b
Dim pts1(0 To 7) As Double8 j* b7 F0 l6 m) {! O% \+ v q4 Y. p
Dim pts2(0 To 7) As Double
+ Q# I9 T0 J7 }! v! c/ U, v, C+ o
( }8 J1 c* ? w G+ ^ pts1(0) = CDbl(p1(0)) + 0.5 * Sin(angle2): pts1(1) = CDbl(p1(1)) - 0.5 * Cos(angle2)8 c: U2 @0 T* R) H X3 y
pts1(2) = pts1(0) + 5 * Cos(angle2): pts1(3) = pts1(1) + 5 * Sin(angle2)( M- z) [5 P! H6 a; N
pts1(4) = pts1(2) - 1 * Sin(angle2): pts1(5) = pts1(3) + 1 * Cos(angle2)
6 V5 {5 b! x2 u* T$ t; i- | pts1(6) = pts1(4) - 5 * Cos(angle2): pts1(7) = pts1(5) - 5 * Sin(angle2)- U3 V9 W$ k( A4 S# R' M! D) C
' E& ]! K' i' G+ A0 [2 \
pts2(0) = CDbl(p2(0)) + 0.5 * Sin(angle2): pts2(1) = CDbl(p2(1)) - 0.5 * Cos(angle2)
( j }- H I: i: v) M pts2(2) = pts2(0) - 5 * Cos(angle2): pts2(3) = pts2(1) - 5 * Sin(angle2)8 \5 V( O6 E! @
pts2(4) = pts2(2) - 1 * Sin(angle2): pts2(5) = pts2(3) + 1 * Cos(angle2)" E5 }7 u0 u" p9 G
pts2(6) = pts2(4) + 5 * Cos(angle2): pts2(7) = pts2(5) + 5 * Sin(angle2)# _8 n! ?+ \- M3 ~1 y% a
8 S$ l: X- I' i Dim pl0 As AcadLWPolyline
* S z1 m5 @& ~# U. i Set pl0 = ThisDrawing.ModelSpace.AddLightWeightPolyline(pts1)
, E$ L5 U( P/ T9 S: e Dim pl1 As AcadLWPolyline: X- |; Y+ v, Z9 u' c
Set pl1 = ThisDrawing.ModelSpace.AddLightWeightPolyline(pts2)
* M& S3 J |! y n) b& _1 O
- b) s' `% Y: }0 I6 k pl0.Closed = True
3 M4 _2 b8 { l( F& j8 J% ]& N1 ~) ~ pl1.Closed = True
& O( C y% e8 r% q4 ^8 l+ t: ^0 Y) V' M, A
End Sub |
|