Community
Alias Forum
Welcome to Autodesk’s Alias Forums. Share your knowledge, ask questions, and explore popular Alias topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Retrieve layer "Folder" structure with OpenModel API

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
sgeggie
723 Views, 4 Replies

Retrieve layer "Folder" structure with OpenModel API

Hello everyone,

 

I am developing an importer for Alias files using the OpenModel API and have run into a problem.

 

I would like to maintain the "Folder" hierarchy of layers when importing. At the moment, I simply iterate through layers in the following fashion:

      AlLayer *layer = AlUniverse::firstLayer();
      while(layer) {

        // Output geometry on layer
        layer = AlUniverse::nextLayer(layer);
      }

In this iteration I do find all created Folders, but I can't seem to differentiate between these and regular layers, let alone acces which layers belong to which folders. The folders just seem like empty layers. I was hoping for something like "AlLayer* child = layer->getFirstChildLayer();" which I could recursively visit, but nothing like this seems to exist. At the very least I was hoping for something like "bool folder = layer->isFolder()". I can't seem to find anything in the API which refers to these "Folder" layers.

 

Can anyone suggest an approach which lets me extract this structure?

 

Thanks in advance,

Sean

4 REPLIES 4
Message 2 of 5
Florian.Coenen
in reply to: sgeggie

Hello,

 

The Alias Layer graph is a simple directed acyclic graph where each node has an up, down, left and right pointer.  A layer may point up to a folder or left/right to another folder or layer.  A folder can point up to a folder, right/left to a layer or folder and only a folder can point down to either a layer or a folder.   The Default layer is always located in the “root” position (the very top left) and can be obtained with the function call AlUniverse::getFirstLayer().

 

Once you have obtained the default layer via AlUniverse::getFirstLayer() then you can use the functions inside the AlLayer class to navigate the graph.  Specifically…

 

AlLayer::getChild() – Retrieves the down pointer which may be a folder or a layer (or null).

AlLayer::getParent() – Retrieves the up pointer which must point to a folder (or null).

AlLayer::nextLayer() – Retrieves the right pointer (a “sibling”) which may be a folder or a layer (or null).

AlLayer::prevLayer() – Retrieves the left pointer (a “sibling”) which may be a folder or a layer (or null).

 

Note:

The function AlUniverse::nextLayer() still behaves as it did pre-2016 to preserve all the old translators that don’t support folders.  It just gives a linear traversal of the graph.

You are right, we need an AlLayer::isFolder() routine but we don’t have one, we will add one for future versions

 

I hope that is helpful.

 

Regards,

 




Florian Coenen

Message 3 of 5
sgeggie
in reply to: Florian.Coenen

Hi Florian,

 

Thanks for the feedback. I was a bit confused, as I couldn't see the methods you mention in the online documentation:

http://help.autodesk.com/view/ALIAS/2016/ENU/?guid=GUID-64EF22E6-6786-48D1-8EBF-BB2EA14D733E

However, I checked out the header files included with the latest Alias installation, and noticed that "childLayer" and "ParentLayer" methods had been added to the AlLayer interface. I'll upgrade to the latest API and try these methods out.

 

Out of curiosity, do you know when these methods were added?

 

Thanks!

- Sean

Message 4 of 5
Florian.Coenen
in reply to: sgeggie

Hi Sean,

 

no, unfortunately, I don`t know, as I am not a developer.

In case this information is really importrant for you, I can try to ask the development.

 

BTW: The "::p" is just 2x ":" and a "p". But I guess you can decrypt that. 😉

 

Awaiting your reply.

 

Regards,

 




Florian Coenen

Message 5 of 5
sgeggie
in reply to: Florian.Coenen

Thanks again, Florian

 

The childLayer functionality works perfectly, thanks again!

 

I would be very grateful if you could find out which Alias versions support this functionality. It looks like we'll have to distribute several executables for the different Alias versions, so it would be good to know when to switch between them.

 

Regards,

Sean

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report