• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 827
  • Last Modified:

AutoCAD ARX, MS C++ 6 and type troubles...

Hi all!

I'm writing an AutoCAD ARX module in MS VC++ v6;
I'm creating a TEXT object like this:
acdbText pTheText;
....
pTheText->.......

the most important thing here is that my text pointer is
of type acdbText or something like that....
..also I need to call a function acutTextBox I think was the name, which accepts as parameters 3 vars, the first one being of type struct resbuf*

Is there a way to convert my pointer to that type, so I dont need first to close the object, then to get it from AutoCAD, to open it again,to modify it and finally to close it again.

I need this text box thingy to get the size of the text, so I can center justify it..... if somone knows a better way of doing this - I'm ready to listen ;)

Thanx in advance!
Todor Latev
0
tlatev
Asked:
tlatev
  • 4
1 Solution
 
ZoppoCommented:
Hi tlatev,

maybe you can do it like this:

AcDbText* pText = new ...;

// add the text
...

// determine extents
AcDbExtents ext;
pText->getGeomExtents( ext );

// calculate transormation matrix for move
AcGePoint3d offset( -( ext.maxPoint()[X] - ext.minPoint()[X] ) / 2.0, 0.0, 0.0 );
AcGeMatrix3d textMat;
textMat.setCoordSystem( offset, AcGeVector3d(1.0, 0.0, 0.0), AcGeVector3d(0.0, 1.0, 0.0), AcGeVector3d(0.0, 0.0, 1.0) );

// do transformation
pText->transformBy( textMat );

// close
pText->close();


This works for me to center unrotated texts horizontally.

hope this helps,

ZOPPO
0
 
ZoppoCommented:
Hi tlatev, please tell if you still have problems or if you can't use it.
0
 
ZoppoCommented:
Still waiting for any response...
0
 
tlatevAuthor Commented:
Y're right Zoppo....I'm very sorry about the delay...
..in fact I took a glance at your response, but didnt take my time even to try the code u submited....
The reason being is that the company I was developing the proggie for canceled out on me and I almost forgot to check at experts-exchange..... I left the proggie the way I did it before.... but looking at your code I think it should work, hence you deserve the highest score...
Thanks once again and if I need help some time again - dont be angry with me, ok? ;)

TL
0
 
ZoppoCommented:
You're welcome ... and no problem ...

I promise you it would have worked :o)

have a nice day,

regards,

ZOPPO
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now