示例#1
0
    def get_frame_axes_as_lines(self):
        ''' this method allows you to visualize the tool axes as lines and gh colors '''

        tool_axes = self.frame.get_axes_as_lines(length=100)
        tool_axes_colors = [
            ghcomp.ColourRGB(255, 255, 0, 0),
            ghcomp.ColourRGB(255, 0, 255, 0),
            ghcomp.ColourRGB(255, 0, 0, 255)
        ]

        return tool_axes, tool_axes_colors
示例#2
0
    def __init__(self, geo, tool_plane, cam_plane):

        Tool.__init__(self, geo, tool_plane)

        self.p1_fixed, self.p2_rotfront, self.p3_rotback_frame, self.p3_rotback_gripper_ret, self.p3_rotback_gripper_ext, self.collision_geo = self.geo
        #self.p1_fixed_wcs, self.p2_rotfront_wcs, self.p3_rotback_frame_wcs, self.p3_rotback_gripper_ret_wcs, self.p3_rotback_gripper_ext_wcs, self.collision_geo_wcs = self.geo_WCS

        self.cam_plane = cam_plane

        self.colors = [
            ghcomp.ColourRGB(100, 100, 100 + i * 20, 150 + i * 20)
            for i, part in enumerate(self.geo)
        ]
        self.colors[-1] = ghcomp.ColourRGB(100, 255, 80, 110)
示例#3
0
    def __init__(self, geo, tool_plane):

        Tool.__init__(self, geo, tool_plane)

        self.collision_geo = self.geo
        self.colors = [
            ghcomp.ColourRGB(100, 100, 150, 200)
            for i, part in enumerate(self.geo)
        ]
示例#4
0
    def __init__(self,
                 link_geo,
                 base_geo,
                 joint_planes,
                 ip_abb='192.168.125.1',
                 tool=None):
        ''' the robot class, it contains:
        1) the geometry of the robot
        2) the communication modules to send commands to the ABB arm.
        '''

        self.link_geo = link_geo
        self.base_geo = base_geo

        self.joint_planes = joint_planes
        self.tool = tool  # has to be set with the Tool class

        self.origin_plane = rg.Plane.WorldXY

        self.joint_values = [0, 0, 0, 0, 0, 0]

        # transform world to robot origin
        self.T_W_R = rg.Transform.PlaneToPlane(rg.Plane.WorldXY,
                                               self.origin_plane)
        # transform robot to world
        self.T_R_W = rg.Transform.PlaneToPlane(self.origin_plane,
                                               rg.Plane.WorldXY)

        geo = self.get_geo_with_rotated_joints_in_world(self.joint_values)
        # --> then self.T_R_TOOL0 and self.T_W_TOOL0 are set

        self.comm = ABBCommunication("ABB",
                                     ip_abb,
                                     port_snd=30003,
                                     port_rcv=30004)

        self.colors_links = [
            ghcomp.ColourRGB(150, 220, 220, 220) for part in link_geo
        ]
        self.colors_base = [
            ghcomp.ColourRGB(150, 220, 220, 220) for part in base_geo
        ]
示例#5
0
def colorMeshFromRoom(_room):
    """Returns a mesh, colored by some logic

    

    Takes in a room, converts it to 

    a mesh and colors it depending on the type of 

    fresh-air venilation flow (Sup, Ext, Mixed)

    """

    room_srfcs_colored = []

    for srfcCount, srfc in enumerate(_room.TFAsurface):

        if _room.V_sup > 0 and _room.V_eta == 0:

            color = ghc.ColourRGB(255, 183, 227, 238)  # Blueish

        elif _room.V_sup == 0 and _room.V_eta > 0:

            color = ghc.ColourRGB(255, 246, 170, 154)  # Redish

        elif _room.V_sup > 0 and _room.V_eta > 0:

            color = ghc.ColourRGB(255, 234, 192, 240)  # White

        else:

            color = ghc.ColourRGB(255, 235, 235, 235)  # White

        room_srfcs_colored.append(ghc.MeshColours(srfc, color))

    return room_srfcs_colored
示例#6
0
def colorMeshFromRoom(_room):
    """Returns a mesh, colored by some logic

    

    Takes in a room, converts it to 

    a mesh and colors it depending on the srfcs TFA

    """

    room_srfcs_colored = []

    for srfcCount, srfc in enumerate(_room.TFAsurface):

        srfc_tfaFactor = _room.TFAfactors[srfcCount]

        if srfc_tfaFactor > 0.6:

            color = ghc.ColourRGB(255, 255, 255, 17)

        elif srfc_tfaFactor <= 0.6 and srfc_tfaFactor > 0.5:

            color = ghc.ColourRGB(255, 189, 103, 107)

            #color = ghc.ColourRGB(255,189,103,107)

        elif srfc_tfaFactor <= 0.5 and srfc_tfaFactor > 0.3:

            color = ghc.ColourRGB(255, 154, 205, 50)

        elif srfc_tfaFactor <= 0.5 and srfc_tfaFactor > 0.3:

            color = ghc.ColourRGB(255, 0, 255, 127)

        elif srfc_tfaFactor == 0:

            color = ghc.ColourRGB(255, 238, 130, 238)

        else:

            color = ghc.ColourRGB(255, 238, 130, 238)

        room_srfcs_colored.append(ghc.MeshColours(srfc, color))

    return room_srfcs_colored
