Specifying text size when inserting text with GetPoint ()

Specifying text size when inserting text with GetPoint ()

Anonymous
Not applicable
206 Views
1 Reply
Message 1 of 2

Specifying text size when inserting text with GetPoint ()

Anonymous
Not applicable
I insert text with the following code to insert text using the GetPoint() command:
Dim textObj As AcadText
Dim textString As String
Dim returnPnt1 As Variant
Dim height As Double
' Return a point using a prompt
returnPnt1 = ThisDrawing.Utility.GetPoint(, "Enter a point: ")
' Define the text object
textString = "Place object here"

height = 50


' Create the text object in model space
Set textObj = ThisDrawing.ModelSpace.AddText(textString, returnPnt1, height)

That works well but I'm trying to get the user to specify the text height in the command box not write it in the code as I have done above.
All help is appreciated.
0 Likes
207 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
might i suggest you add..

 

dim drawing as variant

if thisdrawing.getvar("tilemode") = 0 and
thisdrawing.getvar("cvport") = 1 then

set drawing = thisdrawing.paperspace

else

set drawing = thisdrawing.modelspace

end if

 

that way if the user wants to use your code while
in paperspace then he/she can

 

 

Dim textObj As
AcadText
    Dim textString As String

    Dim returnPnt1 As Variant

    Dim height As Double

     ' Return a point using a prompt

    returnPnt1 = ThisDrawing.Utility.GetPoint(, "Enter a
point: ")
    ' Define the text object

    textString = "Place object here"

height = thisdrawing.utitlty.getreal(prompt here)


' Create the text object in model space
    Set
textObj = ThisDrawing.ModelSpace.AddText(textString, returnPnt1, height)



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
 
0 Likes