Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

getByName & random character issue (Root.204ba79a45804da02860)

Explorer ,
May 24, 2016 May 24, 2016

Hi there,

I have a PRC file in my PDF.

In the tree view in Acrobat it shows the names of the objects correctly.

If I list them using JavaScript into the console then it gives me the name plus a load of characters. This makes it impossible to reference the nodes or meshes in the scene.

This is the javascript code...

for (var i=0; i < scene.nodes.count; i++)

{

     console.println(scene.nodes.getByIndex(i).name);

}

And this is the output

Root.204ba79a45804da02860

Camera.204ba79a45804da02808

Sphere.204ba79a45804da02830

Sphere Model.204ba79a45807b5030204ba79a45804da02830

Cube.204ba79a45804da02858

Cube Model.204ba79a45807b5080204ba79a45804da02858

I am using Adobe Acrobat Pro DC version 15.016.20041.55549.

Does anyone know what these additional characters are?

Since due to these random characters it makes it impossible to use getByName.

IE scene.nodes.getByName("Sphere"); does not return a valid node.

Thanks,

Kent

TOPICS
Acrobat SDK and JavaScript , Windows
930
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , May 25, 2016 May 25, 2016

I've handled this in the past by creating a function that iterates through the nodes looking for the substring up to the period and then returning that node. It can be slow on large models but it does work.

J-

Translate
Engaged ,
May 25, 2016 May 25, 2016

I've handled this in the past by creating a function that iterates through the nodes looking for the substring up to the period and then returning that node. It can be slow on large models but it does work.

J-

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 25, 2016 May 25, 2016

Thanks Joel, I thought that might end up being the case.

I will create a lookup table instead I think. Parse all the nodes and meshes and strip everything after the period, then store that name with an index to its position in the original lists. That way I won't need to parse all the nodes each time I am search for a single one.

What would be great in future is if the UniqueID that is applied to ProductOccurances in the PRC file could be automatically assigned to the SceneObject.objectID variable.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 23, 2016 Jun 23, 2016

Hi Joel and Kent,

The method using sub string may not produce the correct results all the time.

In case, if you have loaded an assembly with multiple components having the same name, then you can not really locate the required node using above method.

So it all boils down to how you name the components while writing a PRC file.

So be careful while using getByName() function.

Note :

The 204ba79a45804da02860 part in node's name Root.204ba79a45804da02860 is actually objectGUID property defined for a SceneObject.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 27, 2016 Jun 27, 2016

Hi geom_rada,

Thanks for your input. Ideally I would like to look up the name exactly but

I have not yet discovered how this 204ba79a45804da0286 value is

constructed.

I wrote my own PRC file exporter and know of all the locations where unique

IDs are used and so far have not been able to find a match between what I

am writing out in the PRC file and what this value is. If I could figure

out how this value is being created, and if it is somehow using the PRC's

included unique IDs to do so, then I could look the object up exactly in

one step. But for now I have to ensure the names are unique when saving to

ensure that no issues arise.

Thanks,

Kent

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 28, 2016 Jun 28, 2016

Actually it appears SceneObject.objectGUID and SceneObject.getByGUID have both been deprecated as of Acrobat 8.1. So you should no longer rely on objectGUID for any future development. I am not sure how this will affect the issues of the objectGUID being appended to object names.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 28, 2016 Jun 28, 2016
LATEST

In current context and implementation of SceneObject.name property being formulated as

PRC_NAME.objectGUID , I split the name and get the first part of it for work.

I use code below to get the name given as per PRC,

var lastDotIndex = node.name.lastIndexOf('.');

var sceneNodeName = node.name.slice(0, lastDotIndex);

Vinay

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines