Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: Create Text element with text and Data fields

$
0
0

Hi John,

[quote user="John Drsek"]this is in MicroStation SS4 in VBA[/quote]

In such case the code should be similar to this one:

Option Explicit

Public Sub CreateTextWithEDF()

    Dim textOrigin As Point3d
    textOrigin = Point3dFromXYZ(0, 0, 0)
    
    Dim textRotation As Matrix3d
    textRotation = Matrix3dIdentity

    Dim textContent As String
    ' A text length has to include EDF places
    textContent = "FOR DETAILS SEE PAGE    and   ."
    
    Dim te As TextElement
    Set te = CreateTextElement1(Nothing, textContent, textOrigin, textRotation)
    
    Dim der As DataEntryRegion
    der.Justification = msdDataEntryRegionJustificationLeft
    der.Length = 2
    der.StartPosition = 22
    
    te.AddDataEntryRegion der
    
    der.Justification = msdDataEntryRegionJustificationLeft
    der.Length = 2
    der.StartPosition = 29
    
    te.AddDataEntryRegion der

    ActiveModelReference.AddElement te

End Sub

[quote user="John Drsek"]how to get text then data field then text after that[/quote]

Be aware that despite of the method is .AdDataEntryRegion, it works in the "define what already existing characters will be treated as EDF" and the text element length is not changed. So you have to create long enough text upfront (e.g. with spaces or maybe underscores).

With regards,

  Jan


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>