creating a textstyletablerecord

creating a textstyletablerecord

Anonymous
Not applicable
990 Views
4 Replies
Message 1 of 5

creating a textstyletablerecord

Anonymous
Not applicable
Hello,
I am trying to create a new text style with ARX called "SIMPLEX".
Here is my code: AcDbTextStyleTableRecord *pTSRec; pTSRec = new AcDbTextStyleTableRecord(); stat = pTSRec->setName("SIMPLEX"); stat = pTSRec->setFileName("C:\\PROGRAM FILES\\AUTOCAD 2002\\SUPPORT\\SIMPLEX.shx"); stat = pTSRec->setBigFontFileName("C:\\PROGRAM FILES\\AUTOCAD 2002\\SUPPORT\\SIMPLEX.shx");
stat = pTSRec->setXScale(1.0);
stat = pTSRec->setTextSize(0.125);
pTSRec->setIsShapeFile(Adesk::kTrue);
AcDbTextStyleTable *pTextStyleTable;
stat =currDocData.pCurrentDB-> getSymbolTable(pTextStyleTable,AcDb::kForWrite); AcDbObjectId simplexId; if (stat == Acad::eOk){ stat = pTextStyleTable->add(simplexId,pTSRec); } pTextStyleTable->close();

I know that getting the current database pointer scheme I am using works because I use it to add a pline to this same drawing with it. It seems like I am setting way more things than I should have to, but I kept setting more stuff when it would not work. I tried setting the file names without the full path first. How do I know it does not work? I use the text style dialog box to verify that the new style is not there. After I do this code I am making 3 new mtext entities and adding them to the data base. I set them with the simplexID objectId. When I look in the drawing, they do not appear, but when I do a do a list of ALL the entities in the drawing, they are listed out. That is how I got onto the textsyletablerecord problem. I thought that the fact that the Simplex style is not created, but that I had set the mtexts with it was the reason that they were not drawn on the screen, even though they were successfully added to the data base.
Also, to let you know, I have also tried to create with isShapeFile set as not true. Neither way works.

Thank you,

rlarxman
0 Likes
991 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Hi,

do you close your pTSRec?
0 Likes
Message 3 of 5

Anonymous
Not applicable
Thanks for your response. Good question. The answer is that no, I was not closing pTSRec. Unfortunately, when I did try closing it the results were the same. I still do not get the new style into the drawing. I still get the new mtext entities added to the drawing database so that they are listed with "LIST ALL", but they are not visible. I do add a pline entity to the same drawing earlier, and it is visible.
I thought I would send the whole source file this time. Just to give you a head start on it, the program gets invoked in one drawing, then it looks for another open blank drawing. If it finds a blank drawing then it goes ahead with the program which starts by drawing in a closed pline border to match the outline of a block in the original drawing. Then it copies over the attributes and text from the block in the original drawing as mtext to the new drawing. Right now I only have the code to copy over the centered attributes. When I have this debugged I will copy over everything else.

The attached file is the .cpp but I had to rename the extension to send it.
0 Likes
Message 4 of 5

Anonymous
Not applicable
I have done a little more research on this. I verified that the textstyletablerecord is getting added to the database-- but that the dxf 2 code (name) is "". So, essentially there is a new text style added, but I cant use it because it has no name. This is despite the fact that I use the setName function and get an eOk back from it. I checked the textstyletablerecord by getting the handle for it after I added it in the ARX program. Then I used the lisp entget and handent functions. So I got an entity data listing for the textstyletablerecord. It all looked good except that the record had a blank name.
Now here is something weirder-- the mtexts that I add to the new drawing are now showing up. They are visible, but they are using another existing text style. They are not using the simplex text style. There is an existing text style called STANDARD that they are using. This is despite the fact that I set them with the simplexId before I add them to the database.
I feel I am on that undocumented foggy fringe of ARX where some things work and some don't, and you just have to feel your way around. Hopefully someone else has already been there.
0 Likes
Message 5 of 5

Anonymous
Not applicable
On further review it looks like I have solved my problem-- atleast most of it. There was an error message in Autocad on the text page that was telling me that simplex was not a Big Font file. I was setting it as though it was. When I stopped setting the Big Font file, the mtexts appeared, and with the new Simplex style. The only problem is that in the Text Style Dialog box the new simplex style still does not appear. That doesnt really stop me from doing what I want to do with the program, but it is a little odd.

Thanks for your help. Looks like I am OK now.
0 Likes