?
Solved

ObjectARX - autocad programing

Posted on 2003-03-04
1
Medium Priority
?
892 Views
Last Modified: 2007-12-19
  ***Autocadprograming - ObjectARX - C++***
Hallo,
Woundering if any one knows how to set insertion point for a AcDb3dsolid (box), by default it is 0,0,0... I whant it to be user defined, but can´t find member function setting koordinats..

/Daniel
0
Comment
Question by:tankthall
[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
1 Comment
 
LVL 15

Accepted Solution

by:
OMC2000 earned 200 total points
ID: 8063522
solids are always created with centroid (0,0,0) so you must translate it to the place you want it to be.

void
EntMakeDbox::make3dSolid()
{
    acutPrintf(_T("\nTesting make of AcDb3dSolid (BOX) ..."));

    ArxDbgUiPrPoint prCentroid(_T("Centroid"), NULL);
    ArxDbgUiPrDist prXLen(_T("X-length"), NULL, ArxDbgUiPrDist::kNoNegNoZero);
    ArxDbgUiPrDist prYLen(_T("Y-length"), NULL, ArxDbgUiPrDist::kNoNegNoZero);
    ArxDbgUiPrDist prZLen(_T("Z-length"), NULL, ArxDbgUiPrDist::kNoNegNoZero);

    if ((prCentroid.go() != ArxDbgUiPrBase::kOk) ||
        (prXLen.go() != ArxDbgUiPrBase::kOk) ||
        (prYLen.go() != ArxDbgUiPrBase::kOk) ||
        (prZLen.go() != ArxDbgUiPrBase::kOk))
        return;

    AcDb3dSolid* solid = new AcDb3dSolid;
    Acad::ErrorStatus es = solid->createBox(prXLen.value(), prYLen.value(), prZLen.value());
    if (es == Acad::eOk) {
            // solids are always created with centroid (0,0,0)
            // so you must translate it to the place you want it
            // to be.
        AcGeMatrix3d mat;
        mat.setTranslation(prCentroid.value().asVector());
        solid->transformBy(mat);

        solid->setDatabaseDefaults();
        ArxDbgUtils::transformToWcs(solid, acdbHostApplicationServices()->workingDatabase());        // could combine with above xform to be optimal
        ArxDbgUtils::addToCurrentSpaceAndClose(solid);
    }
}
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

777 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