Zooming entities using acedCommand in ObjectARX

By Virupaksha Aithal

Few days back Fenton Webb showed me the below ObjectARX way of zooming the selected entities.

void zoomTest()
{
    ads_name ss;
    int err = acedSSGet(NULL, NULL, NULL, NULL, ss);
    if (err != RTNORM) 
    {
        return;
    }
    acedCommand(RTSTR, _T("_.zoom"), RTSTR, _T("_Object"), 
                        RTPICKS, ss, RTSTR, _T(""), RTNONE);
    acedSSFree( ss );
}

Comments

8 responses to “Zooming entities using acedCommand in ObjectARX”

  1. petcon Avatar
    petcon

    NEVER USE acedCommand IN ARX
    and why not post the real arx code to show how to get zoom done

  2. Virupaksha aithal Avatar
    Virupaksha aithal

    Hi,
    Not sure why you think developer needs to avoid using “acedCommand”. In this case use of acedCommand will reduce the effort of the developers finding the extent and then setting the setting.
    Having said that, we will write similar post in future on zooming the entities without acedcommand.
    Thanks
    Viru

  3. petcon Avatar
    petcon

    zooming the entities without acedcommand. this is what like.
    yes i know acedCommand is easy and quick solution.
    but i should say it is NOT a good solution,do u think so?

  4. Patcon! “NOT good solution” and “NEVER USE” – these are two very different ideas. Agree? ;-)

  5. acedCommand is a very good solution to a lot of problems. Its an extremely powerful way to synchronously use the functionality provided by AutoCAD commands within your code. As a purist, you might prefer to write all your functionality from scratch, but (as a realist) why would I spend a long time reverse-engineering an AutoCAD command when I can use acedCommand and spend the time I save working on other code (or – better still – sitting by the pool sipping a cold beer).

  6. petcon Avatar
    petcon

    agree.and i will never use. :D

  7. petcon Avatar
    petcon

    i agree ” (as a realist) why would I spend a long time reverse-engineering an AutoCAD command when I can use acedCommand and spend the time I save working on other code”.
    OK.never invent the wheel.
    but as i know acedCommand will cause some unkown side effect,is that true?.

  8. Any API can cause unexpected results if you use it wrongly. But acedCommand (or (command) in LISP) is a very mature API, and is safe to use as documented in the ObjectARX helpfiles.
    Perhaps you got confused between ObjectARX and .NET. P/Invoking acedCommand in a .NET plug-in could cause problems due to AutoCAD’s use of Fibers – which .NET doesn’t support – so you have to use it with more care there.

Leave a Reply to petconCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading