How to add custom environment map for background in autodesk forge? - viewer

I want to add environment map for background,I have tried viewer.setLightPreset(value) ,but I don't like the default map.I need to add custom environment map for background.I learned about Add Custom Light for the View and Data API Viewer,and added this code in my viewer
Autodesk.Viewing.Private.LightPresets.push({
name: "selfEvn",
path:"selfEvn",
type:"logluv",
tonemap:1,
E_bias: -2.0,
directLightColor: [0, 0.84, 0.67],
ambientColor: [0.8, 0.9, 1],
lightMultiplier: 0.1,
bgColorGradient: [230, 230, 230, 150, 150, 150],
darkerFade: !1
});
viewer3D.setLightPreset(Autodesk.Viewing.Private.LightPresets.length - 1);
Forge's file is used with the dds suffix file.I made the dds suffix file width NVIDIA Texture Tools for Adobe Photoshop,and put it under this path: res\environments.But viewer can't use my file.I opened the defaulet files under the path: res\environments,they are just look like this Default files.I don't know if my method is wrong or my files are wrong My files are just like images,but their suffix is DDS.
And my model was created by Revit

After checking with the dev team, there is no API available for converting and setting user owned background image (Environment map) for models from the Revit and the Model Derivative translation currently. Custom background image feature is only available for models of the Autodesk Fusion 360, but there is a known issue for image translating from the Fusion model which is investigated by the dev team now. We apologize for any inconvenience caused.
In addition, we cannot ensure the certainties and the stabilities of those private APIs. Private APIs are only for the internal usage of the Froge Viewer. Therefore, it's not recommended to use those APIs under the Autodesk.Viewing.Private namespace to partner developers like you.
However, we can log this request in our internal system for the dev team to allocate time to investigate. Maybe it will come true someday, but we have no idea when it will be. So, there is no any promise for it. Hope you will understand.

Related

How can we ensure that the thermal transmittance takes into account the properties of the thermal asset assigned to the material?

Steps to reproduce the issue
(Using Revit 2021.1.3)
Create materials through Revit API and assign them a thermal asset:
Assign material to a wall layer
See that thermal conductivity is filled but resistance is still 0:
Explored solution
Manual workaround
Manually modify any parameter like commentary
See that this time resistance is now not 0 which means that thermal asset is now taken into account
Things which did not work
Modify commentary through Revit API in a separate transaction
Current work in progress source code
Current work in progress source code can be found in pyRevitMEP repo
I found an example in Revit API documentation. Apparently setting thermal property set through ThermalAssetId property is not the way to go. We need to use SetMaterialAspectByPropertySet method instead.
revit_material = doc.GetElement(Material.Create(doc, layer_name))
thermal_asset = ThermalAsset(layer_name, ThermalMaterialType.Solid)
thermal_asset.ThermalConductivity = UnitUtils.ConvertToInternalUnits(
thermal_conductivity,
DisplayUnitType.DUT_WATTS_PER_METER_KELVIN,
)
thermal_property_set = PropertySetElement.Create(doc, thermal_asset)
material.SetMaterialAspectByPropertySet(MaterialAspect.Thermal, thermal_property_set.Id)

How can i preserve the source raster projection when using gdal_translate?

I'm currently working on a small raster refining tool. The goal is, to have a simple CLI tool, to compute tiles from a georeferenced source raster and create a corresponding index.shp. For this I'm using python 3.7 and gdal. The tool runs smoothly and generates the expected tiles and shapefile, but it gets rid of the projection, which is stored in the source raster. Qgis defaults the newly computed tiles to EPSG 4326 while informing me about an unknown projection. The original raster is in EPSG 25832.
My Setup:
Windows 10 64 bit
Python 3.7.2
Gdal I cannot access the specific version, since gdal-config is not installed and I cannot make it work, but it is 64-bit and I installed it through the binaries provided on gisinternals.com. Windows software list says GDAL 204 MSVC 2017.
While running the script, I get error messages telling me about missing files, e.g. pcs.csv, datum.csv ellipsoid.csv and so on. This indicates that having those files, would fix my problem.
But oddly enough, I have used Osgeo4W to install, python 2.7 with gdal and it works like a charm, of course having adjusted the python parts. Tiles get calculated and stay in the projection of the source. Without any external files which specify a projection, in fact using the exact same data which is really confusing to me.
To my understanding, there is no flag or option which forces gdal to keep the projection. If have overlooked or missunderstood the docs im glad for advice.
Before anyone asks, i know that using the osgeo4w installer is obviously the easy and working solution here. But keeping in mind that python 2.7 will soon be discontinued and also using this as a chance to learn new things i wanted to build a 3.7 based tool with gdal installed on my machine
The corresponding code looks like this and does the following :
1.) Command string is build
2.) string is handed to os.system, which in turn executes accordingly
for i in range(0, width, tilelenght):
y = 0
for j in range(0, height, tilelenght):
gdaltranString = f'gdal_translate -of GTIFF -srcwin {i}, {j}, {tilelenght}, {tilelenght} {input_filepath} {output_filepath}{x}_{y}.tif'
subprocess.run(gdaltranString)
y = y+1
x = x+1
The expected result, would be a collection of functional .tif files which have the EPSG code of the source file, in this case 25832.
But as already mentioned, the projection gets lost somewhere in the process.
So,i have found the solution to my problem, without really understanding how it became an issue to begin with.
The solution was to create an user variable GDAL_DATA with the path to the projection definition files.
The weird thing is, i now have GDAL_DATA, as system variable and user variable, both pointing to the same directory.
If someone knows more about the mysterious ways of windows system variables, please share your wisdom, or the source of said wisdom.

