?
Solved

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

Posted on 2002-07-01
5
Medium Priority
?
818 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

764 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