BLOACH85 发表于 2022-7-6 15:12:03

如何使分数堆叠

在这个lisp中,结果是正确的,但一些挑剔的细节人员想知道它们是否可以堆叠。是否可以将vl函数合并到此表中以实现此目的?
 
 
(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 actitlerow2.5)   ;title text height = 0.27
(vla-settextheight tb acdatarow1.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)

Lee Mac 发表于 2022-7-6 15:26:27

啊,又不是那张可怕的桌子了!!:冲击::冲击:

MaxwellEdison 发表于 2022-7-6 15:34:12

告诉挑剔的细节人员,他们非常欢迎修改代码来实现这一点。

BLOACH85 发表于 2022-7-6 15:45:30

你知道这是我得到答案最快的一次了。hey Lee Mac没有自动缩放表格,只需将行高、列宽和文本大小设置为在24 X 36 dwg中工作,这是我们楼梯细节的标准,因此如果我必须使用更大的图纸,那么我将缩放它。搞清楚了。老兄,这个世界上没有人比我更厌倦看这个节目了。感谢一切是神圣的,不,如果他们想修复它,他们需要学习Lisp程序也!!!非常感谢

Lee Mac 发表于 2022-7-6 16:01:37

哈哈,你告诉他们吧

BLOACH85 发表于 2022-7-6 16:11:17

那么,我该如何将其纳入例程中,将分数堆叠在表中?

Lee Mac 发表于 2022-7-6 16:16:52

写这个是为了好玩
 

(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? : "))
   (cond ((= ans "H")
      (stacknum n1 n2 "H"))
       ((= ans "D")
      (stacknum n1 n2 "D")))
   (setq eLst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
   (foreach eeLst
   (entmod (subst (cons 1 txt) (assoc 1 (entget e)) (entget e)))))
   (princ "\n<!> No Text Selected! <!>"))
(princ))


 
应该给你一个线索
页: [1]
查看完整版本: 如何使分数堆叠