Page 1 of 1

Font attribute

Posted: Mon Mar 21, 2005 12:36 pm
by Julian
When dealing with selection sets, is there any way of accessing the font attribute of a Text object.

For eg:
Dim iText As IntelliCAD.Text
iText.Font = "stencil"
iText.Update

I am unable to locate the "font" attribute. Is this called something else, or maybe an attribute of some other object which must be co-joined with the iText object?

This is accessable using the DDEDIT function so I imagine there must be a way of accessing this attribute.

Anyone have an answer?

Posted: Mon Mar 21, 2005 11:28 pm
by ssc
Julian,

I believe you have to set the font via the styles property. Example

Dim oText As IntelliCAD.Text
Dim otemp As IntelliCAD.TextStyle
Dim oStyle As IntelliCAD.TextStyle
Dim oStyles As IntelliCAD.TextStyles
Dim bThere As Boolean

Set oStyles = ThisDocument.TextStyles
For Each otemp In oStyles
'\\Test to see if the style name exists
If LCase(otemp.Name) = "stencil" Then
Set oStyle = otemp
bThere = True
Exit For
End If
Next otemp
If bThere = False Then
'\\style name does not exist create it
Set oStyle = oStyles.Add("Stencil")
oStyle.FontFile = "RomanS"
End If

ThisDocument.Utility.GetEntity oText, vPnt, "pick text"
oText.StyleName = "Stencil"

Is this what you were looking for?

ssc

Posted: Tue Mar 22, 2005 11:27 am
by Julian
That looks just about it!. I did some experimenting and got it down to the following simple code:

'Set the font for the text
Set iDoc = IntelliCAD.ActiveDocument
iDoc.ActiveTextStyle.FontFile = "stencil"

This I include in the

For Each ent In objSS
'Some code
Next

loop. (I actually assign the font from a ComboBox containing all the fonts we use on the maps and plans we generate)

For interest, the reason I am doing this is that some of our commercial software produces masses of text with differing Justifications. When this is the case, the DDEDIT function does not work completely : for eg the Height attribute is inoperative.

So I have written a routine which selects all the elements on the screen and extracts the text and places the text onto a seperate layer. Then I use the second macro to interrogate this text and change any of the attributes I require. All part of our mapping routines. Grand fun and saves the operator hours of toil and sweat.

Many thanks - needed a different eye to look at it!

[This message has been edited by Julian (edited 03-22-2005).]

[This message has been edited by Julian (edited 03-22-2005).]