Hi guys!
I am trying to relate the columns of two CSV files to get information from one to the other using a pivot column that has values in common.
One file has information with coordinates, azimuth, inclination of an exploration drill hole, while the other has information of segments of each drill hole, so there are several entries of the same element in the pivot column.
I want to draw each drill by segments, but I need the coordinates, azimuth and inclination to be able to draw it, I am trying to search it in the other file with a comparison within a cycle, but it seems that it makes the search only once, and I can't find what's wrong.
(setq IDp "")
(setq fo2 (open fo2n "R"))
(setq lst2 '())
(setq fo (open fon "R"))
(setq lst '())
(while (setq nline (read-line fo))
(setq lst (cons (_csv->lst nline) lst))
(setq lst (nth 0 lst))
(setq ID (nth 0 lst) from (nth 1 lst) to (nth 2 lst) AU (nth 3 lst) AG (nth 4 lst) PB (nth 5 lst) ZN (nth 6 lst) CU (nth 7 lst))
(if (/= IDp ID)
(progn
(while (setq nline (read-line fo2))
(setq lst2 (cons (_csv->lst nline) lst2))
(setq lst2 (nth 0 lst2))
(if (= ID (nth 0 lst2))
(progn
(setq X (nth 1 lst2) Y (nth 2 lst2) Z (nth 3 lst2) depth (nth 4 lst2) azim (nth 5 lst2) inclin (nth 6 lst2))
(setq romp (list (atof X) (atof Y) (atof Z)))
(setq az (dtr (aztocad (atof azim))))
(setq incl (atof inclin))
(Text romp 1 (nth 0 lst2))
);progn
);if
); while
);progn
);if
(setq prof (- (atof to) (atof from)))
(setq ptend (pol3d romp az (DTR incl) prof))
(if (= disco "1")
(progn
(setq 3dline (Line romp ptend))
(setq profile (Circle pto_c rad2))
(command "_sweep" "_MO" "_SO" profile "" 3dline)
);progn
(setq 3dline (Linew romp ptend))
);if
(setq romp ptend)
(setq IDp ID)
);while