明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2546|回复: 3

怎么求两条样条曲线或是求样条曲线与直线的交点?

[复制链接]
发表于 2003-1-17 23:37:00 | 显示全部楼层 |阅读模式
我从CAD帮助文件中看到:可以用 ill 函数来求两直线的交点,可是如果是求两条样条曲线或是求样条曲线与直线的交点该怎么办呢?
发表于 2003-1-18 08:51:00 | 显示全部楼层

Trim

发表于 2003-1-20 10:52:00 | 显示全部楼层

I remember Long Long Zai pasted this routine months ago, probably it might he

I remember Long Long Zai pasted this routine months ago, probably it might help you.[br];;-----------------------------------------------
;; CDNC5-02.LSP
;; Bill Kramer
;; Find all intersections between objects in
;; the selection set SS.
;; Process - Create drawing with intersecting lines and lwpolylines.
;;           Load function set
;;           Run command function INTLINES
;;           Intersections are marked with POINT objects on current layer
(defun C:INTLINES (/ SSL ;length of SS
   PTS ;returning list
   AOBJ1 ;Object 1
   AOBJ2 ;Object 2
   N1 ;Loop counter
   N2 ;Loop counter
   IPTS ;intersects
   A N NN HOLDOSMODE
  )
  (vl-load-com)
  (command "_.UNDO" "_GROUP")
  (setq HOLDOSMODE (getvar "OSMODE"))
  (setvar "OSMODE" 0)
  (setq SS (ssget '((0 . "*LINE,ARC,CIRCLE,ELLIPSE"))))
  (setq N1  0 ;index for outer loop
SSL (sslength SS)
  ) ; Outer loop, first through second to last
  (while (< N1 (1- SSL)) ; Get object 1, convert to VLA object type
    (setq AOBJ1 (ssname SS N1)
  AOBJ1 (vlax-ename->vla-object AOBJ1)
  N2 (1+ N1)
    ) ;index for inner loop
;;; Inner loop, go through remaining objects
    (while (< N2 SSL) ; Get object 2, convert to VLA object
      (setq AOBJ2 (ssname SS N2)
    AOBJ2 (vlax-ename->vla-object AOBJ2)
;;;Find intersections of Objects
    IPTS  (vla-intersectwith
    AOBJ1
    AOBJ2
    0
  ) ; variant result
    IPTS  (vlax-variant-value IPTS)
      )
;;;Variant array has values?
      (if (> (vlax-safearray-get-u-bound IPTS 1) 0)
(progn ;array holds values, convert it
  (setq IPTS ;to a list.
(vlax-safearray->list IPTS)
  )
;;;Loop through list constructing points
  (while (> (length IPTS) 0)
    (setq PTS  (cons (list (car IPTS)
   (cadr IPTS)
   (caddr IPTS)
     )
     PTS
       )
  IPTS (cdddr IPTS)
    )
  )
)
      )
      (setq N2 (1+ N2))
    ) ;inner loop end
    (setq N1 (1+ N1))
  ) ;outer loop end
  (print PTS)
  (setvar "OSMODE" HOLDOSMODE)
  (command "_.UNDO" "_END")
  (princ)
)
发表于 2003-1-20 10:59:00 | 显示全部楼层

http://www.mjtd.com/bbs/dispbbs.asp?boardID=3&RootID=9982&ID=9993

http://www.mjtd.com/bbs/dispbbs.asp?boardID=3&RootID=9982&ID=9993

http://www.mjtd.com/bbs/dispbbs.asp?boardID=3&RootID=12521&ID=12698
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 02:45 , Processed in 0.157166 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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