powpowmitch 发表于 2022-7-6 06:49:00

LISP变暗线长度,但需要

你好
 
我正在调暗2D中的消防线。本质上,这些管线是管道。我发现了一个很好的lisp例程,可以在绘图上显示管道的大小和长度。这太完美了。
 
但我希望dims四舍五入到5,即3253将变为3255mm
 
我已经把代码贴在下面了,有人能帮我吗?

;;;
;;;PipeDim
;;;
;;;Description
;;;-----------
;;;PIPEDIM creates length and size dimension text for each pipe selected.
;;;

(defun c:pipedim( / pipedim_ss j)
; Call initialization function
(igneus_init)
; get pipe size to use
(if (null igneus_curPipeSize) (setq igneus_curPipeSize 1.0))
(setq j igneus_curPipeSize)
(if (null (setq igneus_curPipeSize (getReal (strcat '"Enter pipe size <" (rtos igneus_curPipeSize 2 2) '">:"))))
   (setq igneus_curPipeSize j))
; Let the use select the pipe to dimension
(princ "\nSelect pipe to dimension")
(setq pipedim_ss (ssget))

;;; Dimension each line in the selection set
(setq j 0)
(while (< j (ssLength pipedim_ss))
   (if (= '"LINE" (cdr (assoc 0 (entget (ssname pipedim_ss j)))))
   (pipedim_entity (ssname pipedim_ss j) igneus_curPipeSize igneus_footchar))
   (setq j (+ j 1)) )
(igneus_end)
)

Lee Mac 发表于 2022-7-6 06:57:03

您是否希望舍入“igneus\u curPipeSize”变量的值?
 
如果看不到整个程序,很难为您提供帮助,因为您缺少igneus\u init和igneus\u end函数的定义,但更重要的是,缺少pipedim\u实体函数的定义。

powpowmitch 发表于 2022-7-6 07:00:34

李·麦克,
 
我希望线下显示的长度四舍五入到最接近的5mm。
 
代码到long to post。伊涅斯。lsp

powpowmitch 发表于 2022-7-6 07:05:36

还有谁能帮忙吗?我已经附上了上面的整个lsp。。。期待您的帮助。

nod684 发表于 2022-7-6 07:11:56

试试这个:
 
<br> <br>(defun c:Test (/ )<br>(setq CmdOld (getvar "cmdecho")) <br>(setvar "cmdecho" 0) <br>(setq DIMNEW (entsel "\n Select Dimension to Round Off:"))<br>(command "dimoverride" "dimrnd" "5" "" DIMNEW) <br>(setvar "cmdecho" CmdOld) <br>(princ)<br>)<br> <br>
 
 
编辑:
 
哎呀!对不起,我误解了帖子

powpowmitch 发表于 2022-7-6 07:17:03

李-真的很想看看你能不能帮我解决这个问题,伙计

MSasu 发表于 2022-7-6 07:24:36

像这样的?
(defun RoundToNearestFive( theNumber / theDifference )
(setq theDifference (rem theNumber 5.0))

(if (< theDifference 2.5)
(setq theNumber (- theNumber theDifference))
(setq theNumber (+ theNumber (- 5 theDifference)))
)

theNumber
)

powpowmitch 发表于 2022-7-6 07:31:19

伊涅斯。lspMSasu我应该在什么地方将其纳入所附代码?也许你可以帮我修改一下,然后重新加载??请

irneb 发表于 2022-7-6 07:32:50

在LSP文件的第651行,您需要更改以下内容:
看起来像这样
然后您还需要将MSasu的代码加载到图形中,以便RoundToNearestFive函数可用。最简单的方法是简单地将其复制到igneus中。lsp文件(就在第919行“默认设置”之前)。

powpowmitch 发表于 2022-7-6 07:38:30

米奇普迪姆。lsp Thakeyou这么多它的工作。。。。我已附上任何感兴趣的人。
 
我用它来模糊自动喷水灭火器的图纸
页: [1] 2
查看完整版本: LISP变暗线长度,但需要