Follow TerraXML
Small Orange Stripe

Subscribe via E-mail

Your email:

describe the image

Current Articles | RSS Feed RSS Feed

Pulling data from IsoView graphics: Part 2

  
  
  

This is the second in a two-part series on an Arbortext Editor customization that pulls object names from an embedded IsoView file

 In the last article, we discussed the basic approaches to any Arbortext customization and reviewed some of the Intelligent Graphics features. In this article, we dive into the technical stuff. First, we’ll discuss the importance of reverse engineering and then we’ll step through some code examples.

Reverse Engineering

When starting with a new Editor customization, it’s a good idea to begin with a quick search through the Editor install tree to find out how the features are supported that relate to your customization. With some poking around, you can usually learn a great deal about how the existing functionality is stitched together. From there, you can reverse engineer a workable solution leveraging the Arbortext custom directory to override one or more specific files. Be sure to thoroughly test your customization and the functionality you are overriding to avoid any undesirable side effects!

We are working with the embedded IsoView viewer inside Arbortext Editor. Therefore, a good start is to search on “isoview” within the Editor install tree. A number of XML-based User Interface files (XUI) with isoview in the name are found inside the [install-path]\lib\dialogs directory.

Looking at the file isoviewembed.xml, for example, reveals the ActiveX object name for the embedded IsoView viewer used inside Arbortext Editor and in turn links to the supporting JavaScript code found inside isoview.js. The JavaScript file can be found inside [install-path]\packages\main and provides a series of functions for manipulating objects in embedded .iso files.

This isoview.js file is going to play a key role in our customization and shall require an extension. To override the default isoview.js file, copy it to the custom/scripts directory. We’re interested in getting all object names from an .iso file, so we will need to add a function that performs this task. Let’s call it GetAllObjectNames() and write it so that we can iterate through all object names and return a list of names as a string, with each value separated by the ^ character. Our code might look like this:

function GetAllObjectNames()
{
    var count = ivx.Iso3GetObjectCount();
    var index;
    var name;
    var namelist = '';


    for (index = 0; index < count; index++)
    {
            name = ivx.Iso3GetObjectNameByIndex(index);
            if (namelist.length == 0)
                namelist = name;
            else
                namelist += '^' + name;
    }

    ivx.DisposeObjectList();

    return namelist;
}

This custom script file needs to be called by our user dialog. Let’s explore that next.

Building the Customization

For this exercise, all we’re trying to do is write a customization that can pull the graphic callout names from a layer named “Callouts” inside a single IsoDraw file and write that to a text file.

Using our own XUI file, we can create a simple dialog that fires off some ACL code when a button is clicked. The <button> and embedded <script> code might look like this:

<button id="OKbtn" label="Publish ISO data" type="accept">
    <script ev:event="DOMActivate" type="text/javascript">
        var dlgdoc = Application.event.target.ownerDocument;
        // call ACL publish code
        Acl.execute("pub_iso::push_isodata()");
    </script>
</button>

The Acl.execute function calls our custom ACL package “pub_iso” and the function “push_isodata” is responsible for the heavy lifting in concert with another JavaScript worker file.

ACL resized 600 

The .iso file is embedded as an ActiveX Object inside the active Editor window. The ACL will call supporting JScript code and write the text file.

This work file is used to navigate the script context to make sure we’re pulling the data from the embedded .iso file referenced by our open XML document inside Arbortext Editor. One of the nifty features of customizing Arbortext is that you can use both ACL and JavaScript fairly easily together.

Let’s review our files in the custom directory:

Custom directory/

       dialogs/pubiso.xml (to provide a button that can be added to the Editor interface)
scripts/


         isoview.js (a customized version of the JavaScript code used to manipulate intelligent graphics inside Arbortext Editor)


       getData.js (a JavaScript worker to call the image element holding your graphic, manage the script context, and manipulate the list of object names)


      getCallouts.acl (an ACL file called when the user clicks the button that provides some necessary trappings to call the JavaScript worker)

