domingo, 31 de marzo de 2024

sábado, 30 de marzo de 2024

Retrieve plain text from website - from xpath pointer

 const element = document.evaluate("//*[@id='__next']//div", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
const innerText = element ? element.innerText : "Element not found";
console.log(innerText);


jueves, 28 de marzo de 2024

EXCEL Power Query - keep the file name

 = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"Column1", type text}})

sábado, 23 de marzo de 2024

Representación gràfica de bobinados (Autocad)







(defun c: capdew()
    (setq pt1(getpoint "\nEnter first point: ")); Ask the user to select the first point
        (setq pt2(getpoint "\nEnter second point: ")); Ask the user to select the second point

    ; Get the X and Y coordinates of pt1
        (setq pt1_x(car pt1))
        (setq pt1_y(cadr pt1))

    ; Get the X and Y coordinates of pt2
        (setq pt2_x(car pt2))
        (setq pt2_y(cadr pt2))

    ; Calculate the middle point
        (setq mid_pt_x(/ (+ pt1_x pt2_x) 2.0))
            (setq mid_pt_y(/ (+ pt1_y pt2_y) 2.0))
  
  ; Calculate vertical distance relative to mid_pt_x
    (setq vertical_distance(* -0.5(/ (- pt2_x pt1_x) 2.0)))
  
  ; Calculate the Y coordinate of the perpendicular point
    (setq mid_pt_y_perpendicular(+ mid_pt_y vertical_distance))

    (setq mid_pt(list mid_pt_x mid_pt_y)); Create a list for the middle point
        (setq perpendicular_pt(list mid_pt_x mid_pt_y_perpendicular)) ; Create a list for the perpendicular point

            (setq extended_line_end(list pt2_x mid_pt_y_perpendicular)) ; Create a list for the end point of the extended line

                (command "line" pt1 perpendicular_pt pt2); Draw the lines
  

)

(defun c: capdev()
    (setq pt1(getpoint "\nEnter first point: ")); Ask the user to select the first point
        (setq pt2(getpoint "\nEnter second point: ")); Ask the user to select the second point

    ; Get the X and Y coordinates of pt1
        (setq pt1_x(car pt1))
        (setq pt1_y(cadr pt1))

    ; Get the X and Y coordinates of pt2
        (setq pt2_x(car pt2))
        (setq pt2_y(cadr pt2))

    ; Calculate the middle point
        (setq mid_pt_x(/ (+ pt1_x pt2_x) 2.0))
            (setq mid_pt_y(/ (+ pt1_y pt2_y) 2.0))
  
  ; Calculate vertical distance relative to mid_pt_x
    (setq vertical_distance(* 0.5(/ (- pt2_x pt1_x) 2.0)))
  
  ; Calculate the Y coordinate of the perpendicular point
    (setq mid_pt_y_perpendicular(+ mid_pt_y vertical_distance))

    (setq mid_pt(list mid_pt_x mid_pt_y)); Create a list for the middle point
        (setq perpendicular_pt(list mid_pt_x mid_pt_y_perpendicular)) ; Create a list for the perpendicular point

            (setq extended_line_end(list pt2_x mid_pt_y_perpendicular)) ; Create a list for the end point of the extended line

                (command "line" pt1 perpendicular_pt pt2); Draw the lines

                    (princ(strcat "\nThe middle point coordinates are: "(rtos mid_pt_x) ","(rtos mid_pt_y)))
                    (princ(strcat "\nThe perpendicular point coordinates are: "(rtos mid_pt_x) ","(rtos mid_pt_y_perpendicular)))
)