Jon, thanks for the helpful reply... I have something that is sort of working... but as I stated I am a novice.
I am in v8i 8.11.09.832
My 2 remaining problems with the following code...
1) I am trying to store the current text style, and then write the text node based on the style of the selected text object. My code is honoring the active settings instead of the selected text elements settings.
2)I realize my organization probably really stinks,
but the 2nd half of my code is meant to basically redo the 1st half. Basically I am trying to set the "view independent" variable through the property handler. View independent is read only for text nodes so I am trying to change it through a back door method. the second half creates a new element enumerator that finds all of the text nodes that i just created... then i try to change the color (this is just a test... eventually i will want to be able to change view dependent, but i thought color would be easier to test.) my code errors out when it gets to the setvalue line. I have seen some stuff online with some if/then functions... Im jsut having troruble with the syntax of the property handler.
Thoughts?
Thanks
Troy
Option Explicit
Sub Test()
Dim ee As ElementEnumerator
Dim es As ElementScanCriteria
Dim elArray() As Element
Dim iStart As Integer
Dim iEnd As Integer
Dim i As Integer
Dim startPoint As Point3d
Dim point As Point3d
Dim style As TextStyle
Set style = ActiveSettings.TextStyle
Set es = New ElementScanCriteria
es.ExcludeAllTypes
es.IncludeType msdElementTypeText
Set ee = ActiveModelReference.Scan(es)
elArray = ee.BuildArrayFromContents
iStart = LBound(elArray)
iEnd = UBound(elArray)
For i = iStart To iEnd
Dim oText As TextElement
Set oText = elArray(i).AsTextElement
Set ActiveSettings.TextStyle = oText.TextStyle
Dim oNode As TextNodeElement
Set oNode = CreateTextNodeElement1(oText, oText.Origin, Matrix3dIdentity)
oNode.AddTextLine oText.Text
ActiveModelReference.AddElement oNode
ActiveModelReference.RemoveElement oText
Next
Set ActiveSettings.TextStyle = style
Dim newee As ElementEnumerator
Dim newes As ElementScanCriteria
Dim newelArray() As Element
Dim jStart As Integer
Dim jEnd As Integer
Dim j As Integer
Dim newstartPoint As Point3d
Dim newpoint As Point3d
Set newes = New ElementScanCriteria
newes.ExcludeAllTypes
newes.IncludeType msdElementTypeTextNode
Set newee = ActiveModelReference.Scan(newes)
newelArray = newee.BuildArrayFromContents
jStart = LBound(newelArray)
jEnd = UBound(newelArray)
For j = jStart To jEnd
Dim ph As PropertyHandler
Dim accessStrings() As String
Dim newnode As TextNodeElement
Set newnode = newelArray(j).AsTextNodeElement
Set ph = CreatePropertyHandler(newnode)
accessStrings = ph.GetAccessStrings
ph.SelectByAccessString ("Color")
ph.SetValue "3"
Next
CommandState.StartDefaultCommand
End Sub