Solved

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

Posted on 2002-07-01
5
773 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 30

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 30

Expert Comment

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

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 30

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

706 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now