Trying to create a DvbBufferedImage but its width and height are 0

I'm trying to create a fade-in animation using DvbBufferedImage for my BD-J application by changing alpha value of the images,
doubleBuffer = new DVBBufferedImage(1920, 2180, DVBBufferedImage.TYPE_ADVANCED);
but after it creates the buffer, its width and height are 0 and when I'm trying to get graphics:
DVBGraphics bufferGraphics = doubleBuffer.createGraphics();
It returns null.
after that, I want to draw images onto buffer and I get NullPointerException.
Do you have and suggestion?
I think it is related to my libraries, because when I replaced DvbBufferedImage with BufferedImage using this code:
protected BufferedImage bufImage = new BufferedImage(1920, 2180, BufferedImage.TYPE_INT_ARGB );
it says :
The constructor BufferedImage(int, int, int) is undefined
I mention that I'm using customized eclipse for developing Bd-j Applications and my java version is jre1.8.0_77.
Classes used for this application listed below:
basis.jar
btclasses.zip
j2me_xml_cdc.jar
javatv.jar
jsse-cdc.jar
pbp_1_0.jar
SonicBDJ.jar
Your help will be appreciated on this problem, Thanks in advance!
This could be related to a memory issue.
Blu-ray Players are only required to have 4 mb of memory according to the specification. This includes the space for the actual JAR file currently loaded. So if you're using an image of 1920x2180 pixels in high quality, then your JAR is probably already taking up 1-2 mb. Then loading that image into memory might cause an OutOfMemoryException, which means the image won't be loaded, which is why you get the NullPointerException.
Blu-ray Disc Java is JavaME. We're dealing with a limited platform. ;-)

Saving the stream using Intel RealSense

I'm new to Intel RealSense. I want to learn how to save the color and depth streams to bitmap. I'm using C++ as my language. I have learned that there is a function ToBitmap(), but it can be used for C#.
So I wanted to know is there any method or any function that will help me in saving the streams.
Thanks in advance.
I'm also working my way through this, It seems that the only option is to do it manually. We need to get ImageData from PXCImage. The actual data is stored in ImageData.planes but I still don't understand how it's organized.
https://software.intel.com/en-us/articles/dipping-into-the-intel-realsense-raw-data-stream?language=en Here you can find example of getting depth data.
But I still have no idea what is pitches and how data inside planes is organized.
Here: https://software.intel.com/en-us/forums/intel-perceptual-computing-sdk/topic/332718 kind of backwards process is described.
I would be glad if you will be able to get some insight from this information.
And I obviously would be glad if you've discovered some insight you can share :).
UPD: Here is something that looks like what we need, I haven't worked with it yet, but it sheds some light on internal organization of planes[0] https://software.intel.com/en-us/forums/intel-perceptual-computing-sdk/topic/514663
UPD2: To add some completeness to the answer:
You then can create GDI+ image from data in ImageData:
auto colorData = PXCImage::ImageData();
if (image->AcquireAccess(PXCImage::ACCESS_READ, PXCImage::PIXEL_FORMAT_RGB24, &colorData) >= PXC_STATUS_NO_ERROR) {
auto colorInfo = image->QueryInfo();
auto colorPitch = colorData.pitches[0] / sizeof(pxcBYTE);
Gdiplus::Bitmap tBitMap(colorInfo.width, colorInfo.height, colorPitch, PixelFormat24bppRGB, baseColorAddress);
}
And Bitmap is subclass of Image (https://msdn.microsoft.com/en-us/library/windows/desktop/ms534462(v=vs.85).aspx). You can save Image to file in different formats.

Sphinx4 figuring out correct models

I am trying to use the Sphinx4 library for speech recognition, but I cannot seem to figure out the correct combination of acoustic model-dictionary-language model. I have tried out various combinations and I get a different error every time.
I am trying to follow the tutorial on http://cmusphinx.sourceforge.net/wiki/tutorialsphinx4. I do not have a config.xml as I would if I was using ConfigurationManager instead of Configuration, because there is no perceivable way of passing the location of the config file to the Configuration itself (ConfigMgr takes it as an argument to the constructor); and that might be my problem right there. I just do not know how to point to one, and since the tutorial says "It is possible to configure low-level components of the application through XML file although you should do that ONLY IF you understand what is going on.", I assume having a config.xml file is not compulsory.
Combining the latest dictionary (7b - obtained from Sourceforge) with the latest acoustic model (cmusphinx-en-us-5.2.tar.gz - from SF again) and the language model (cmusphinx-5.0-en-us.lm.gz - from SF again) results in NullPointerException in startRecognition. The issue is similar to the problem here: sphinx-4 NullPointerException at startRecognition, but the link given in the answer no longer works. I obtained 0.7a from SF (since that is the dict the link seems to point at), but I am getting even earlier in the execution Error loading word: ;;; when I use that one. I tried downloading latest models and dict from the Github repo, that results in java.lang.IndexOutOfBoundsException: Index: 16128, Size: 16128.
Any help is much appreciated!
You need to use latest code from github
http://github.com/cmusphinx/sphinx4
as described by tutorial
http://cmusphinx.sourceforge.net/wiki/tutorialsphinx4
Correct models (en-us) are already included, you should not replace anything. You should not configure any XML files, use samples as provided in the sources.

Resources