825

Autodesk Forge - How to stop recoloring of object when selected

Question:

Our elements are color coded so when a user selects one we just want to isolate it in the views (which works as expected) BUT we don't want it to change to the selection color - where can we control this?

Answer1:

Use selection event to find which object has been selected, cancel the selection and isolate the selected dbId, is this the behavior you are looking for?

AutodeskNamespace("Autodesk.ADN.Viewing.Extension");

Autodesk.ADN.Viewing.Extension.Basic = function (viewer, options) { Autodesk.Viewing.Extension.call(this, viewer, options); var _this = this; _this.load = function () { console.log('LOAD') viewer.addEventListener( Autodesk.Viewing.AGGREGATE_SELECTION_CHANGED_EVENT, function(e) { //console.log(e) if(e.selections.length) { var dbId = e.selections[0].dbIdArray[0] viewer.select([]) viewer.isolate(dbId) } }) return true; }; _this.unload = function () { Autodesk.Viewing.theExtensionManager.unregisterExtension( "Autodesk.ADN.Viewing.Extension.Basic"); return true; }; }; Autodesk.ADN.Viewing.Extension.Basic.prototype = Object.create(Autodesk.Viewing.Extension.prototype); Autodesk.ADN.Viewing.Extension.Basic.prototype.constructor = Autodesk.ADN.Viewing.Extension.Basic; Autodesk.Viewing.theExtensionManager.registerExtension( "Autodesk.ADN.Viewing.Extension.Basic", Autodesk.ADN.Viewing.Extension.Basic);

Answer2:

In case you want to keep the selection just not make it blue in the UI, you can change the selection material's opacity to see-through:

viewer.impl.selectionMaterialBase.opacity = 0; viewer.impl.selectionMaterialTop.opacity = 0;

Now when you click on an object it won't turn blue.

Recommend

  • Microsoft.WebApplication.targets
  • UNIX man command to find list of man sections
  • Getting the Y and Cb , Cr values of a frame in openCV c++
  • Appending data to NSFetchedResultsController during find or create loop
  • Maya - How to create python scripts with more than one file?
  • Autodesk forge RGraph extension not working properly
  • Batch For loop.. wildcards to determine length of searched files?
  • PYTHON : There is a function similar to ast.literal_eval ()?
  • How to import a Oracle 11g RMAN backupset on a new database server?
  • Reminders on shared calendar events don't propagate to the people accessing it
  • Load multiple URN in a same Viewer
  • How to create a calendar object in Java
  • Parsing date string (MM-dd) to java date in default year
  • Do unidirectional associations lead to non-required foreign key fields through NHibernate
  • How to make JDatePicker text field formatted for input?
  • Multithreading - Killing a Thread and all its child processes
  • Is there a filesystem plugin available for django?
  • createFileAtPath & OCUnit & errno blues
  • How to setCenter mapview with location in google maps sdk for iOS
  • Add Jpanel to Jframe NetBeans
  • css background images not always displayed
  • Caliburn Micro, How to use ContentControl (or display 'sub' ViewModel) using ViewModel Fir
  • Perspective projection, 4 points
  • Compare struct to a constant in C
  • Wrong labels when plotting a time series pandas dataframe with matplotlib
  • Find Previous month name using Calender or any classes that in java
  • Image map in Flex
  • Who propagate bugfixes across branches (corporate development)?
  • Android application: how to use the camera and grab the image bytes?
  • Creating Java object from class name with constructor, which contains parameters [duplicate]
  • MySQL Order by column = x, column asc?
  • How to suppress a dialog
  • Cancel a live stream “fast motion” catch-up in Flash
  • QLineEdit password safety
  • Deleting and Updating values from a cusrsor adapter
  • Modifying destination and filename of gulp-svg-sprite
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • what is the difference between the asp.net mvc application and asp.net web application
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • How to push additional view controllers onto NavigationController but keep the TabBar?