-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinspect_rendermaterial_parameters.py
46 lines (39 loc) · 1.26 KB
/
inspect_rendermaterial_parameters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# DO NOT EDIT THIS FILE DIRECTLY. This is generated from a literate program
# with the VSCode extension Literate Programming (jesterking.literate).
#
# These literate programs are Rhino 3D scripts explaining how scripting works
# in Rhino 3D with Python.
#
# Read the literate programs at:
# https://jesterking.github.io/literate
#
# This code is part of the repository:
# https://github.com/jesterKing/rhipy
#
# The Literate Programming extension repository is at:
# https://github.com/jesterKing/literate
#
# Licensed under Apache 2.0
# See https://github.com/jesterKing/rhipy/blob/master/LICENSE
#
# Copyright (C) Nathan 'jesterKing' Letwory
#
import scriptcontext as sc
import clr
clr.AddReference('System.Xml')
import System.Xml as xml
rms = list(sc.doc.RenderMaterials)
for rm in rms:
print('material:', rm.Name)
rmdoc = xml.XmlDocument()
rmdoc.LoadXml(rm.Xml)
params = rmdoc.DocumentElement.SelectSingleNode('parameters')
param = params.FirstChild
while param:
param_type = param.GetAttributeNode('type')
try:
param_type = param_type.Value
except:
param_type = 'N/A'
print('parameter', param.Name, 'is a', param_type, 'with value', param.InnerXml)
param = param.NextSibling