Помогите пожалуйста связать AcadText с блоком чтоб он вставлялся и был гибким. Я попытался но у меня не выходит пришлось сделать разными объектами ну меня так не устраивает. Посоветуйте как можно решить эту проблему
Sub draw_svetoor_M()
Dim nomer As String
Dim a As String
a = InputBox("Номер маневрового светофора: ", "Исходные данные:")
nomer = "світлофор М" & a
Dim insert_point As Variant
Dim rotate As Double
insert_point = ThisDrawing.Utility.GetPoint(, "X,Y светофора: ")
rotate = ThisDrawing.Utility.GetAngle(insert_point, vbCr & "угол поворота: ")
Dim manevroviy As AcadBlock
Dim manevroviy_point(2) As Double
manevroviy_point(0) = 0#: manevroviy_point(1) = 0#: _
manevroviy_point(2) = 0#
Set manevroviy = ThisDrawing.Blocks.Add(manevroviy_point, nomer)
Dim korpus As AcadLWPolyline
Dim korpus_point(7) As Double
korpus_point(0) = 1.5: korpus_point(1) = -0.5
korpus_point(2) = 0: korpus_point(3) = -0.5
korpus_point(4) = 0: korpus_point(5) = 0.5
korpus_point(6) = 1.5: korpus_point(7) = 0.5
Set korpus = manevroviy.AddLightWeightPolyline(korpus_point)
Dim krishka As AcadArc
Dim krishka_center(2) As Double
Dim krishka_radius As Double
Dim krishka_start As Double
Dim krishka_end As Double
krishka_center(0) = 1.5: krishka_center(1) = 0#: _
krishka_center(2) = 0#
krishka_radius = 0.5
krishka_start = 4.71238898
krishka_end = 1.570796327
Set krishka = manevroviy.AddArc(krishka_center, krishka_radius, krishka_start, krishka_end)
Dim hatch_linz_1 As AcadHatch
Dim linz_1patternName As String
Dim linz_1PatternType As Long
Dim linz_13bAssociativity As Boolean
linz_1patternName = "SOLID"
linz_1PatternType = acHatchPatternTypePreDefined
linz_1bAssociativity = True
Set hatch_linz_1 = manevroviy.AddHatch(linz_1PatternType, linz_1patternName, linz_1bAssociativity)
hatch_linz_1.Color = acWhite
Dim linz_1(0 To 0) As AcadEntity
Dim linz1_center(0 To 2) As Double
Dim linz1_radius As Double
linz1_center(0) = 0.5: linz1_center(1) = 0#: _
linz1_center(2) = 0#
linz1_radius = 0.08
Set linz_1(0) = manevroviy.AddCircle(linz1_center, linz1_radius)
hatch_linz_1.AppendOuterLoop (linz_1)
hatch_linz_1.Evaluate
ThisDrawing.Regen True
Dim hatch_linz_2 As AcadHatch
Dim linz_2patternName As String
Dim linz_2PatternType As Long
Dim linz_23bAssociativity As Boolean
linz_2patternName = "SOLID"
linz_2PatternType = acHatchPatternTypePreDefined
linz_2bAssociativity = True
Set hatch_linz_2 = manevroviy.AddHatch(linz_2PatternType, linz_2patternName, linz_2bAssociativity)
hatch_linz_2.Color = acWhite
Dim linz_2(0 To 0) As AcadEntity
Dim linz2_center(0 To 2) As Double
Dim linz2_radius As Double
linz2_center(0) = 1.5: linz2_center(1) = 0#: _
linz2_center(2) = 0#
linz2_radius = 0.08
Set linz_2(0) = manevroviy.AddCircle(linz2_center, linz2_radius)
hatch_linz_2.AppendOuterLoop (linz_2)
hatch_linz_2.Evaluate
ThisDrawing.Regen True
Dim name As AcadText
Dim name_point(2) As Double
Dim tip As String
Dim height As Double
Select Case rotate
Case Is >= 4.71238898
Select Case Val(a)
Case Is < 10
name_point(0) = insert_point(0) - 4.4: name_point(1) = insert_point(1) - 0.8: _
name_point(2) = 0#:
tip = "M" & a
height = 1.6
Case Is <= 100
name_point(0) = insert_point(0) - 6: name_point(1) = insert_point(1) - 0.8: _
name_point(2) = 0#:
tip = "M" & a
height = 1.6
Case Is >= 100
name_point(0) = insert_point(0) - 7.6: name_point(1) = insert_point(1) - 0.8: _
name_point(2) = 0#:
tip = "M" & a
height = 1.6
End Select
Set name = ThisDrawing.ModelSpace.AddText(tip, name_point, height)
name.ObliqueAngle = 0.436332313
name.rotate insert_point, rotate
Case 1.570796327 To 4.71238898
Select Case Val(a)
Case Is < 10
name_point(0) = insert_point(0) + 1.25: name_point(1) = insert_point(1) - 0.8: _
name_point(2) = 0#:
tip = "M" & a
height = 1.6
Case Is <= 100
name_point(0) = insert_point(0) + 1.25: name_point(1) = insert_point(1) - 0.8: _
name_point(2) = 0#:
tip = "M" & a
height = 1.6
Case Is >= 100
name_point(0) = insert_point(0) + 1.25: name_point(1) = insert_point(1) - 0.8: _
name_point(2) = 0#:
tip = "M" & a
height = 1.6
End Select
Set name = ThisDrawing.ModelSpace.AddText(tip, name_point, height)
name.ObliqueAngle = 0.436332313
name.rotate insert_point, rotate - 3.141592654
Case 0 To 1.570796327
Select Case Val(a)
Case Is < 10
name_point(0) = insert_point(0) - 4.4: name_point(1) = insert_point(1) - 0.8: _
name_point(2) = 0#:
tip = "M" & a
height = 1.6
Case Is <= 100
name_point(0) = insert_point(0) - 6: name_point(1) = insert_point(1) - 0.8: _
name_point(2) = 0#:
tip = "M" & a
height = 1.6
Case Is >= 100
name_point(0) = insert_point(0) - 7.6: name_point(1) = insert_point(1) - 0.8: _
name_point(2) = 0#:
tip = "M" & a
height = 1.6
End Select
Set name = ThisDrawing.ModelSpace.AddText(tip, name_point, height)
name.ObliqueAngle = 0.436332313
name.rotate insert_point, rotate
End Select
Dim manevroviy_ref As AcadBlockReference
Set manevroviy_ref = ThisDrawing.ModelSpace.InsertBlock(insert_point, nomer, 1#, 1#, 1#, rotate)
End Sub