Creating a Rectangular RevCloud using acedCommandS

By Balaji Ramamoorthy

When running the _RevCloud command from a script or using acedCommandS, the options presented in AutoCAD’s command window did not match the options that one gets when running _RevCloud command in AutoCAD UI. The option to set the Revcloud type was not appearing when invoked from acedCommandS.

Here are screenshots of the options to show how they differed:

ThroughScript

ThroughUI

The following reason for this behavior was provided by Markus Kraus from our AutoCAD engineering team:

When driven from apps or from script, most AutoCAD commands default to their first command version (the version where the command has been introduced the first time in AutoCAD)

Here is a small code snippet that sets the command version to get this working:

Adesk::UInt8 cmdVerNew = 2;

// Returns the previous command version (cmdVerOld)
Adesk::UInt8 cmdVerOld = acedInitCommandVersion(cmdVerNew);

AcGePoint2d ll(0.0, 0.0); 
AcGePoint2d ur(4.0, 5.0);

acedCommandS(RTSTR, _T("_.revcloud"), 
             RTSTR, _T("_R"),       // RevCloud Type: Rectangular
             RTSTR, _T("_A"),       // Arc length option
             RTREAL, 0.25,          // Minimum arc length
             RTREAL, 0.75,          // Maximum arc length
             RTPOINT, ll,           // First corner
             RTPOINT, ur,           // Second corner
             RTNONE);

Such the command versioning can also be implemented for custom commands that you create. To do this, please refer to the ObjectARX documentation on “acedGetCommandVersion”. Based on the command version, a custom command can vary in its functioning.


Comments

One response to “Creating a Rectangular RevCloud using acedCommandS”

  1. how to implement this method in autocad???

Leave a Reply

Discover more from Autodesk Developer Blog

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

Continue reading