ObjectARX - autocad programing

  ***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
tankthallAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

OMC2000Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.