Jump to content

Recommended Posts

Posted

In this lisp The result is right but some picky detailers want to know if they can be stacked. is there a vl function that could be incorporated into this table to do so?

 

 

(defun C:stt (/ 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 (+ 1 (getreal "\nHow many Stubs? : ")))
 (setq col 1)
 (setq dis (getdist "\nWhat Is The First Stub Dimension? : "))
 (setq lup (getvar "lunits"))
 (setvar "lunits" 5)      ; 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 4))
 (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.5)
 (vla-put-horzcellmargin tb 0.5)
 (vla-setrowheight tb 0 4.5)
 (vla-setcolumnwidth tb 0 16.1)
 
 (vla-settextstyle tb actitlerow  "bold")   ;title text style
 (vla-settextstyle tb acdatarow  "STANDARD")   ;data rows text style
 (vla-settextheight tb actitlerow  2.5)   ;title text height = 0.27
 (vla-settextheight tb acdatarow  1.75)    ;other cells text height = 0.21
 (vla-setalignment tb actitlerow acmiddlecenter) ;title alignment
 (vla-setalignment tb acdatarow acmiddlecenter)   ;data cell alignment
 (vla-settext tb 0 0 "STUBS")     ;title text
 (setq count 1)
 (while (< count row)
   (vla-setrowheight tb count 4.5)
   
   (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)

Posted

Tell the picky detailers that they are more than welcome to modify the code to do so.

Posted

you know that is the fastest that i have got an answer yet. And hey Lee Mac instead of scaling the table automatically it was easier to just set the row height column width and text size to work in a 24 X 36 dwg witch is standard for our stair details so if i have to use a bigger sheet then i will scale it. screw figuring it out. Dude there is no one on this earth that is more tired of looking at this routine than me. Thank everything that is holy that no if they want to fix it they need to learn lisp also!!! And thanks alot

Posted

so how do i incorporate this into the routine to where the fractions are stacked in the table?

Posted

Wrote this as a bit of fun :P

 

(defun stacknum     (num den typ)
 (cond    ((= typ "D")
    (setq txt (strcat "\{\\H0.7x;\\S" (itoa num) "#" (itoa den) ";\}")))
   ((= typ "H")
    (setq txt (strcat "\{\\H0.7x;\\S" (itoa num) "/" (itoa den) ";\}")))))

(defun c:Fractionizer  (/ ss n1 n2 eLst txt ans)
 (if (and (setq ss (ssget '((0 . "MTEXT"))))
      (setq n1 (getint "\nSpecify Numerator: "))
      (setq n2 (getint "\nSpecify Denominator: ")))
   (progn
     (initget 1 "D H")
     (setq ans (getkword "\nStacked Horizontally or Vertically? [H/D] : "))
     (cond ((= ans "H")
        (stacknum n1 n2 "H"))
       ((= ans "D")
        (stacknum n1 n2 "D")))
     (setq eLst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
     (foreach e  eLst
   (entmod (subst (cons 1 txt) (assoc 1 (entget e)) (entget e)))))
   (princ "\n<!> No Text Selected! <!>"))
 (princ))

 

Should give you a clue :thumbsup:

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...