i have a problem, as with the flatten command i need to project 3dpoly onto the current UCS.
As you can see in the following picture, the 3dpoly in cyan must be projected onto the current UCS, the result must be like the green 3dpoly (the red line is only for generating the UCS).
At this link I found the following code:
https://www.cadtutor.net/forum/topic/62788-get-ucs-coordinates-of-a-3d-polyline/the following code collects the vertex coordinates in local coordinates of the UCS and then exports them to file, I would need help to reset the z coordinates of the L list (in local coordinates) then reproject them into the WCS system and replace the original coordinates.... who can help me ?
; Pline's vertices to txt file
(defun C:test ( / LM:group-n SS i o e L fp opn )
;; Group by Number - Lee Mac
;; Groups a list 'l' into a list of lists, each of length 'n'
(defun LM:group-n ( l n / r )
(if l
(cons
(reverse (repeat n (setq r (cons (car l) r) l (cdr l)) r))
(LM:group-n l n)
)
)
)
(cond
(
(not
(progn
(setq SS (ssget '((0 . "*POLYLINE"))))
(repeat (setq i (sslength SS))
(setq o (vlax-ename->vla-object (setq e (ssname SS (setq i (1- i))))))
(if (vlax-property-available-p o 'Coordinates)
(setq L (cons (cons (cdr (assoc 210 (entget e))) (LM:group-n (vlax-get o 'Coordinates) 3)) L))
)
); repeat
L
)
)
(princ "\nInvalid objects selected.")
)
( (not (setq fp (getfiled "Create vertices data" "" "txt" 1)))
(princ "\nText file not specified.")
)
( (setq opn (open fp "w"))
(princ "X \tY \tZ" opn)
(mapcar
'(lambda (a b)
(mapcar
'(lambda (x)
(princ
(strcat "\n"
(vl-string-left-trim "\t"
(vl-string-right-trim ", "
(apply 'strcat (mapcar '(lambda (n) (strcat "\t" (rtos n 2 2) ", ")) (trans x a 1)))
)
)
)
opn
)
)
b
)
)
(mapcar 'car L)
(mapcar 'cdr L)
)
(close opn)
(initget "Yes No")
(if (= "Yes" (cond ((getkword "\nDo you want to open the file? [Yes/No] <Yes>: ")) ("Yes")))
(startapp "explorer" fp)
)
)
); cond
(princ)
);| defun |; (vl-load-com) (princ)