handasa Posted August 28, 2016 Share Posted August 28, 2016 Greetings every one : this lisp was developed by Mr.Tharwat somewhere in this website (defun c:Test (/ s f o) ;; Tharwat 26. 08. 2015 ; (princ "\nSelect LWpolylines to export to Excel file :") (if (and (setq s (ssget '((0 . "LWPOLYLINE")))) (setq f (getfiled "Specify File Name" (getvar 'DWGPREFIX) "csv" 1)) (setq o (open f "w")) ) (progn ((lambda (r / e) (while (setq e (ssname s (setq r (1+ r)))) (write-line (rtos (vlax-curve-getdistatparam e (vlax-curve-getendparam e)) 2 4) o) )) -1) (close o) ) ) (princ) ) how can i add heperlinks of selected polylines to the exported csv file so that the exported files looks like as follow thanks in advance Quote Link to comment Share on other sites More sharing options...
Tharwat Posted August 28, 2016 Share Posted August 28, 2016 (edited) Hi, Try this [uNTESTED] mods on the codes and let me know: (defun c:Test (/ s f o) ;; Tharwat 28. 08. 2016 ; (princ "\nSelect LWpolylines to export to Excel file :") (if (and (setq s (ssget '((0 . "LWPOLYLINE")))) (setq f (getfiled "Specify File Name" (getvar 'DWGPREFIX) "csv" 1)) (setq o (open f "w")) ) (progn (write-line "Polyline Length;Polyline Hyperlink" o) ((lambda (r / e l d ur) (while (setq e (ssname s (setq r (1+ r)))) (vlax-for hp (vla-get-hyperlinks (vlax-ename->vla-object e)) (if (setq ur (vla-get-url hp)) ur) ) (write-line (strcat (rtos (vlax-curve-getdistatparam e (vlax-curve-getendparam e)) 2 4) ";" (if ur ur "")) o) )) -1) (close o) ) ) (princ) )(vl-load-com) Edited August 29, 2016 by Tharwat Quote Link to comment Share on other sites More sharing options...
handasa Posted August 29, 2016 Author Share Posted August 29, 2016 thanks mr.tharwat ... but the lisp export empty cells for hyperlinks in the csv files Quote Link to comment Share on other sites More sharing options...
handasa Posted August 29, 2016 Author Share Posted August 29, 2016 another lisp written by you (mr.tharwat) that i tried and added part that extract the hyperlinks and lengths to the table thanks mr.tharwat for your lisps and efforts (defun c:ltt (/ pt2 pt3 s x y doc objtable numrows rowheight pt1 colwidth curspace) ;; Tharwat 26. 08. 2015 ; ;; mods by BIGAL 29.08.2015 now as table (vl-load-com) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq curspace (vla-get-modelspace doc)) (setq pt1 (vlax-3d-point (getpoint "\nPick point for top left hand of table: "))) ;(princ "\nSelect LWpolylines to export to a Table :") (setq pt2 (getpoint "Select by fence-line 1st set of entities : ")) (setq pt3 (getpoint pt2 "2nd point of fence-line: ") s (ssget "F" (list pt2 pt3)) ) ;_ end of setq ;(setq s (ssget '((0 . "LWPOLYLINE")))) (if (/= s nil) (progn ; now do table (setq numrows (+ 2 (sslength s))) (setq numcolumns 3) (setq rowheight 7) (setq colwidth 25) (setq objtable (vla-addtable curspace pt1 numrows numcolumns rowheight colwidth)) (vla-settext objtable 0 0 "Pline lengths") (vla-setcolumnwidth objtable 0 10) (vla-setcolumnwidth objtable 1 25) (vla-settext objtable 1 0 "Pline") (vla-settext objtable 1 1 "Length") (vla-settext objtable 1 2 "hyperlinks") (vla-SetTextHeight Objtable (+ acDataRow acHeaderRow acTitleRow) 2.5) (vla-SetAlignment Objtable acDataRow acMiddleCenter) (setq x 1) (SETQ Y 2) (setq r -1) ;((lambda (r / e) (while (setq e (vlax-ename->vla-object(ssname s (setq r (1+ r))))) (vla-settext objtable Y 0 (rtos x 2 0)) (vla-settext objtable Y 1 (rtos (vla-get-length e) 2 4)) (setq hypers (vlax-get-property e 'Hyperlinks)) (vla-settext objtable Y 2 (vlax-get-property (vla-item hypers 0) 'URL)) ;(setq vlaObj (vlax-ename->vla-object en)) ;(setq hypers (vlax-get-property e 'Hyperlinks)) (setq x (1+ x )) (setq y (1+ Y )) ); while ; )) ;lambda ) ;progn (alert "You have not picked any plines run again") ) ; if (princ) ) ; defun Quote Link to comment Share on other sites More sharing options...
Tharwat Posted August 29, 2016 Share Posted August 29, 2016 thanks mr.tharwat ... but the lisp export empty cells for hyperlinks in the csv files Can you upload a sample drawing? Quote Link to comment Share on other sites More sharing options...
handasa Posted August 29, 2016 Author Share Posted August 29, 2016 The attached dwg file contains polylines with hyperlinks numbered from 1 to 8POLYLINES WITH HYPERLINKS.dwg Quote Link to comment Share on other sites More sharing options...
Tharwat Posted August 29, 2016 Share Posted August 29, 2016 I updated the codes above so please try again. Quote Link to comment Share on other sites More sharing options...
handasa Posted August 30, 2016 Author Share Posted August 30, 2016 I updated the codes above so please try again. thanks mr.tharwat the lisp worked perfectly Quote Link to comment Share on other sites More sharing options...
Tharwat Posted August 30, 2016 Share Posted August 30, 2016 thanks mr.tharwat the lisp worked perfectly You are most welcome. Thank you for your reply. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.