Aug 15, 2003 #1 C Clive Usenet Archive Joined Apr 28, 2001 Messages 9 Reaction score 0 Anybody have sample code for xline IE Pick a point and per to a Vlax-curve-object. Regards Clive. To all in this group. Thanks
Anybody have sample code for xline IE Pick a point and per to a Vlax-curve-object. Regards Clive. To all in this group. Thanks
Aug 17, 2003 #2 J Joe Burke Usenet Archive Joined May 28, 2000 Messages 653 Reaction score 0 Clive, This proved a bit more complicated than I expected. But I think it works. (defun cerXline ( / vobj p1 p2) (setq vobj (vlax-ename->vla-object (car (entsel "Select object: ")))) (setq p2 (getpoint "\nPick point: ")) (setq p1 (vlax-curve-getClosestPointTo vobj p2)) (entmake (list '(0 . "XLINE") '(100 . "AcDbEntity") '(100 . "AcDbXline") (cons 10 p1) (cons 11 (mapcar '- p2 p1)) ) ) (princ) ) Note, the 11 code of an xline is a vector. Joe Burke
Clive, This proved a bit more complicated than I expected. But I think it works. (defun cerXline ( / vobj p1 p2) (setq vobj (vlax-ename->vla-object (car (entsel "Select object: ")))) (setq p2 (getpoint "\nPick point: ")) (setq p1 (vlax-curve-getClosestPointTo vobj p2)) (entmake (list '(0 . "XLINE") '(100 . "AcDbEntity") '(100 . "AcDbXline") (cons 10 p1) (cons 11 (mapcar '- p2 p1)) ) ) (princ) ) Note, the 11 code of an xline is a vector. Joe Burke