明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 672|回复: 1

[提问] 曲线上放样

[复制链接]
发表于 2021-4-11 14:54:09 | 显示全部楼层 |阅读模式
(defun C:ff ( / &dis1 &dis2 &k1 &n1  &p1 p2 &ss1 &len yx)
    (if (null vlax-dump-object) (vl-load-com) )
    (setq &ss1 '("LINE" "LWPOLYLINE" "CIRCLE" "ARC" "HELIX" "ELLIPSE" "SPLINE" "POLYLINE")) ;曲线有起点:直线,多段线,圆,圆弧,螺旋对象,椭圆,样条曲线,二维多段线

        (setq &k1 (entsel "\n请选择曲线"))
            (while (= nil &k1)
                (setq &k1 (entsel "\n没有选择曲线,重新选择"))
            )
        (setq &k1 (car &k1))
        (member (cdr (assoc 0 (entget &k1))) &ss1);确认是曲线

        (setq &p1 (getpoint "\n选择曲线上第一点:"))
            (while (not (vlax-curve-getDistAtPoint &k1 &p1))
                (setq &p1 (getpoint "\n没有选在曲线上,重新选择:"))
            )   
        (setq &len (getreal "\n输入偏移长度:"))   

        (setq &p1 (vlax-curve-getclosestpointto &k1 &p1));取得最近点
        (setq &n1 (vlax-curve-getParamAtPoint &k1 &p1));取得参数
        (setq &dis1 (vlax-curve-getDistAtParam &k1 &n1));到起点距离
        (setq &dis2 (+ &dis1 &len))

        (setq p2 (vlax-curve-getPointAtDist &k1 &dis2))
        (setq yx (getpoint p2))
        ;(princ (strcat "\n p2的坐标是" &p2))
        (command "circle" yx "1");命令行显示
    (princ)
)

请问这段代码为什么一直画不出最后的圆那? 还有如果选择的曲线是圆弧也有问题,该怎么调试那?



发表于 2021-4-11 16:05:00 | 显示全部楼层
一行一行试
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-16 21:24 , Processed in 0.162197 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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