0

Using Autodesk Forge Viewer

Two questions

First

I have a converted DWG to SVF file. I want to be able to highlight a polyline like it does when you click on it with a mouse. Can anyone give me pointers on how to do this. I can not figure out how to access getMaterials.highlightObject2D if that is indeed what I am supposed to use.

Second

Assuming the first is possible. Is there any way to see the DWGs object_handles after the drawing is converted. I want to "highlight" specific polylines

Greg Bluntzer
  • 323
  • 1
  • 4
  • 21

1 Answers1

0

For #1, you can use .select():

_viewer.select(dbIds);

or maybe can change the color like this:

function color(dbId, color) {
    var elementIds = [dbId];
    _viewer.setColorMaterial(elementIds, parseInt(color/*HEX COLOR*/, 16));
}

For #2, you can iterate through the properties like this:

function findProperty(dbId) {
    _viewer.model.getProperties(dbId, function (props) {
        props.properties.forEach(function (prop) {
            if (prop.displayName === 'Handle') {
                // do something
            }
        });
    });
}

But you'll need to iterate through all elements, check this sample on how get all properties on the model (this sample creates a pie chart).

Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44