Change string value of textprofil​e in the sheetmetal document using VB.NET

Solution Partner Creator Solution Partner Creator
Solution Partner Creator

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

Try

seTextProfile = seDrawingObject

MsgBox("found one: " & seTextProfile.Text) 'seTextProfile.Text is readonly !!!!!

Catch ex AsException

EndTry

Next

...

6 REPLIES

Re: Change string value of textprofil​e in the sheetmetal document using VB.NET

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

If you'll upload a sample .psm with a text profile, I'll look at it.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Change string value of textprofil​e in the sheetmetal document using VB.NET

Phenom
Phenom

This appears to have been asked in couple of context earlier:

 

http://community.plm.automation.siemens.com/t5/Solid-Edge-Developer-Forum/Editing-a-Text-Profile/m-p...

and

http://community.plm.automation.siemens.com/t5/Solid-Edge-Developer-Forum/Changing-Sketch-s-Text/m-p...

 

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.

 

Regards,

 

Re: Change string value of textprofil​e in the sheetmetal document using VB.NET

Solution Partner Creator Solution Partner Creator
Solution Partner Creator

Attached a psm file and VB CODE

 

Thanks

Re: Change string value of textprofil​e in the sheetmetal document using VB.NET

Solution Partner Creator Solution Partner Creator
Solution Partner Creator

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

Re: Change string value of textprofil​e in the sheetmetal document using VB.NET

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

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.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Change string value of textprofil​e in the sheetmetal document using VB.NET

Phenom
Phenom

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.

 

Regards,