The JavaScript code inside getData.js demonstrates the integration between ACL and JavaScript. First, since we’re working with ActiveX, we have to declare the MS version of JavaScript known as JScript:

// type="text/jscript"

Now let’s call our function getNames and walk through what it does.

function getNames() {

First, we want to call the active document inside the Editor window and pull the first image element:

var graphic = Application.activeDocument.getElementsByTagName("image").item(0);

Second, we want to get the ACL window used to display the graphic. We can use the Acl.eval function and the OID interface here:

var aclwin = Acl.eval("oid_dialog('" + graphic.firstOID + "')");

Next, we want to pass the ACL window to the Arbortext Object Model (AOM) window:

var win = Acl.getWindow(aclwin);

Now that we have that, we can get the script context for the embedded IsoView viewer:

var sc = win.getScriptContext("JScript");

This allows us to have the current context invoke code in the other context, allowing the target context to manipulate the ActiveX object for IsoView. The ActiveX object contains our callout names, so this piece is crucial for obtaining access to them.

The second parameter binds the expression to the global scope:

var result = sc.loadScriptText("GetAllObjectNames()",0);

Our function provides a string of values separated by the “^” character, so we need to separate those out and populate an array with the values:

var names = result.split("^");

Next, we declare a string variable to hold our results:

var namelist = '';

Finally, we can use a “for” loop to iterate through the array and populate our string with line breaks. The “for” loop is set to end when it encounters the default IsoDraw object named “Standard layer.” Custom layers in IsoDraw exist before the “Standard layer” and “Background” inside the .iso file, so this loop will only pull names added to custom callout layers (as well as the name of the custom layers).

    for (name in names) {

                    if (names[name] != "Standard layer"){

                                    namelist += names[name] + "\n";

                    } else {

                                    break;

                    }

    }

return namelist;

The ACL code responsible for calling the JavaScript function can then take this result set and write it to a file handle, a dialog box, and so on. So long as your illustrators have added the callouts to a custom layer, you should now have a human readable list of callouts from the .iso file. This can be helpful when trying to create a bill of materials from a parts illustration, for example.

For more information

  • Online Help: Refer to “Intelligent graphics overview” in the Arbortext Help Center or type “help 5981” into the Editor Command window to learn more about intelligent graphics.
  • Online Help: Refer to “Description of the custom directory structure” in the Arbortext Help Center or type “help 5046” into the Editor Command window to learn more about the custom directory structure.
  • Samples: There’s also some sample .iso files and demonstrations of the various linking capabilities in the samples\isoview directory found inside your Editor installation path.

 

Comments

Any time you are aware of the Chloe python Silverado pouch concerning ioffer, you could be also told it happens to be cartier replica sale good not to mention reflector look straightforward, it is fair salesmanship. There is not any trouble with the help of knowingly investing in trendy bump apart. But, baby aware working at who to boot. A large number of properties are on hand. A lot of us definitely will offer for sale some knock-off for the purpose of way more as opposed to it happens to be dior replica. And once concerning i just make available, one proposed an identical distinct pouch for two completely different deals. Typically the sunglass monitors proposed by you and me are actually from superior as they are specific through styling not to mention positively assists in the get considerably more marketing sign in sell showrooms. That allows you to advance a sunlight good discounts fake u-boat is to come up with these products most certainly. Folks who are on the lookout for automatic merchandiser quantity such monitors are able to email the corporate from calling on toll complimentary phone number. Preferred researching gucci replica monitors but not just captivate marketing but more hype defense from sunlight. We've found many monitors which commonly handle 14 towards 55 pairs from replica watches sale. We've found sizable devices not to mention styling among them terrain brand spinning small form sunglass showcase rack. Such purses are really classy not to mention graceful.
Posted @ Friday, October 31, 2014 2:12 AM by guanwei
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics