ADN Club > VBA

Выноска MLeader

<< < (2/3) > >>

Александр Ривилис:

--- Цитата: Vladimir от 16-05-2015, 22:11:01 ---(vba)
--- Конец цитаты ---
А причем здесь VBA? Этот раздел как называется?
В ActiveX/COM модели AutoCAD (и соотвественно в VBA) у MLeader нет свойства TextLocation.

Vladimir:
Не хотел создавать похожую тему...
Если возможно изменить смещение выноски на vba, то я создам новую тему В ActiveX/COM модели AutoCAD (и соотвественно в VBA)
Если нет, то поставлю точку.

Александр Ривилис:
В VBA для MLeader есть свойство TextJustify. Пример из документации:

--- Код - Visual Basic [Выбрать] ---Sub Example_TextManipulation()    Dim oML As AcadMLeader    Dim points(0 To 14) As Double     ' Define the leader points    points(0) = 1: points(1) = 1: points(2) = 0    points(3) = 1: points(4) = 2: points(5) = 0    points(6) = 2: points(7) = 2: points(8) = 0    points(9) = 3: points(10) = 2: points(11) = 0    points(12) = 4: points(13) = 4: points(14) = 0    Dim i As Long    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)        oML.TextLeftAttachmentType = acAttachmentBottomLine    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom    oML.TextBackgroundFill = False    oML.TextDirection = acLeftToRight    oML.TextHeight = 2.3    oML.TextJustify = acAttachmentPointMiddleLeft    oML.TextLineSpacingDistance = 2.4    oML.TextLineSpacingFactor = 1.2    oML.TextLineSpacingStyle = acLineSpacingStyleExactly    oML.TextWidth = 7.4 End Sub
Варианты значений TextJustify: http://help.autodesk.com/cloudhelp/2016/ENU/AutoCAD-ActiveX/files/GUID-FB4F61A2-86F9-4174-8B4B-29E8DF255CE7.htm

Vladimir:
В моем случае свойство TextJustify работает на выравнивание текста, на полке выноски, по лев.\прав.\центр
эксперементировал с выноской созданой кадом и смотрел в Watches на свойства см. скриншот







Текст выноски всегда находится с лева от выноски.
Мне нужно управлять расположением текста относительно самой выноски

Александр Ривилис:
Похоже это единственное, чего можно добиться:



Управляется при помощи метода MLeader.SetDoglegDirection:


--- Код - Visual Basic [Выбрать] ---Sub MLeader_TextDirection()    Dim oML As AcadMLeader    Dim points(0 To 5) As Double    points(0) = 0: points(1) = 0: points(2) = 0    points(3) = 10: points(4) = 20: points(5) = 0    Dim i As Long    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)    oML.TextString = "12345"    oML.TextLeftAttachmentType = acAttachmentMiddle    oML.TextRightAttachmentType = acAttachmentMiddle    oML.TextBackgroundFill = False    oML.TextDirection = acLeftToRight    oML.TextHeight = 2.3    oML.TextJustify = acAttachmentPointMiddleCenter    oML.TextLineSpacingDistance = 2.4    oML.TextLineSpacingFactor = 1.2    oML.TextLineSpacingStyle = acLineSpacingStyleExactly    oML.TextWidth = 7.4    oML.DogLegged = True    oML.DoglegLength = 1.3    ' Управляем тем, с какой стороны будет текст    Dim vector(2) As Double    vector(0) = -1 ' 1 - текст справа, -1 - текст слева    oML.SetDoglegDirection 0, vectorEnd Sub

Навигация

[0] Главная страница сообщений

[#] Следующая страница

[*] Предыдущая страница

Перейти к полной версии