How to get information about routes between elements using Viewer API - autodesk-forge

I'm trying to create web application using autodesk forge API, and want to get output of information about routes between elements. In brief, the application outputs the shortest path between two elements when they are selected.
I tried it using getIsolated() and isolate() but I can't understand what the "isolated" state is, so I can't.
please teach me the how to solve this challenge.
I'm sorry for my bad English.

Isolation is a way to highlight certain objects in the scene by making other objects "ghosted" (semitransparent) or hidden completely. If you want to actually select objects, use the .select() and .getSelection() methods.
Forge Viewer does not provide any path planning unfortunately. It can give you the bounding boxes of all objects in the scene (here's an example) but you would have to find the path among them yourself.

Related

Retrieve object data with Forge Viewer (nested Families)

I am trying to use forge-Viewer with dashboards to analyze the data within the model. For that, I am using the getAllLeafComponent() method expressed in the Forge Tutorials: https://learnforge.autodesk.io/#/viewer/extensions/panel?id=enumerate-leaf-nodes.
Nevertheless, I am having some trouble with this method, because it will not recognize objects that have children (i.e. Revit Families with nested items).
Element with nested item (space of operation)
In the attached image, the green tetrahedron represents the transformer space of operation, and it is a nested item inside the transformer, so with the getAllLeafComponent() method I am unable to retrieve the transformer data, which is the important one; as this method does not recognize the transformer as a leaf, but rather as a parent element, which indeed it is, but it is also a model object, not a category or a family symbol.
Has anyone comes up with the same problem and/or with a way to solve it?
It is of uttermost importance for my Forge application, otherwise, I would not have reliable model information to analyze it.
Best Regards,
The Model Derivative service uses a specific, "reasonable" logic for each individual input file format to decide how granular it should go when building the logical hierarchy for the viewer. In case of Revit designs, the processing stops at the instance level, in other words, family instances are always output as leaf nodes, even if their families have some nested elements. For example, doors are always output as the smallest selectable elements, and you cannot select just the door knob. I'm afraid the same applies to your space of operation nested within the transformer family.
If you need to extract information that the Model Derivative service does not provide, you could consider using the Design Automation service instead. This service lets you execute your custom Revit (or AutoCAD, or Inventor, or 3ds Max) plugin on our servers, creating, modifying, or analyzing designs in any way you need, remotely.

Is it possible to pull custom fields from SolidWorks files on Forge?

I have translated SolidWorks files on AutoDesk Forge, however, the Forge metatadata / objects / properties call of these files only provides the objectid and name. I know I've got several fields in the files, just wondering if I have to wire up some strange way to pull them out before sending them, figuring it may not be supported through the Forge API. Thanks!
The Model Derivative service is usually doing a pretty good job with extracting the metadata of your designs. Note however that the metadata might be available on a different level in the logical hierarchy.
Here's the metadata I see in one of my sample SolidWorks files when I simply click on one of the parts:
And this is the metadata I see when I select its parent element:

saliency map for multi-class multi-label classification?

I have found ways to do CAM/saliency map for multi class, but not multi label multi class. Do you know of any resources I can use to do it so I don't reinvent the wheel, or rather do you have advice for implementing it?
My specific use case is that I have a transfer learned ResNet that outputs a binary 1x11 vector. Each entry corresponds to presence of a certain feature in the input image. I want to be able to get a saliency map for each feature, so I can know what the network was looking at when deciding if each image has each of those features.

Do Forge Viewer SVF pack files use parent-child linked transforms?

Context: I've been extracting geometry data from the Forge SVF structures into an OBJ format using the Forge Extract code by Petr. These data are then transparently sent to a different rendering system for the project upon which I'm working. However, I'm noticing that there are incorrect rotations in groups of extracted objects. Not all objects, just groupings.
As an example, here is the Forge Viewer rendering of a group of objects (the long poles), with correct rotation. You can see all the poles evenly placed along the base-plate's edge and equally placed with regards to each other.
Whereas in the rendered extracted geometry, the grouping of objects are correctly placed with relation to each other (equally, 3x3), but the group as a whole is rotated slightly along the Z-axis in relation to the bottom plate.
This is the type of behaviour I would expect if the individual poles were all child objects of some parent object (perhaps an invisible grouping object), and the rotation of the parent would pivot all the poles in the SVF but that rotation wasn't applied during geometry extraction.
This happens with all groupings with regards to individual objects in a scene.
While looking at this question, I get the strong impression that there is a 2nd rotational aspect but I cannot see how that applies when reading the SVF directly.
Question:
Obviously I'm not looking for a direct code solution, but to confirm the structure of the SVF pack files. Looking at the extraction, I don't see anything which would imply a parent-child grouping but haven't managed to think of an alternative cause.
So, are there such parent-child transform relationships in the SVF pack files, or a global rotational component which only applies to certain objects? If so, where is that placed within the pack file. And if not, what else could cause this type of systematic rotation of groups?
The SVF file format doesn't use parent-child transforms - all fragment transforms are basically world transforms. It's possible that my code for parsing the fragment transforms handles one of the transform types incorrectly. I'd try debugging the getTransform method for the dbId of the base or one of the poles, and compare the transform with the one parsed by Forge Viewer.
Also, I'm wondering if it's the base that's slightly off, and not the 3x3 poles?

neo4j graph to JSON

I'm considering different options to use Neo4J graph and display it all on the web, at the moment I am considering a Java based reader of the database that creates JSON output for display by the web.
Is JSON suitable for display tree-like structures? In my case I have a parent-child(s) style organisation chart.
Could you give me an example if this is possible. Thanks.
Yes. Use JSON to pass over all the geometry: lists of nodes and edges, location and sizes of nodes, spline data for edges, etc. Convert all the data to an SVG DOM, which can be done dynamically. (Hint for HTML 4: make sure you use the SVG namespace in CreateElement.) The real trick, more than anything, is to do all the calculations before the data hits the browser. Simple calculations work fine in JavaScript, but anything complicated is best done elsewhere.
No example, unfortunately. The code I wrote is not available to the public.