Skip to content

Commit ce2b693

Browse files
authored
Merge pull request #5 from paireks/text_tag_testing
Text tag testing
2 parents a656e5e + 795252d commit ce2b693

File tree

6 files changed

+4623
-7
lines changed

6 files changed

+4623
-7
lines changed

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dotbimpy/file.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,21 @@ def save(self, path):
6767
bim_file.write(jsonpickle.encode(self, indent=4, unpicklable=False))
6868

6969
def view(self):
70+
figure = self.create_plotly_figure()
71+
figure.show()
72+
73+
def create_plotly_figure(self):
7074
geometries = []
7175
for i in self.elements:
7276
mesh = next((x for x in self.meshes if x.mesh_id == i.mesh_id), None)
7377
geometries.append(self.__convert_dotbim_mesh_to_plotly(mesh_to_convert=mesh, element=i))
7478

7579
layout = go.Layout(scene=dict(aspectmode='data'))
76-
fig = go.Figure(data=[], layout=layout)
80+
figure = go.Figure(data=[], layout=layout)
7781
for i in geometries:
78-
fig.add_trace(i)
79-
fig.show()
82+
figure.add_trace(i)
83+
84+
return figure
8085

8186
@staticmethod
8287
def read(path):
@@ -91,7 +96,7 @@ def read(path):
9196

9297
@staticmethod
9398
def __convert_dotbim_mesh_to_plotly(mesh_to_convert, element):
94-
colorHex = '#%02x%02x%02x' % (element.color.r, element.color.g, element.color.b)
99+
color_hex = '#%02x%02x%02x' % (element.color.r, element.color.g, element.color.b)
95100
opacity = element.color.a / 255
96101

97102
x = []
@@ -127,7 +132,7 @@ def __convert_dotbim_mesh_to_plotly(mesh_to_convert, element):
127132
k.append(mesh_to_convert.indices[counter + 2])
128133
counter += 3
129134

130-
return go.Mesh3d(x=x, y=y, z=z, i=i, j=j, k=k, color=colorHex, opacity=opacity, name=element.type,
135+
return go.Mesh3d(x=x, y=y, z=z, i=i, j=j, k=k, color=color_hex, opacity=opacity, name=element.type,
131136
showscale=True)
132137

133138
@staticmethod

0 commit comments

Comments
 (0)