About   |   Getting Started   |   Downloads   |   Documentation   |   Forum

Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Third Party Plugins usage
02-07-2018, 06:36 PM
Post: #1
Third Party Plugins usage
This code seems to work, but can somebody tell me if I'm doing it correctly? Of course, I'll later add checks for whether the third party plugin (CADtools) is installed and its version is compatible. Also curious why the message() method returns an SPerr, returns another by reference, and d.SPCheck contains a third SPerr.

    hdi::core::Illustrator::ThirdPartyPluginMap otherPlugins;
    otherPlugins = HDI_CORE_ILLUSTRATOR->allPlugins();
    hdi::core::Illustrator::ThirdPartyPluginMap::iterator it = otherPlugins.find("Hot Door CADtools");
    // test "it" and bail if no pointer
    hdi::core::ThirdPartyPlugin* CTpi = it->second;
    std::string ctPIpath = CTpi->filePath(); // just to verify the plugin's pointer
    // check plugin version and bail if prior to 11.1.2
    hdi::ct::PublicMsgGetCurrentScaleData* data =
    data->d.self = HDI_CORE_PLUGIN->spPluginRef();
    data->layer = HDI_CORE_ILLUSTRATOR->currentDocument()->currentLayer()->aiLayerHandle();
    SPMessageData* SPdata = reinterpret_cast<SPMessageData*>(data);
    bool OKsoFar = CTpi->prepMessageData(*SPdata);
    SPErr SPmsgErr, SPresult;
    SPmsgErr = CTpi->message(hdi::ct::publicMsgCADtoolsCaller,
        hdi::ct::publicMsgGetCurrentScaleSelector, SPdata, SPresult);
    if (!SPmsgErr){
        // read data from CADtools and store somewhere
        double CTscaler CTscaler = data->scaler;
    OKsoFar = CTpi->cleanMessageData(*SPdata);
Find all posts by this user
Quote this message in a reply
02-08-2018, 03:42 PM
Post: #2
RE: Third Party Plugins usage
This looks correct to me (but I haven't run it or anything).

As the docs state for the ThirdPartyPlugin::message() method, the returned SPErr is for errors regarding sending the message, whereas the return-by-reference SPErr is for errors given by the third-party plugin itself. I can't comment as to Adobe's original intention with the SPMessageData::SPCheck member.
Find all posts by this user
Quote this message in a reply
03-11-2018, 02:50 PM
Post: #3
RE: Third Party Plugins usage
So far this code is working fine for me. The first time it fetches CADtools' info there's a lag of about 2 seconds, although subsequent requests are pretty instantaneous. Is this normal?
Find all posts by this user
Quote this message in a reply
Post Reply 

Forum Jump:

User(s) browsing this thread: 1 Guest(s)