0

I noticed in v4.1 that Viewer.select(dbids,selectionType) function selects the element (can see the change in property panel) however; it doesn't change the element's color as manual selection does.

I tried all three selectionType options but no change.

Is there some viewer settings I need to change for making the selection color consistent?

Thanks,

Bandu

Bandu W
  • 99
  • 8
  • Hi Bandu, I am a bit confused... the second param of Viewer.select is 'model', instead of selectionType. I can only see some methods that look related: setSelectionMode(), setSelectionColor(color, selectionType). Could you provide a bit more info and necessary snapshot to help me understand? – Xiaodong Liang May 31 '18 at 04:50
  • This is the "select" function from this reference: https://developer.autodesk.com/en/docs/viewer/v2/reference/javascript/viewer3d/ I am applying it like this, Viewer.select([ elementID], Autodesk.Viewing.SelectionMode.MIXED); Here, Viewer is the return object from this function, var Viewer = new Autodesk.Viewing.Private.GuiViewer3D(viewerDiv); – Bandu W May 31 '18 at 05:39
  • when I checked source code of viewer3d.js, i cannot see such method definition in v4.1, or v4.2. strange... I will need to check with our engineer team. – Xiaodong Liang May 31 '18 at 09:42
  • Just checked the `viewer3D.js`, before Forge Viewer v3.3, the arguments of `Viewer3D#select` is `(dbIds, selectionType)`, but in v4.x, they are changed to `(dbIds, model)`. – Eason Kang May 31 '18 at 11:47
  • Thanks @EasonKang, I just tried passing "Viewer.model" as the model (instead of selectionType) but the results are same. It selects the element but do not change color. – Bandu W May 31 '18 at 12:07
  • My answer here is showing 4 types of select API https://stackoverflow.com/a/50617948/7745569, and you might have to pass selectType.Mix (I forgot the full name) to the corresponding position to set the right selection type. The selection overlay applied on the category node and leaf node is different, so there is a selection type for setting this, and the ‘Mix’ one is for both node type in the Forge Viewer with my experiences. – Eason Kang May 31 '18 at 12:15
  • @xiaodongliang : Ok, figured out the solution: it appears that first parameter of Viewer.select() function requires array of 'numeric' data. It accepts 'strings' as dbIDs (say, ["234","345"]) but then, it only internally selects the element but do not change the display color. When I changed it to numeric, both selection & color worked. By the way, there is no requirement to pass model as 2nd parameter. Perhaps it won't matter in my case, I have only one model loaded at a time. – Bandu W Jun 08 '18 at 19:31

0 Answers0