weldx_widgets/widget_groove_sel.py
def create_csm_and_plot(self, change=None, plot=True, **kwargs):
        """Create coordinates system manager containing TCP movement."""
        if change is not None:
            # update, except for 2d view.
            if change.get("new", -1) == 0:
                return

        # TODO: only create once and then update the csm!

        # create a linear trace segment a the complete weld seam trace
        trace_segment = weldx.LinearHorizontalTraceSegment(self.seam_length.quantity)
        trace = weldx.Trace(trace_segment)

        # create 3d workpiece geometry from the groove profile and trace objects
        geometry = weldx.Geometry(
            self.groove_sel.groove_obj.to_profile(width_default=Q_(5, "mm")), trace
        )

        # rasterize geometry
        profile_raster_width = self.geometry_export.profile_raster_width.quantity
        trace_raster_width = self.geometry_export.trace_raster_width.quantity

        # crete a new coordinate system manager with default base coordinate system
        csm = weldx.CoordinateSystemManager(
            "base", coordinate_system_manager_name="design"
        )

        # add the workpiece coordinate system
        csm.add_cs(
            coordinate_system_name="workpiece",
            reference_system_name="base",
            lcs=trace.coordinate_system,
        )

        # add the geometry data of the specimen
        sp_specimen = geometry.spatial_data(profile_raster_width, trace_raster_width)
        sp_specimen.plot(backend="k3d")
        csm.assign_data(
            sp_specimen,
            "specimen",
            "workpiece",
        )
        self.geometry_export.geometry = sp_specimen

        tcp_y = self.tcp_y.float_value
        tcp_z = self.tcp_z.float_value
        tcp_start_point = Q_([5.0, tcp_y, tcp_z], "mm")
        tcp_end_point = Q_([self.seam_length.float_value - 5.0, tcp_y, tcp_z], "mm")

        v_weld = self.weld_speed.quantity
        s_weld = (tcp_end_point - tcp_start_point)[0]  # length of the weld
        t_weld = s_weld / v_weld

        t_start = pd.Timedelta("0s")
        t_end = pd.Timedelta(str(t_weld))

        rot = weldx.WXRotation.from_euler("x", 180, degrees=True)

        coords = [tcp_start_point.magnitude, tcp_end_point.magnitude]

        tcp_wire = weldx.LocalCoordinateSystem(
            coordinates=coords, orientation=rot, time=[t_start, t_end]
        )

        csm.add_cs(
            coordinate_system_name="TCP design",
            reference_system_name="workpiece",
            lcs=tcp_wire,
        )

        self.csm = csm

        if plot:
            self.plot()
Create coordinates system manager containing TCP movement.
Create coordinates system manager containing TCP movement.
Create coordinates system manager containing TCP movement .
def create_csm_and_plot(self, change=None, plot=True, **kwargs):
        if change is not None:
            if change.get("new", -1) == 0:
                return
        trace_segment = weldx.LinearHorizontalTraceSegment(self.seam_length.quantity)
        trace = weldx.Trace(trace_segment)
        geometry = weldx.Geometry(
            self.groove_sel.groove_obj.to_profile(width_default=Q_(5, "mm")), trace
        )
        profile_raster_width = self.geometry_export.profile_raster_width.quantity
        trace_raster_width = self.geometry_export.trace_raster_width.quantity
        csm = weldx.CoordinateSystemManager(
            "base", coordinate_system_manager_name="design"
        )
        csm.add_cs(
            coordinate_system_name="workpiece",
            reference_system_name="base",
            lcs=trace.coordinate_system,
        )
        sp_specimen = geometry.spatial_data(profile_raster_width, trace_raster_width)
        sp_specimen.plot(backend="k3d")
        csm.assign_data(
            sp_specimen,
            "specimen",
            "workpiece",
        )
        self.geometry_export.geometry = sp_specimen
        tcp_y = self.tcp_y.float_value
        tcp_z = self.tcp_z.float_value
        tcp_start_point = Q_([5.0, tcp_y, tcp_z], "mm")
        tcp_end_point = Q_([self.seam_length.float_value - 5.0, tcp_y, tcp_z], "mm")
        v_weld = self.weld_speed.quantity
        s_weld = (tcp_end_point - tcp_start_point)[0]  
        t_weld = s_weld / v_weld
        t_start = pd.Timedelta("0s")
        t_end = pd.Timedelta(str(t_weld))
        rot = weldx.WXRotation.from_euler("x", 180, degrees=True)
        coords = [tcp_start_point.magnitude, tcp_end_point.magnitude]
        tcp_wire = weldx.LocalCoordinateSystem(
            coordinates=coords, orientation=rot, time=[t_start, t_end]
        )
        csm.add_cs(
            coordinate_system_name="TCP design",
            reference_system_name="workpiece",
            lcs=tcp_wire,
        )
        self.csm = csm
        if plot:
            self.plot()
def create_csm_and_plot ( self , change = None , plot = True , ** kwargs ) : if change is not None : if change . get ( "new" , - 1 ) == 0 : return trace_segment = weldx . LinearHorizontalTraceSegment ( self . seam_length . quantity ) trace = weldx . Trace ( trace_segment ) geometry = weldx . Geometry ( self . groove_sel . groove_obj . to_profile ( width_default = Q_ ( 5 , "mm" ) ) , trace ) profile_raster_width = self . geometry_export . profile_raster_width . quantity trace_raster_width = self . geometry_export . trace_raster_width . quantity csm = weldx . CoordinateSystemManager ( "base" , coordinate_system_manager_name = "design" ) csm . add_cs ( coordinate_system_name = "workpiece" , reference_system_name = "base" , lcs = trace . coordinate_system , ) sp_specimen = geometry . spatial_data ( profile_raster_width , trace_raster_width ) sp_specimen . plot ( backend = "k3d" ) csm . assign_data ( sp_specimen , "specimen" , "workpiece" , ) self . geometry_export . geometry = sp_specimen tcp_y = self . tcp_y . float_value tcp_z = self . tcp_z . float_value tcp_start_point = Q_ ( [ 5.0 , tcp_y , tcp_z ] , "mm" ) tcp_end_point = Q_ ( [ self . seam_length . float_value - 5.0 , tcp_y , tcp_z ] , "mm" ) v_weld = self . weld_speed . quantity s_weld = ( tcp_end_point - tcp_start_point ) [ 0 ] t_weld = s_weld / v_weld t_start = pd . Timedelta ( "0s" ) t_end = pd . Timedelta ( str ( t_weld ) ) rot = weldx . WXRotation . from_euler ( "x" , 180 , degrees = True ) coords = [ tcp_start_point . magnitude , tcp_end_point . magnitude ] tcp_wire = weldx . LocalCoordinateSystem ( coordinates = coords , orientation = rot , time = [ t_start , t_end ] ) csm . add_cs ( coordinate_system_name = "TCP design" , reference_system_name = "workpiece" , lcs = tcp_wire , ) self . csm = csm if plot : self . plot ( )
Create coordinates system manager containing TCP movement.
Create coordinates system manager containing TCP movement .
"""Create coordinates system manager containing TCP movement.""" # update, except for 2d view. # TODO: only create once and then update the csm! # create a linear trace segment a the complete weld seam trace # create 3d workpiece geometry from the groove profile and trace objects # rasterize geometry # crete a new coordinate system manager with default base coordinate system # add the workpiece coordinate system # add the geometry data of the specimen # length of the weld
self
change
plot