示例#7
0
    def __init__(self, geo, tool_plane):
        ''' tool class for the robot 
        geo = tool geometry as list
        plane = defined tool plane
        geo_trfd = tool geometry transformed that the defined tool plane is aligned with the world xy plane
        '''

        self.geo = geo
        self.plane = tool_plane
        self.frame = Frame(self.plane, draw_geo=True)

        self.T = rg.Transform.PlaneToPlane(self.plane, rg.Plane.WorldXY)
        self.geo_WCS = ghcomp.Transform(self.geo,
                                        self.T)  # tool aligned_with_WCS

        self.plane_WCS = ghcomp.Transform(self.plane,
                                          self.T)  # should be WorldXY plane

        self.collision_geo = self.geo
        self.colors = [
            ghcomp.ColourRGB(100, 100, 150, 200)
            for i, part in enumerate(self.geo)
        ]
示例#8
0
ghenv.Component.Message = 'JUN_07_2020'
ghenv.Component.IconDisplayMode = ghenv.Component.IconDisplayMode.application
ghenv.Component.Category = "BT"
ghenv.Component.SubCategory = "03 | PDF"

from System import Object
from Grasshopper import DataTree
from Grasshopper.Kernel.Data import GH_Path
import ghpythonlib.components as ghc

geom_ = DataTree[Object]()
pageLabels_ = DataTree[Object]()
filenames_ = []

rad = highlightSize_ if highlightSize_ else 0.1
highlightC = highlightColor_ if highlightColor_ else ghc.ColourRGB(255,255,255,183)

if len(_thermalBridges) > 0:
    for i, tb in enumerate(_thermalBridges):
        
        if tb.geometry == None:
            break
        
        # Add the highlight Geometry to the Tree
        geom = ghc.Pipe(tb.geometry, rad, 2)
        geom = ghc.MeshColours(geom, highlightC)
        geom_.Add(geom, GH_Path(i))
        
        # Add the Text
        txt = []
        txt.append('{}-{}'.format(tb.IDNumber, tb.Name))
示例#9
0
    def __init__(self,
                 link_geo,
                 base_geo,
                 joint_planes,
                 ip_abb='192.168.125.1',
                 tool=None,
                 gantry=None):
        ''' the robot class, it contains:
        1) the geometry of the robot
        2) the communication modules to send commands to the ABB arm.
        '''

        self.link_geo = link_geo
        self.base_geo = base_geo

        self.joint_planes = joint_planes
        self.tool = tool  # has to be set with the Tool class
        self.gantry = gantry  # has to be set with the Gantry class

        self.origin_plane_1 = rg.Plane.WorldXY
        self.origin_plane_2 = rg.Plane.WorldXY
        self.origin_plane_3 = rg.Plane.WorldXY
        self.origin_plane_4 = rg.Plane.WorldXY

        self.joint_values = [0 for i in range(36)]

        # transform world to robot origin
        self.T_W_R_1 = rg.Transform.PlaneToPlane(rg.Plane.WorldXY,
                                                 self.origin_plane_1)
        self.T_W_R_2 = rg.Transform.PlaneToPlane(rg.Plane.WorldXY,
                                                 self.origin_plane_2)
        self.T_W_R_3 = rg.Transform.PlaneToPlane(rg.Plane.WorldXY,
                                                 self.origin_plane_3)
        self.T_W_R_4 = rg.Transform.PlaneToPlane(rg.Plane.WorldXY,
                                                 self.origin_plane_4)
        # transform robot to world
        self.T_R_W_1 = rg.Transform.PlaneToPlane(self.origin_plane_1,
                                                 rg.Plane.WorldXY)
        self.T_R_W_2 = rg.Transform.PlaneToPlane(self.origin_plane_2,
                                                 rg.Plane.WorldXY)
        self.T_R_W_3 = rg.Transform.PlaneToPlane(self.origin_plane_3,
                                                 rg.Plane.WorldXY)
        self.T_R_W_4 = rg.Transform.PlaneToPlane(self.origin_plane_4,
                                                 rg.Plane.WorldXY)

        geo_1 = self.get_geo_with_rotated_joints_in_world(
            self.joint_values[0:6], 1)
        geo_2 = self.get_geo_with_rotated_joints_in_world(
            self.joint_values[9:15], 2)
        geo_3 = self.get_geo_with_rotated_joints_in_world(
            self.joint_values[18:24], 3)
        geo_4 = self.get_geo_with_rotated_joints_in_world(
            self.joint_values[27:33], 4)
        # --> then self.T_R_TOOL0 and self.T_W_TOOL0 are set

        self.comm = ABBCommunication("ABB",
                                     ip_abb,
                                     port_snd=30003,
                                     port_rcv=30004)

        self.colors_links = [
            ghcomp.ColourRGB(150, 220, 220, 220) for part in link_geo
        ]
        self.colors_base = [
            ghcomp.ColourRGB(150, 220, 220, 220) for part in base_geo
        ]