圆角API
建议您避免在AutoLISP中使用(命令)函数。但是,修剪和圆角/倒角似乎是三项任务,使用(命令)功能是唯一可行的选择。(甚至com方法也不适用于它们)。
我想在这里谈谈大家的想法。 可以使用ActiveX方法编程创建复杂实体。
你可以在我的博客中看到一些例子,特别是关于开发两个新的3DSolid编辑命令:TRIM和SPLIT-inhttp://lispexpert.blogspot.com/p/chapter-18.html
您可以下载这两个命令进行测试。 复杂固体从哪里来?
这是一个简单的问题-除了使用(命令“fillet”…)之外,您还有其他选择吗。 在二维上下文中使用TRIM的示例程序。。。
加载它,并在命令行中键入GRAPH的一系列行中尝试暗显:
(defun code-value (key ename)
(cdr (assoc key (entget ename)))
) ;_ end ofdefun
;;;Listing 10.9. Retrieving the value associated with a DXF group code.
(defun ent-text
(txt-string style pt1 pt2 txt-height h-just v-just)
(entmake (list '(0 . "TEXT")
'(100 . "AcDbEntity")
'(100 . "AcDbText")
(cons 1 txt-string)
(cons 7 style)
(cons 10 pt1)
(cons 11 pt2)
(cons 40 txt-height)
(cons 72 h-just)
(cons 73 v-just)
) ;_ end of list
) ;_ end of entmake
) ;_ end of defun
;;;Listing 10.12. Fuction that creates a single line text entity.
(defun endpoint-circle
(radius / lines i line-ent pin pfi)
(if (setq lines (ssget "X" '((0 . "LINE"))))
(progn (setq i 0)
(while (setq line-ent (ssname lines i))
(setq pin (code-value 10 line-ent)
pfi (code-value 11 line-ent)
) ;_ end of setq
(if (not (member pin drawn))
(progn (vl-cmdf "._circle" pin radius)
(setq drawn (cons pin drawn))
) ;_ end of progn
) ;_ end of if
(if (not (member pfi drawn))
(progn (vl-cmdf "._circle" pfi radius)
(setq drawn (cons pfi drawn))
) ;_ end of progn
) ;_ end of if
(setq i (1+ i))
) ;_ end of while
) ;_ end of progn
) ;_ end of if
) ;_ end of defun
;;;Listing 12.2. Function that draws circles at the line endpoints.
(defun trim-line-circle (/ circles lines obj endpoints)
(if (and (setq circles (ssget "X" '((0 . "CIRCLE"))))
(setq lines (ssget "X" '((0 . "LINE"))))
) ;_ end of and
(progn (setq i 0)
(while (setq obj (ssname lines i))
(setq endpoints (cons (code-value 11 obj)
(cons (code-value 10 obj)
endpoints
) ;_ end of cons
) ;_ end of cons
i (1+ i)
) ;_ end of setq
) ;_ end of while
(foreach pt endpoints
(vl-cmdf "._trim" circles "" pt "")
) ;_ end of foreach
(if (> (getvar "cmdactive") 0)
(vl-cmdf)
) ;_ end of if
) ;_ end of progn
) ;_ end of if
) ;_ end of defun
;;;Listing 12.3. Function that demonstrates the use of TRIM from a VLISP function.
(defun number-nodes (pt-lst height / i pt)
(setq pt-lst
(vl-sort pt-lst
'(lambda (pt1 pt2) (> (cadr pt1) (cadr pt2)))
) ;_ end of vl-sort
) ;_ end of setq
(setq i 0)
(while (setq pt (nth i pt-lst))
(ent-text (itoa (1+ i))
(getvar "textstyle")
pt
pt
height
1
2
) ;_ end of ent-text
(setq i (1+ i))
) ;_ end of while
) ;_ end of defun
;;;Listing 12.4. Graph nodes numbering function.
(defun C:GRAPH (/ *error* radius drawn)
(defun *error* (msg)
(vl-cmdf "_UNDO" "_END")
(vl-cmdf "_U")
(setvar "osmode" oom)
(prompt msg)
)
(setq oom (getvar "osmode"))
(setvar "osmode" 0)
(vl-cmdf "_UNDO" "_BEGIN")
(setq radius (getreal "\nSpecify cirle radius: " ))
(endpoint-circle radius)
(trim-line-circle)
(number-nodes drawn radius)
(vl-cmdf "_UNDO" "_END")
(setvar "osmode" oom)
(princ)
)
;;;Listing 12.5. New command that automates the creation of network diagrams.
命令圆角本质上是交互式的。具有圆边的实体可以编程为实体图元的组合,即复杂实体。
如您所知,没有圆角方法。所以方法是编程一个复杂的实体。
作为实体的交互式修剪,您可以按照我提供的参考进行编程。当然,这只是使用现有方法的一种方式,而不是其他方式。
但它可以节省几次鼠标点击。毕竟,这就是AutolISP的全部内容。
顺便说一句,我用作化身的对象是使用AutoLISP制作的3DSolid。。。我觉得有点复杂。
雷纳尔多·N·多哥,
该线程与复杂实体无关。那你为什么一再发布无关信息,误导人们,劫持帖子?
我非常感谢你的专业知识,你的化身,你的博客和你的书。但请找到更合适的方式来推广他们,而不是其他人的帖子。
对我来说,你的两个帖子都是垃圾邮件。
如果你继续这样做,我将不得不停止张贴在这个论坛。 NirantarVidarthee:
我使用AUTOCADLT 2000,它有一个工具栏,上面有三个图标,你只需点击它们。2010年没有工具栏吗?? 由于多哥先生不明白我写了什么,并继续垃圾邮件,我放弃了这个线程。
我会尝试从其他论坛获得回复。
非常感谢。
页:
[1]