Skip to content

Commit

Permalink
improvements for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashaldemann committed Oct 2, 2024
1 parent 689d8e8 commit 26fa72d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/compas_timber/ghpython/components/CT_Bake_BoxMap/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ def get_dimensions(map_size, default):
# Save current Grasshopper document context
ghdoc = sc.doc

# Switch document context to Rhino's active document for baking
sc.doc = Rhino.RhinoDoc.ActiveDoc
try:
# Switch document context to Rhino's active document for baking
sc.doc = Rhino.RhinoDoc.ActiveDoc

# Define dimensions
b_dimx, b_dimy, b_dimz = get_dimensions(beam_map_size, [0.2, 0.2, 1.0])
p_dimx, p_dimy, p_dimz = get_dimensions(plate_map_size, [1.0, 1.0, 1.0])
# Define dimensions
b_dimx, b_dimy, b_dimz = get_dimensions(beam_map_size, [0.2, 0.2, 1.0])
p_dimx, p_dimy, p_dimz = get_dimensions(plate_map_size, [1.0, 1.0, 1.0])

try:
# Bake beams
beam_frames = [frame_to_rhino(b.frame) for b in model.beams]
beam_breps = [beam.geometry.native_brep for beam in model.beams]
Expand All @@ -50,11 +50,12 @@ def get_dimensions(map_size, default):
self.add_brep_to_document(plate_breps, plate_frames, plate_layer_name, p_dimx, p_dimy, p_dimz, swap_uv)

finally:
rs.EnableRedraw(True)

# Restore document context back to Grasshopper
sc.doc = ghdoc

rs.EnableRedraw(True)


@staticmethod
def create_box_map(pln, sx, sy, sz, swap_uv):
"""
Expand Down

0 comments on commit 26fa72d

Please sign in to comment.