BLOACH85 Posted January 23, 2009 Share Posted January 23, 2009 Hey i left a previous thread and here it is a little simpler. This is a routine that will make a table it has one Header and the rest of the cells are for calculations. The table has one column and 15 rows. But when i execute the command the calculations are plotted in decimal form. If you check the properties of this table the cells are not data cells. What can i put in this routine to make these data cells? This is the biggest problem right now. so i need to get it to execute in feet, inches, and fractions. Then i would like someones expertise on getting the table to insert at the right size. Like based on the dimscale factor. Can Anyone Help? (DEFUN C:STUBS (/ WIDE COL ROW TB HIGH PT VA VO VM) (SETQ PT (VLAX-3D-POINT (GETPOINT))) (SETQ VO (VLAX-GET-ACAD-OBJECT)) (SETQ VA (VLA-GET-ACTIVEDOCUMENT VO)) (SETQ VM (VLA-GET-MODELSPACE VA)) (SETQ ROW 15) (SETQ COL 1) (SETQ HIGH 0.3875) (SETQ WIDE 1.25) (SETQ TB (VLA-ADDTABLE VM PT ROW COL HIGH WIDE)) ;(VLA-PUT-REGENERATETABLESUPPRESSED TB :VLAX-TRUE) (vla-settext tb 0 0 "STUBS") (vla-settext tb 1 0 (GETDIST "What is the first stub dimension?")) (vla-settext tb 2 0 "=A2*2") (vla-settext tb 3 0 "=A2*3") (vla-settext tb 4 0 "=A2*4") (vla-settext tb 5 0 "=A2*4") (vla-settext tb 6 0 "=A2*5") (vla-settext tb 7 0 "=A2*6") (vla-settext tb 8 0 "=A2*7") (vla-settext tb 9 0 "=A2*8") (vla-settext tb 10 0 "=A2*9") (vla-settext tb 11 0 "=A2*10") (vla-settext tb 12 0 "=A2*11") (vla-settext tb 13 0 "=A2*12") (vla-settext tb 14 0 "=A2*13") (vla-settext tb 15 0 "=A2*14") ) ;(vla-put-RegenerateTableSuppressed tb :vlax-TRUE ) (princ) );_ end My Question is, is there anyway to get the header row in a certain text style and the other cells in a different one? Quote Link to comment Share on other sites More sharing options...
fixo Posted January 23, 2009 Share Posted January 23, 2009 Try edited code, not sure about how it will works Change text styles names before running (defun C:STUBS (/ col count dis pr prec pt row strdis tb va vm vo) (setq pt (vlax-3d-point (getpoint "\nPick Insertion Point: "))) (setq vo (vlax-get-acad-object)) (setq va (vla-get-activedocument vo)) (setq vm (vla-get-modelspace va)) (setq row 16) (setq col 1) (setq dis (getdist "\nWhat Is The First Stub Dimension? : ")) (initget 6) (setq prec (getint "\nWhat Is The Number Of Decimal Places? : ")) (setq pr (getvar "LUPREC")) (setvar "LUPREC" prec) (if (not (vl-string-search "." (setq strdis (rtos dis 2 2)))) (setq strdis (strcat strdis ".00"))) (setq tb (vla-addtable vm pt row col 1 1)) (vla-put-titlesuppressed tb :vlax-false) (vla-put-headersuppressed tb :vlax-true) (vla-put-RegenerateTableSuppressed tb :vlax-true) (vla-put-vertcellmargin tb 0.1) (vla-put-horzcellmargin tb 0.25) (vla-setrowheight tb 0 0.4825) (vla-setcolumnwidth tb 0 2.4) (vla-settextstyle tb actitlerow "Romans");title text style (vla-settextstyle tb acdatarow "Standard");data rows text style (vla-settextheight tb actitlerow 0.27);title text height = 0.27 (vla-settextheight tb acdatarow 0.21);other cells text height = 0.21 (vla-setalignment tb actitlerow acmiddlecenter);title alignment (vla-setalignment tb acdatarow acmiddleleft);data cell alignment (vla-settext tb 0 0 "STUBS");title text (setq count 1) (while (< count row) (vla-setrowheight tb count 0.3875) (if (= count 1) (vla-settext tb count 0 strdis) (vla-settext tb count 0 (strcat "= A2*" (itoa count))) ) (setq count (1+ count))) (alert (vl-princ-to-string (vla-getcellformat tb (1- count) 0))) (vla-put-RegenerateTableSuppressed tb :vlax-false) (setvar "LUPREC" pr) (princ) );_ end (vl-load-com) ~'J'~ Quote Link to comment Share on other sites More sharing options...
BLOACH85 Posted January 26, 2009 Author Share Posted January 26, 2009 Hey i am very appreciative about your help. i Have one question about modifing this code. Its still in decimal for is there anyway to put in the vla-setdatatype function to make all of the rows architectual and set the current precision to 1/16? anymore help will be greatly appreciative!!! Quote Link to comment Share on other sites More sharing options...
BLOACH85 Posted January 26, 2009 Author Share Posted January 26, 2009 Ok well i got all of that figured out. so now my only problem is getting it to insert to the right dimscale Quote Link to comment Share on other sites More sharing options...
fixo Posted January 26, 2009 Share Posted January 26, 2009 Try edited version (defun C:STUBS (/ col count dis dmz lpc lup pt row strdis tb va vm vo) (setq pt (vlax-3d-point (getpoint "\nPick Insertion Point: "))) (setq vo (vlax-get-acad-object)) (setq va (vla-get-activedocument vo)) (setq vm (vla-get-modelspace va)) (setq row 16) (setq col 1) (setq dis (getdist "\nWhat Is The First Stub Dimension? : ")) (setq lup (getvar "lunits")) (setvar "lunits" 4) ; architectural units (setq lpc (getvar "luprec")) (setvar "luprec" 4) ;precision 1/16" (setq dmz (getvar "dimzin")) (setvar "dimzin" 1) ;includes both feet and inches for primary unit (setq strdis (rtos dis 4 3)) (setq tb (vla-addtable vm pt row col 1 1)) (vla-put-titlesuppressed tb :vlax-false) (vla-put-headersuppressed tb :vlax-true) (vla-put-RegenerateTableSuppressed tb :vlax-true) (vla-put-vertcellmargin tb 0.1) (vla-put-horzcellmargin tb 0.25) (vla-setrowheight tb 0 0.4825) (vla-setcolumnwidth tb 0 2.725) (vla-settextstyle tb actitlerow "Romans") ;title text style (vla-settextstyle tb acdatarow "Standard") ;data rows text style (vla-settextheight tb actitlerow 0.27) ;title text height = 0.27 (vla-settextheight tb acdatarow 0.21) ;other cells text height = 0.21 (vla-setalignment tb actitlerow acmiddlecenter) ;title alignment (vla-setalignment tb acdatarow acmiddleleft) ;data cell alignment (vla-settext tb 0 0 "STUBS") ;title text (setq count 1) (while (< count row) (vla-setrowheight tb count 0.3875) (if (= count 1) (progn (vla-settext tb count 0 strdis) (vla-setcellformat tb count 0 "%lu4%pr4"));lu4 - format in architectural units, pr4 - precision is 1/16" (progn (vla-settext tb count 0 (strcat "= A2*" (itoa count)));lu4 - format in architectural units, pr4 - precision is 1/16" (vla-setcellformat tb count 0 "%lu4%pr4") ) ) (setq count (1+ count)) ) (vla-put-RegenerateTableSuppressed tb :vlax-false) (setvar "luprec" lpc) (setvar "lunits" lup) (setvar "dimzin" dmz) (princ) ) ;_ end (vl-load-com) Forgot about, please, share your solution with community ~'J'~ 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.