Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GUI: DIalog Stacking and Popping in MS C++ 4 76
I could not build boost code, 10 88
Safe conversion? 4 67
Embarcadero C++ Builder XE10.1 Berlin red arrow Indicator 2 36
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

773 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