brams Posted June 21, 2012 Share Posted June 21, 2012 Hi Guys, I work on a lisp that will extract radius from circles in a drawing and insert these values in a table (and a number for each circle...). I want to use data taken from some cells, i don't know how. Any help? Some example? Some links? Some tutorials for table in visual lisp? Thanks! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 21, 2012 Share Posted June 21, 2012 Since operations involving Table values in most cases involve specification of a row and column, the VLA Table Object is predominantly manipulated using Visual LISP methods rather than properties (which only use a single parameter). To find the properties and methods associated with a Table Object, use the vlax-dump-object function: (defun c:dump ( / en ) (if (setq en (car (entsel))) (vlax-dump-object (vlax-ename->vla-object en) t) ) (princ) ) (vl-load-com) (princ) You can then find information about each of these methods in the Visual LISP IDE Help Documentation; the documentation is written for VBA, but the parameter data types and their order translate directly to Visual LISP in most cases. To retrieve data from Table Cells, look specifically into the GetText / GetValue / GetCellValue methods. Quote Link to comment Share on other sites More sharing options...
brams Posted June 21, 2012 Author Share Posted June 21, 2012 Best answer possible. Thanks, Lee Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 21, 2012 Share Posted June 21, 2012 You're welcome, ask if you need further assistance Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 21, 2012 Share Posted June 21, 2012 What you mean by this .... ? (and a number for each circle...) Quote Link to comment Share on other sites More sharing options...
brams Posted June 21, 2012 Author Share Posted June 21, 2012 A order number - in table and in circle's center. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 21, 2012 Share Posted June 21, 2012 Things like this .... ? (defun c:Test (/ hgt spc d dia e ents inc increment Layers insertionPoint tbl lengths lst r selectionset integer selectionsetname ) (vl-load-com) ;;; Tharwat 21 . June . 2012 ;;; (if (not acdoc) (setq acdoc (vla-get-activedocument (vlax-get-acad-object))) ) (setq spc (if (> (vla-get-activespace acdoc) 0) (vla-get-modelspace acdoc) (vla-get-paperspace acdoc) ) ) (setq hgt (if (zerop (cdr (assoc 40 (setq e (entget (tblobjname "STYLE" (getvar 'textstyle))) ) ) ) ) (cdr (assoc 42 e)) (cdr (assoc 40 e)) ) ) (setq increment 1) (if (setq selectionset (ssget (list '(0 . "CIRCLE")))) (progn (repeat (setq integer (sslength selectionset)) (setq selectionsetname (ssname selectionset (setq integer (1- integer)) ) ) (setq dia (cons (cons (* (cdr (assoc 40 (entget selectionsetname))) 2.) (itoa increment) ) dia ) ) (setq ents (cons selectionsetname ents)) (setq increment (1+ increment)) ) ) ) (if (and dia (setq insertionPoint (getpoint "\n Specify Table Location :")) ) (progn (setq tbl (vla-addtable spc (vlax-3d-point insertionPoint) (+ (length dia) 2) 2 (* hgt 2.5) (* hgt 2.5) ) ) (setq inc -1 r 1 ) (repeat 2 (vla-setcolumnwidth tbl 0 (* hgt 10.)) (vla-setcolumnwidth tbl 1 (* hgt 10.)) (vla-setrowheight tbl (setq inc (1+ inc)) (* hgt 1.5)) ) (vla-settext tbl 0 0 "Circle's Diameters") (vla-settext tbl 1 0 "Reference No.") (vla-settext tbl 1 1 "Diameter Value") (foreach x (reverse dia) (vla-settext tbl (setq r (1+ r)) 0 (cdr x)) (vla-setcellalignment tbl r 0 acMiddleCenter) (vla-settext tbl r 1 (rtos (car x) 2)) (vla-setcellalignment tbl r 1 acMiddleCenter) ) (setq increment 1) (foreach p (reverse ents) (setq d (* (cdr (assoc 40 (entget p))) 2.)) (entmakex (list '(0 . "TEXT") (assoc 10 (entget p)) (cons 11 (cdr (assoc 10 (entget p)))) (cons 40 (if (> increment 9) (/ d 1.5) (if (> hgt d) d hgt ) ) ) (cons 1 (itoa increment)) '(72 . 1) '(73 . 2) ) ) (setq increment (1+ increment)) ) ) ) (princ "\n Written by Tharwat Al Shoufi") (princ) ) Quote Link to comment Share on other sites More sharing options...
brams Posted June 22, 2012 Author Share Posted June 22, 2012 Thanks, Tharwat. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 22, 2012 Share Posted June 22, 2012 Thanks, Tharwat. You're welcome brams 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.