Closed charliebrookerBH closed 2 years ago
For reference, this is what I'm trying to run in the GHPython component
`"""Provides a scripting component. Inputs: x: The x script variable y: The y script variable Output: a: The a output variable"""
author = "cbrooker" version = "2022.03.04"
import rhinoscriptsyntax as rs
import math
try: from ladybug_geometry.geometry2d.pointvector import Point2D, Vector2D from ladybug_geometry.geometry3d.pointvector import Point3D, Vector3D from ladybug_geometry.geometry3d.mesh import Mesh3D except ImportError as e: raise ImportError('\nFailed to import ladybug_geometry:\n\t{}'.format(e))
try: from ladybug.viewsphere import view_sphere from ladybug.compass import Compass from ladybug.color import Color except ImportError as e: raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))
try: from ladybug_rhino.config import conversion_to_meters from ladybug_rhino.togeometry import to_point3d, to_plane, to_vector3d from ladybug_rhino.fromgeometry import from_mesh3d, from_point3d, from_vector3d from ladybug_rhino.intersect import join_geometry_to_mesh, intersect_mesh_rays except ImportError as e: raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
my_vecs = []
for vec in view_vecs: my_vecs.append(to_vector3d(vec))
print(
direction = Vector3D(0, 1, 0).rotatexy(-math.radians(orientation))
over_pattern = view_sphere.overhang_pattern(direction, overhangproj, my_vecs) f_pattern = view_sphere.fin_pattern(direction, left_finproj, right_finproj, my_vecs)`
Hi @charliebrookerBH - Thank you for sharing the code and thank you for the kind words. The better place to ask this question is the forum under the scripting category: https://discourse.ladybug.tools/c/scripting/28
Thanks Mostapha! Still getting my head around this.
Hi @chriswmackey and team,
Big fan of your tools and massively appreciate the work you've put into them. I'm a python beginner and I'm trying to start going beyond using the provided components and start building some of my own using the available codebase.
A problem I've come up against is combining the fin_pattern method with the sky dome vectors. As the sky dome has a 0,0,1 vector for the top most patch when I try and input the sky dome vectors as view_vectors in fin_pattern it then throws a DivideByZeroException for the 2D angle method.
Is there a solution to this?
In my use case, having angle return 0 when the DivideByZeroException error occurs would be an ideal solution, but understand this might not be appropriate for all operations.
Thanks! Charlie
PS I haven't assigned, labelled, or any of that stuff, not sure what your protocol is for this.