Solved

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

Posted on 2002-07-01
5
810 Views
Last Modified: 2007-12-19
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
Comment
Question by:tlatev
  • 4
5 Comments
 
LVL 31

Expert Comment

by:Zoppo
ID: 7131670
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
 
LVL 31

Expert Comment

by:Zoppo
ID: 7145771
Hi tlatev, please tell if you still have problems or if you can't use it.
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 7200850
Still waiting for any response...
0
 

Author Comment

by:tlatev
ID: 7206368
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
 
LVL 31

Expert Comment

by:Zoppo
ID: 7206388
You're welcome ... and no problem ...

I promise you it would have worked :o)

have a nice day,

regards,

ZOPPO
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question