明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 765|回复: 4

[讨论] 请教一下高手,是否可以通过LISP编程将提取的线条转化为光滑的线段

[复制链接]
发表于 2016-5-9 15:12 | 显示全部楼层 |阅读模式
本帖最后由 imustsun 于 2016-5-9 15:24 编辑

是否可以通过LISP编程将提取到的特征线条转化为一条光滑的线段,而不是一段段还有些弯曲的折线。附件中是提取到的CAD dxf文件。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2018-7-16 10:05 | 显示全部楼层
我也许要 不知道楼主找到没有
发表于 2018-7-16 10:49 | 显示全部楼层
  1. (defun c:tt (/ CNT D DIST E LEN N PTS)
  2.   (setq e (car (entsel "\n选择多段线:")))
  3.   (setq n (cdr (assoc 90 (entget e))))
  4.   (setq len (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e)))
  5.   (setq cnt (fix (1+ (/ n 10.))))
  6.   (princ (strcat "\n总节点数<"
  7.                  (itoa n)
  8.                  ">,压缩节点数为<"
  9.                  (itoa cnt)
  10.                  ">:"
  11.          )
  12.   )
  13.   (if (> cnt 1)
  14.     (setq d (/ len (1- cnt)))
  15.   )
  16.   (setq pts (cons (vlax-curve-getStartPoint e) pts))
  17.   (setq dist 0)
  18.   (if (> cnt 1)
  19.     (repeat (- cnt 2)
  20.       (setq dist (+ dist d))
  21.       (setq pts (cons (vlax-curve-getpointatdist e dist) pts))
  22.     )
  23.   )
  24.   (if (not (vlax-curve-isClosed e))
  25.     (setq pts (cons (vlax-curve-getEndPoint e) pts))
  26.   )
  27.   (command "_pline")
  28.   (foreach p pts
  29.     (command "_non" (trans p 0 1))
  30.   )
  31.   (if (vlax-curve-isClosed e)
  32.     (command "_c")
  33.     (command "")
  34.   )
  35.   (entmod (append (entget (entlast)) '((62 . 1))))
  36.   (princ)
  37. )
发表于 2018-7-17 17:15 来自手机 | 显示全部楼层
固版大神的回复一定好用
发表于 2021-10-31 23:26 | 显示全部楼层
固版大神的回复一定好用
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-27 09:05 , Processed in 0.291779 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表