I can find the textprofile string in the sheetmetal document but I cannot change the string because that the textprofile.text is readonly
How can I change the string ???????
Dim seTextProfiles AsTextProfiles
Dim seTextProfile AsTextProfile
seProfileSets = seDoc.ProfileSets
seSketchs = seDoc.Sketches
ForEach seSketch In seSketchs
seProfiles = seSketch.Profiles
ForEach seProfile In seProfiles
seDrawingObjects = seProfile.DrawingObjects
ForEach seDrawingObject In seDrawingObjects
seTextProfile = seDrawingObject
MsgBox("found one: " & seTextProfile.Text) 'seTextProfile.Text is readonly !!!!!
Catch ex AsException
This appears to have been asked in couple of context earlier:
In both cases, it has hit a dead-end.
The most logical answer is something like "SE holds these as line elememts rather than a text string"
But Jason seems to have some clues here, so I am watching this space.
If there is no way to edit the string value Is it possible to delete the text profile and create a new one, using VB.NET ? I didn’t see the option textprofiles.add
I think I would submit this one to GTAC. What I find interesting is DrawingObjects.Count = 1 but if you try to access DrawingObjects.Item(1), you get an "Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER))". I'll keep looking at it but I'm not seeing anything helpful at the moment.
I am able to verify Jason's findings at my end though I do not have any MP applied, just a demo license.
I further explored this (invalid pointer) is encountered with just Text Profiles and not with any others like line, circle, etc.
Also the Text Profile need not be the first item in the DrawingObjects collection, a null pointer is returned even when it is the second or subsequent place in the order.
The same is true for a Text Profile in a Part document.
Meanwhile, if you are thinking about deleting and re-drawing the text profile, putting it into a SelctSet and then using the Delete method would be a good option.
To recreate, you may want to first capture some imortant properties of the TextProfile like, font, size and the actual text. This in turn can be stored in a delimited StringAttribute using AttributeSets.Add. Most Solid Edge entities that are visible provide the Attribute Set facility.
And you can always use IsAttributeSetPresent to first check if the object is the one you are looking for.
This is quite a challenge but you would have fun beating it as I had, though I did it for custom objects and its sad to see you having do it for a SE intrinsic object.
See \Solid Edge STx\Custom\DynAttrib for more info on AttributeSets.