Message 1 of 15
Getting appearance data from API

Not applicable
04-27-2015
02:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have problem with getting color information for materials.
I'm trying to read transmittance color for glass type material (interior_desing=3) this way:
body.appearance.appearanceProperties.itemById('transparent_color')
The problem is that it gives me weird rgb values. If any of rgb values is 255 then it returns this but values lower than 255 are returned as 0. So if I have color set in Fusion to i.e. (12,255,35) I got (0,255,0)
The same problem is when I try to read surface_albedo property.
I've tried to use getColor but then I got another error:
c.value.getColor(r,g,b,a) Traceback (most recent call last): File "<string>", line 1, in <module> File "/Users/grzybu/Library/Application Support/Autodesk/webdeploy/production/7a7e9c62480d5fc85b3d64d9f19bed096a977eb7/Api/Python/packages/adsk/core.py", line 2294, in getColor return _core.Color_getColor(self, *args) TypeError: in method 'Color_getColor', argument 2 of type 'short &'
All other values (ior, roughness, transparent_distance) are returned properly.
So the question is how to correctly read color data?
Another question is about getting full path for textures.
Is there any way to get full path of textures?
Texture path field contains only part of the path relative to appearance library, but I didn't found any API method to get appearance library path.
I guess it may differ on different machines so it's bad idea to hardcode this.